1
$\begingroup$

I have some 2D point data of the form {a/b, c}, with all variables being integers. (Originally, it was in the form of multiple 1D point data sets of the form {a, b}; I added the c to help me see the patterns within.)

In ListPlot, using PlotStyle -> PointSize[Tiny] apparently makes points take up a single pixel, which is helpful for looking at finer structures. (There's probably a better way by using AbsolutePointSize instead, but I'm not yet sure what that would be.) Furthermore, ListPlot seems to force said points to fall exactly on single pixels, rather than straddling two or more of them. This frequently creates the situation where data points spaced equally in the x- or y-directions are separated by unequal numbers of pixels, which is usually caused by the total number of pixels, minus one, not being evenly divisible by the number of equally-spaced data points, minus one.

While the PixelConstrained option in ArrayPlot would solve this, the fact that it constrains both dimensions introduces a fundamental flaw with this approach: the data is not discrete in one of its dimensions, and making it so would require more pixels to display it than the universe has atoms. (I am only looking to constrain the y-axis in this case; the x-axis should be free to remain as it is.) Is there any other way to control for this besides manually altering the size of the plot area?

For instance, ListPlot[Tuples[Range[0, 100], 2], PlotStyle -> PointSize[Tiny], AspectRatio -> 1] yields:

unequal

Not only are the points not equally spaced, the x- and y-spacings themselves are different from each other!

$\endgroup$
  • 1
    $\begingroup$ An example would be very helpful $\endgroup$ – Carl Woll Jun 8 '18 at 20:51
  • $\begingroup$ @CarlWoll Done. (I never know how much detail to add, as having too little detail prevents understanding, whereas having too much detail also includes some irrelevant, repetitive, and/or already known information.) $\endgroup$ – 404UserNotFound Jun 8 '18 at 21:27
  • $\begingroup$ I don't have an answer, but I think the reason for the difference in the x and y axes is due to the different PlotRangePadding settings between the two. $\endgroup$ – Carl Woll Jun 8 '18 at 21:55
  • $\begingroup$ Inevitable xkcd reference: xkcd.com/1814 $\endgroup$ – MarcoB Jun 9 '18 at 3:21

Your Answer

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

Browse other questions tagged or ask your own question.