I'm using the squared plot and have many times more data points than the X-axis has pixels. Does every data point (which will be squared rectangles because of the plot style) get plotted? What if it overlays a previously plotted point? Does a smaller Y value point immediately after (so close in X that the effective X pixel is the same) a larger value erase part or all of the larger rectangle? Hope this makes sense, it's a bit hard to explain.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Every data point gets plotted, in the order they appear in the data array. Exactly as you said: because the plotting is on an integer grid, not every point can have a unique X value in the image.
PHPlot converts each pair of (Xw,Yw) world coordinates into device coordinates (X,Y). For the 'squared' plot type, it draws 2 lines: the horizontal segment from (Xp,Yp) to (X,Yp), and then the vertical segment from (X,Yp) to (X,Y), where (Xp,Yp) is the previous point.
Since there are more data points than X pixels, in some cases X==Xp, meaning - as you said - the effective X pixel coordinate is the same. So the horizontal segment collapses to a single point, and the vertical line segments from adjacent data points overlay. What you should get at that X position is a vertical line from min(Yi) to max(Yi), for all data points 'i' that end up with the same X pixel coordinate.
Well, anyway, that's what I think it does. It's hard to see that, even with my screen magnifier and some contrived examples, as it gets very crowded.
Does that help? (By the way, there are no rectangles here - just squared off lines. I hope we are talking about the same plot type.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes that helps. You understood the question perfectly. If it does what you suggested, I'm a happy camper, or should that be happy plotter.
I understand your clarification about two line segments being plotted versus the rectangle that I suggested. You are correct of course. There is a minor drawing issue with the corner formed by these two segments as you probably know. If the lines have widths of 2 or more, the corners look stepped rather than squared. It's really minor, but being a bit picky.... Cheers and thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a minor drawing issue with the corner formed by these two
segments as you probably know. If the lines have widths of 2 or more, the
corners look stepped rather than squared.
No actually I didn't know. Thanks for pointing that out... I see what's going on, and I don't like it. There is no control on the line caps or line join shapes. When line widths are > 1, the horizontal and vertical lines used in a Squared plot are drawn by the PHP GD extension using filled rectangles of that width (or height). The short end of the rectangle is centered at the (X,Y) point. So at every corner of the Squared plot, you get these 2 rectangles meeting, with a missing corner, as shown in the upper left here:
It probably could be worked around in PHPlot by adjusting either X (for the horizontal segment) or Y (for the vertical segment) by 1/2 the width, but I don't like the idea much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using the squared plot and have many times more data points than the X-axis has pixels. Does every data point (which will be squared rectangles because of the plot style) get plotted? What if it overlays a previously plotted point? Does a smaller Y value point immediately after (so close in X that the effective X pixel is the same) a larger value erase part or all of the larger rectangle? Hope this makes sense, it's a bit hard to explain.
Every data point gets plotted, in the order they appear in the data array. Exactly as you said: because the plotting is on an integer grid, not every point can have a unique X value in the image.
PHPlot converts each pair of (Xw,Yw) world coordinates into device coordinates (X,Y). For the 'squared' plot type, it draws 2 lines: the horizontal segment from (Xp,Yp) to (X,Yp), and then the vertical segment from (X,Yp) to (X,Y), where (Xp,Yp) is the previous point.
Since there are more data points than X pixels, in some cases X==Xp, meaning - as you said - the effective X pixel coordinate is the same. So the horizontal segment collapses to a single point, and the vertical line segments from adjacent data points overlay. What you should get at that X position is a vertical line from min(Yi) to max(Yi), for all data points 'i' that end up with the same X pixel coordinate.
Well, anyway, that's what I think it does. It's hard to see that, even with my screen magnifier and some contrived examples, as it gets very crowded.
Does that help? (By the way, there are no rectangles here - just squared off lines. I hope we are talking about the same plot type.)
Yes that helps. You understood the question perfectly. If it does what you suggested, I'm a happy camper, or should that be happy plotter.
I understand your clarification about two line segments being plotted versus the rectangle that I suggested. You are correct of course. There is a minor drawing issue with the corner formed by these two segments as you probably know. If the lines have widths of 2 or more, the corners look stepped rather than squared. It's really minor, but being a bit picky.... Cheers and thanks for your help.
No actually I didn't know. Thanks for pointing that out... I see what's going on, and I don't like it. There is no control on the line caps or line join shapes. When line widths are > 1, the horizontal and vertical lines used in a Squared plot are drawn by the PHP GD extension using filled rectangles of that width (or height). The short end of the rectangle is centered at the (X,Y) point. So at every corner of the Squared plot, you get these 2 rectangles meeting, with a missing corner, as shown in the upper left here:

It probably could be worked around in PHPlot by adjusting either X (for the horizontal segment) or Y (for the vertical segment) by 1/2 the width, but I don't like the idea much.