2
$\begingroup$

How to show the zero point of the crossing point between two axis ?enter image description here

$\endgroup$
5
  • 2
    $\begingroup$ Add AxesOrigin -> {0, 0} to the options for your plot. $\endgroup$
    – MassDefect
    Commented Apr 2, 2019 at 8:14
  • 2
    $\begingroup$ AxesOrigin can only specify where any axes drawn should cross, it doesn't show the origin number. $\endgroup$
    – karry
    Commented Apr 2, 2019 at 10:03
  • $\begingroup$ @KarryMa, You can use the manual definition of Ticks to add your own ticks on the axis. Try Ticks->{Table[i,{0,0.3,0.1}],Table[i,{0,0.3,0.1}]} $\endgroup$
    – Rom38
    Commented Apr 2, 2019 at 10:08
  • $\begingroup$ Oh, I take it the graph in your question includes the point (0, 0) but it's simply not displaying the 0 tick mark labels? $\endgroup$
    – MassDefect
    Commented Apr 2, 2019 at 15:07
  • $\begingroup$ Yeah,it has been solved,thanks a lot! $\endgroup$
    – karry
    Commented Apr 4, 2019 at 2:02

1 Answer 1

1
$\begingroup$
data = {{0.01, 0.02}, {0.21, 0.12}, {0.41, 0.22}};

plotrange = {0, Max[#]} & /@ Transpose[data];

plot = ListLinePlot[data, PlotRange -> plotrange]

enter image description here

To change the zeros to "0" FindTicks can be used. This includes a replacement to increase the tick height to 0.007 because otherwise they shrink a bit. (No one knows why.)

ticks = Charting`FindTicks[{0, 1}, {0, 1}] @@@ plotrange /.
   {{0., 0} -> {0., "0"}, {0.005, 0.} -> {0.007, 0.}};

ListLinePlot[data, PlotRange -> plotrange, Ticks -> ticks]

enter image description here

$\endgroup$
3
  • $\begingroup$ Right, thank you! $\endgroup$
    – karry
    Commented Apr 3, 2019 at 14:20
  • $\begingroup$ No problem. BTW you could use ListLinePlot[data, PlotRange -> {{0, Automatic}, {0, Automatic}}] $\endgroup$ Commented Apr 3, 2019 at 16:08
  • $\begingroup$ Yeah,wise men seek more. $\endgroup$
    – karry
    Commented Apr 4, 2019 at 2:13

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.