As stated in the Mathematica documentation,
PointSize[d]
is a graphics directive which specifies that points which follow are to be shown if possible as circular regions with diameterd
. The diameterd
is given as a fraction of the total width of the plot.
On the other hand,
Scaled[{dx,dy,...},{x_0,y_0,...}]
gives a position obtained by starting at ordinary coordinatesx_0,y_0,...
, then moving by a scaled offset{dx,dy,...}
.
In this case, the scaled offsets are specified as a fraction of each plot direction.
This leads to an apparent incompatibility in combining circular objects whose sizes are determined by the width of the plot (and because they are circular, their extent along the vertical direction is also specified by the width of the plot) and objects with vertical offsets which are determined by the height of the plot -- how can this be reconciled?
As an example, if I apply a horizontal offset, the offset objects are positioned as expected (on the boundary of the points), regardless of the specified plot range:
sites = Flatten[Table[{i, j}, {i, 0, 3}, {j, 0, 1}], 1];
psize = 0.12;
offset = psize/2;
Graphics[{PointSize[psize], Map[Point[#] &, sites], PointSize[0.2 psize],
Red, Map[Point[Scaled[{offset, 0}, #]] &, sites]},
PlotRange -> Automatic, Frame -> True]
Graphics[{PointSize[psize], Map[Point[#] &, sites], PointSize[0.2 psize],
Red, Map[Point[Scaled[{offset, 0}, #]] &, sites]},
PlotRange -> {{-1, 4}, Automatic}, Frame -> True]
If I try the same with a vertical offset, however, the offsets do not remain fixed since the point size is changing as the width of the plot is adjusted:
Graphics[{PointSize[psize], Map[Point[#] &, sites], PointSize[0.2 psize],
Red, Map[Point[Scaled[{0, offset}, #]] &, sites]},
PlotRange -> Automatic, Frame -> True]
Graphics[{PointSize[psize], Map[Point[#] &, sites], PointSize[0.2 psize],
Red, Map[Point[Scaled[{0, offset}, #]] &, sites]},
PlotRange -> {{-1, 4}, Automatic}, Frame -> True]
Is there way to specify a vertical offset based on the width of the plot, or some other way to resolve this issue?
Lastly, I am using Point
rather than Disk
because of flattening that occurs do to scaling, as discussed in this question. So any solution that needs to replace Point
with Disk
would preferably have a way of resolving the flattening issue, as well.
Thank you!
AspectRatio ->1
but that would distort the axis scales, which is probably not something you want... $\endgroup$