4
$\begingroup$

I'm trying to plot something using Plot[], and Mathematica keeps leaving off one of the axes. I can set Axes->{True,True}, but one of the axes is still missing. Unfortunately the functions I'm plotting have rather long expressions, and I can't find a shorter example that reproduces the behavior, so I can't show exactly what's going on. What are some possible reasons that Mathematica might leave one of the axes off of a plot, even with Axes->{True,True}?

$\endgroup$
2

3 Answers 3

7
$\begingroup$

You might be having a problem with AxesOrigin being off the plot. We can force this to happen by specifying both AxesOrigin and PlotRange:

Plot[x^2, {x, 0, 1}, AxesOrigin -> {-1, 0}, PlotRange -> {{0, 1}, {0, 1}}]

enter image description here

If setting PlotRange -> All or PlotRange -> Full doesn't do the trick, you can manually specify the origin using: AxesOrigin -> {x, y}.

$\endgroup$
4
  • 2
    $\begingroup$ I just have tried AxesOrigin -> Scaled[{1, 1}] and it changes nothing! It seems that Scaled specification for AxesOrigin does not work! $\endgroup$ Apr 16, 2015 at 9:17
  • $\begingroup$ @AlexeyPopkov Confirmed... that's pretty weird. I think I remember reading another question that explained this behavior, but I can't find it now. Something to do with the order in which the positions are calculated. $\endgroup$ Apr 16, 2015 at 14:10
  • $\begingroup$ Is Scaled specification for AxesOrigin documented? I have tried specifications like fScaled but they produce no error messages and changes nothing like Scaled. In previous versions incorrect specifications produced error messages, but now there are no messages and nothing happens: incorrect specifications seems to be simply ignored. I do not like this. $\endgroup$ Apr 16, 2015 at 14:42
  • $\begingroup$ Setting a specific origin worked. It's a little odd that the default origin was off the plot, though, especially since it wasn't on very similar plots. $\endgroup$
    – Matt
    Apr 16, 2015 at 16:19
2
$\begingroup$

Another possibility is to use PlotRangePadding.

Lets take 2012rcampion's answer

 Plot[x^2, {x, 0, 1}, AxesOrigin -> {-1, 0}, PlotRange -> {{0, 1}, {0, 1}}, PlotRangePadding -> {2, 0}]

enter image description here

You can change the padding range to see when your axes are appearing.

$\endgroup$
-2
$\begingroup$
Plot[x^2, {x, 0, 1}, AxesOrigin -> {-1, -1}, PlotRange -> {{0, 1}, {0, 1}}]
$\endgroup$
3
  • 1
    $\begingroup$ Are you sure this answers the questions at hand ? $\endgroup$
    – Sektor
    Apr 26, 2015 at 14:00
  • $\begingroup$ While this reproduces the issue described, albeit without demonstrating that the ineffectiveness of Axes -> {True, True}, it does not address the question asked by the OP. Consider adding an answer to the question or deleting your answer. $\endgroup$
    – Michael E2
    Apr 26, 2015 at 16:21
  • $\begingroup$ no axis sure!!!! $\endgroup$ Apr 26, 2015 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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