# Axes Ticks labeled with absolute values of the coordinates

Posted 9 years ago
6895 Views
|
5 Replies
|
6 Total Likes
|
 I have a 3D (sphericalPlot3D) plot having axes spanning across both negative and positive sides of zero. Instead of showing the true values of ticks, I want to show the magnitude of ticks (absolute value) only. It means, positive ticks will remain same but negative tics will get converted to positive ones with same magnitude. Please let me know how to do it. Thanks
5 Replies
Sort By:
Posted 7 years ago
 this doesn't seem to work any longer. I can't get any tick function to work at all. Does anyone know why the above example doesn't work any more? Thanks.
Posted 9 years ago
 Another option is to use a tick function. You can also add formatting to the tick labels inside this tick function if needed. See NumberForm and related functions.  tick[min_, max_] := Table[{i, Abs@i}, {i, Ceiling[min], Floor[max], 0.5}] SphericalPlot3D[1 + 2 Cos[2 \[Theta]], {\[Theta], 0, Pi}, {\[Phi], 0, 2 Pi}, Ticks -> tick] 
Posted 9 years ago
 thanks, it helps
Posted 9 years ago
 You have to set the Ticks option manually like this: SphericalPlot3D[1+2Cos[2\[Theta]],{\[Theta],0,Pi},{\[Phi],0,2Pi},Ticks->{{#,Abs[#]}&/@Range[-1,1,0.5],{#,Abs[#]}&/@Range[-1,1,0.5],{#,Abs[#]}&/@Range[-6,6,0.5]}] or equivalently: SphericalPlot3D[1+2Cos[2\[Theta]],{\[Theta],0,Pi},{\[Phi],0,2Pi},Ticks->{{{-1.,1.},{-0.5,0.5},{0.,0.},{0.5,0.5},{1.,1.}},{{-1.,1.},{-0.5,0.5},{0.,0.},{0.5,0.5},{1.,1.}},{{-6.,6.},{-5.5,5.5},{-5.,5.},{-4.5,4.5},{-4.,4.},{-3.5,3.5},{-3.,3.},{-2.5,2.5},{-2.,2.},{-1.5,1.5},{-1.,1.},{-0.5,0.5},{0.,0.},{0.5,0.5},{1.,1.},{1.5,1.5},{2.,2.},{2.5,2.5},{3.,3.},{3.5,3.5},{4.,4.},{4.5,4.5},{5.,5.},{5.5,5.5},{6.,6.}}}] 
Posted 9 years ago
 thanks a lot !!