1
$\begingroup$

This question already has an answer here:

By default, Mathematica usually adds a little extra axes lengths in plots (in this case, for x<0 and y<0):

Plot[x^2, {x, 0, 5}]

enter image description here

Which we can of course fix using PlotRange:

Plot[x^2, {x, 0, 5}, PlotRange -> {{0, 5}, {0, 25}}]

enter image description here

Now I want to do the same with ChromaticityPlot, which by default has some strange axes range:

ChromaticityPlot[{}]

enter image description here

However, even though PlotRange is an option for ChromaticityPlot, using it doesn't seem to totally work:

ChromaticityPlot[{}, PlotRange -> {{0, .8}, {0, .85}}]

enter image description here

I say 'totally' because it does change the upper bounds of the axes, but it doesn't make the origin where the axes meet. In fact, actually, if you look closely, it adds a little extra to the upper bound of the axes too, even if it changes them.

Am I missing something simple? How can I do this?

$\endgroup$

marked as duplicate by Mr.Wizard plotting Mar 7 '17 at 6:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Set PlotRangePadding->None. You'll see similar behavior in your first plot if you set Frame->True. $\endgroup$ – N.J.Evans Sep 29 '16 at 18:43
  • 1
    $\begingroup$ @N.J.Evans, ah, of course... I missed that it takes all Graphics options. So this happens here because ChromaticityPlot automatically has a Frame? If you make this an answer, I'll select it. $\endgroup$ – YungHummmma Sep 29 '16 at 18:51
3
$\begingroup$

ChromaticityPlot uses a frame rather than an axis, so you'll need to set the option PlotRangePadding->None.

Additionally, setting Frame-False,Axes->True is not enough, to get rid of the extra little bit of axis you see, so PlotRangePadding has to be explicitly mentioned in this case.

ChromaticityPlot[
 {}
 , PlotRange -> {{0.1, 0.5}, {0.1, 0.5}}
 , Frame -> False
 , Axes -> True
 ]

enter image description here

vs.

ChromaticityPlot[
     {}
     , PlotRange -> {{0.1, 0.5}, {0.1, 0.5}}
     , Frame -> False
     , Axes -> True
     , PlotRangePadding->None
     ]

enter image description here

$\endgroup$

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