How to make unit interval on both axes to have equal lengths visually in Mathematica
I want to make a plot in which unit interval on both axes to have equal lengths visually. i.e. I want (1,1) and (0,0) to make a square rather than an elongated rectangle.
I could not find the option to make it possible for the following simple case:
ListLinePlot[{{{0, 0}, {1, -1}, {2, -2}, {3, -1}, {4, -2}, {5, -3开发者_如何学JAVA}, {6, -4}, {7,
-3}, {8, -2}, {9, -1}}}]
Thank you for your help.
Edit
More generally, how to adjust the ratio of the unit interval on x-axis to that on y-axis? AspectRatio
option does not seem to directly correlate with it.
You want: AspectRatio -> Automatic
.
Example of the requested generalization:
p = Plot[Sin[x], {x, 0, 10}];
range = First /@ Differences /@ (PlotRange /. Options[p]);
target = 1/2;(* 1 y == 2 x *)
Show[p,
AspectRatio -> (Last[range]/First[range]/target)]
(Plot
by default will include an explicit plot range, so we can use Options
, as long as we don't set something like PlotRange->All
.)
精彩评论