2

I need to plot in Mathematica without labeling. For example, this code:

Plot[Sin[x], {x, 0, 6 Pi}, Frame -> True, Axes -> False, 
PlotRange -> {{0, 10}, {-2, 2}}]

produces this plot:

enter image description here

However, I need only figure and not the labeling of horizontal and vertical axis.

VividD
  • 3,660
  • 4
  • 26
  • 42
zenith
  • 549
  • 1
  • 8
  • 16

3 Answers3

4

You can (mis)use FrameTicksStyle:

Plot[Sin[x], {x, 0, 6 Pi}, Frame -> True, Axes -> False, 
 PlotRange -> {{0, 10}, {-2, 2}}, 
 FrameTicksStyle -> Directive[FontOpacity -> 0, FontSize -> 0]]

enter image description here

3
 Plot[Sin[x], {x, 0, 6 Pi}, Frame -> True, Axes -> False, 
 PlotRange -> {{0, 10}, {-2, 2}},
 FrameTicksStyle -> {{{0.1}, None}, {0.1, None}}]
David G. Stork
  • 41,180
  • 3
  • 34
  • 96
3

If you want to keep the tick marks, then how about this:

Plot[Sin[x], {x, 0, 6 Pi}, Frame -> True, Axes -> False, 
 PlotRange -> {{0, 10}, {-2, 2}}, LabelStyle -> Opacity[0]]

labels gone

Here I used LabelStyle to make the labels transparent (even though they are still generated together with the ticks). Alternatively, you can manually specify the tick marks with empty labels, but I assume you want something that retains the automatic placement of the ticks.

Another approach:

There's also this method, using the ImagePadding option:

Plot[Sin[x], {x, 0, 6 Pi}, Frame -> True, Axes -> False, 
 PlotRange -> {{0, 10}, {-2, 2}}, ImagePadding -> 1]

labels gone

What this does is to make the border around the frame defined by the PlotRange so thin that there isn't enough room to display any of the tick labels. I just have to make sure that there is enough padding to show the frame, that's why the value 0 doesn't work.

Jens
  • 97,245
  • 7
  • 213
  • 499