2
$\begingroup$

I have no problem getting Mathematica to shift the origin in my Plot. What I have a problem with, however, is getting Mathematica to show the tick marks at the origin.

More specifically, I don't need Mathematica to show the Y-value at the origin, but I would like it to show the X-value at the origin in the plot below, where I have shifted the origin to X = 1, Y = 0.

enter image description here

$\endgroup$
4
$\begingroup$

Using s is from OP's previous question:

You can use the option PlotRangePadding:

StackedListPlot[s[[1]], FillingStyle -> {4 -> White}, AxesOrigin -> {1, 0}, 
    PlotRangePadding -> {Scaled[.01], 0}, ImageSize -> Large]  

enter image description here   Alternatively, the option Method with sub-option "AxisPadding":

StackedListPlot[s[[1]], FillingStyle -> {4 -> White} , AxesOrigin -> {1, 0}, 
    Method -> {"AxisPadding" -> {Scaled[.01], 0}}, ImageSize -> Large] 

enter image description here

Finally, you can add the desired tick labels using Epilog:

StackedListPlot[s[[1]],FillingStyle -> {4 -> White} , AxesOrigin -> {1, 0},
  Epilog -> Text[Style[1, "GraphicsLabel"], {1, -.01},{0, 1}], 
  PlotRangeClipping -> False, ImageSize -> Large] 

enter image description here  

$\endgroup$
  • 1
    $\begingroup$ where did you learn about "AxisPadding"? $\endgroup$ – Mike Honeychurch Oct 29 '18 at 21:35
  • 2
    $\begingroup$ @MikeHoneychurch, tried Charting`ResolvePlotTheme[Automatic, Plot] $\endgroup$ – kglr Oct 29 '18 at 21:37
  • 1
    $\begingroup$ thanks! Yet another good find from the Charting context. Wish a lot of that stuff was documented $\endgroup$ – Mike Honeychurch Oct 29 '18 at 21:41
  • 1
    $\begingroup$ The PlotRangePadding solution was very helpful! $\endgroup$ – user120911 Oct 30 '18 at 8:42
0
$\begingroup$

Your title says you want to show "X = 0" but your graph tick shows you want "X = 1" and your label seems to show you want it labeled "2".

Please fix your question. And try this:

Ticks -> {Range[5],Automatic}
$\endgroup$
  • 2
    $\begingroup$ For some reason, that didn't work. But the crude AxesOrigin -> {0.965, 0} was satisfactory. It seems Mathematica doesn't like numbers at the origin? $\endgroup$ – user120911 Oct 29 '18 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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