Message Boards Message Boards

1
|
7939 Views
|
5 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Axes Ticks labeled with absolute values of the coordinates

Posted 10 years ago

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

POSTED BY: S G
5 Replies

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 BY: Lobel Crnogorac

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]

enter image description here

POSTED BY: Nasser M. Abbasi
Posted 10 years ago

thanks, it helps

POSTED BY: S G

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 BY: Sander Huisman
Posted 10 years ago

thanks a lot !!

POSTED BY: S G
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract