开发者

Two quick Mathematica questions

  1. How do I remove the numbers on the x-axis only not the y-axis?
  2. Is it possible to shift the y-axis without shifting the funct开发者_StackOverflow社区ions? What I mean is, instead of having the y-axis at x = 0, could I have it at x = -5?


With most options controlling axes, you can use a list of two values to specify different behavior for the two axes. How are you currently removing the numbers? The only way I can think of off the top of my head is to manually specify tick locations, without labels, something like this:

Ticks -> {{{0, ""}, {1, ""}, {2, ""}}, Automatic}

Otherwise you'd have to start munging around with the graphics output, I guess? In any case, whatever you do, you can use a two-element list like that to apply different options to each dimension.

To relocate the axes, you can use the option AxesOrigin; in your example, you'd use AxesOrigin->{-5,0}.


The tick marks are controlled by either Ticks, or FrameTicks if Frame -> True. Note, plots like ContourPlot and DensityPlot have a frame by default (i.e. Frame -> True). The specification for Ticks is

Ticks -> {<x ticks>, <y ticks>, <z ticks>}

where the z ticks are only present for 3D plots. The FrameTicks specification is

FrameTicks -> { {left, right}, {bottom, top} }

Both Ticks and FrameTicks accept both Automatic and None to use the default algorithms or have no ticks, respectively. So, to eliminate only the ticks on the x-axis you do

Ticks -> { None, Automatic }

and for frames

FrameTicks -> { {Automatic, Automatic}, {None, None} }

If you want to have more control of the exact placement of the ticks, then @Jefromi is correct, you'll need to specify a list. The Ticks and FrameTicks documentation are worth the read to get a better feel of how to do this. Be aware, though, that doing anything more complex than listing a few points is something of a black art in Mathematica, and leads to a lot of frustration.

As to your second question, you use AxesOrigin -> {-5, 0} as @Jefromi pointed out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜