2
$\begingroup$

Possible Duplicate:
Remove tick labels, but retain tick marks in RegionPlot (and related functions)

I need to display a 2D graph, say $y=x^2$ with tick-marks along the $x$ and $y$-axes but with no numbers (e.g. 1, 2, 3 ...) indicating these tick-mark values.

What is the most efficient way to perform this task? Thanks!

$\endgroup$
1

3 Answers 3

5
$\begingroup$

For example:

Plot[x x, {x, 0, 1}, Ticks -> ({#, #} &@Array[{1/10 #,} &, 10])]

Mathematica graphics

$\endgroup$
9
  • 1
    $\begingroup$ You sure like your styled plots. $\endgroup$
    – Mr.Wizard
    Commented Oct 20, 2012 at 19:48
  • 1
    $\begingroup$ @Mr.Wizard Yeah! Don't you? $\endgroup$ Commented Oct 20, 2012 at 20:28
  • $\begingroup$ Wow, very fancy! I don't even know what # and &@ do, but it works! $\endgroup$
    – QuantumDot
    Commented Oct 20, 2012 at 23:04
  • $\begingroup$ How did you make your plot stylized like that? $\endgroup$
    – QuantumDot
    Commented Oct 20, 2012 at 23:05
  • 2
    $\begingroup$ Honestly? Torn is great but I'd rather you use the actual output of Plot not the "hand drawn" version, which I find confusing and already a little tiring. Are you glad you asked? :^) $\endgroup$
    – Mr.Wizard
    Commented Oct 21, 2012 at 5:10
8
$\begingroup$

This isn't clever, but it works:

Plot[x^2, {x, 0, 10}, LabelStyle -> {White}]

Is that sufficient? But, I think the use of FrameTicksStyle in the link in Mr.Wizards answer is better. Alternatively, specifying your own ticks as MW says gives you more control of tick placement. It's easier to use Table to specify the ticks, though.

$\endgroup$
1
  • $\begingroup$ @Mr.Wizard Thanks $\endgroup$ Commented Oct 20, 2012 at 19:56
4
$\begingroup$

If you are asking to preserve the Automatic ticks but remove their labels this is a duplicate of: Remove tick labels, but retain tick marks in RegionPlot (and related functions)

If you are asking to place your own ticks without labels you can simply specify an empty string "" or Spacer[0] as the tick label.

Plot[x^2, {x, 0, 5}, 
 Ticks -> {{{1, Spacer[0]}, {2, Spacer[0]}, {3, Spacer[0]}},
           {{5, Spacer[0]}, {15, Spacer[0]}, {25, Spacer[0]}}}
]

Mathematica graphics

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for the heads up on the duplicate. $\endgroup$
    – QuantumDot
    Commented Oct 20, 2012 at 23:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.