3
$\begingroup$

I know I can manipulate ticks:

 Plot[PDF[NormalDistribution[0, 1.5], x], {x, -7, 7}, 
   Ticks -> {{
     {-6, "-6σ"}, {-5, "-5σ"}, {-4, "-4σ"}, {-3, "-3σ"}, {-2, "-2σ"}, {-1, "-σ"}, 
     {1, "σ"}, {2, "2σ"}, {3, "3σ"}, {4, "4σ"}, {5, "5σ"}, {6, "6σ"}
 }}]

But the ticks disappear when I add Frame -> True. What am I doing wrong?

$\endgroup$

closed as off-topic by corey979, m_goldberg, MarcoB, march, eyorble Feb 20 at 16:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – corey979, m_goldberg, MarcoB, march, eyorble
If this question can be reworded to fit the rules in the help center, please edit the question.

6
$\begingroup$

Nothing wrong as such... only for Frame you need the FrameTicks option (to add some spice see another way to get your ticks):

xticks = {#, StringReplace[ToString[# σ], " " -> ""]} & /@Range[-6, 6];

Plot[PDF[NormalDistribution[0, 1.5], x], {x, -7, 7}, 
 FrameTicks -> {{Automatic, None}, {xticks, xticks}}, Frame -> True]

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ Typographic note. I suggest replacing StringReplace[ToString[# σ], " " -> ""] with StringReplace[ToString[# σ], " " -> "\[VeryThinSpace]"]. The difference is subtle, but inserting a very-thin-space really makes the tick labels look better. $\endgroup$ – m_goldberg Sep 22 '13 at 8:51
  • $\begingroup$ @m_goldberg agreed - I just wanted to reproduce the OP´s ticks 1:1. Without that, generating the ticks could be done more straightforward, too. $\endgroup$ – Yves Klett Sep 22 '13 at 8:54