View unanswered posts | View active topics It is currently Thu Mar 28, 2024 8:04 pm



Reply to topic  [ 5 posts ] 
Scatter plots - the suggestions 
Author Message
Regular pChart user
Regular pChart user

Joined: Sat Jan 08, 2011 10:37 pm
Posts: 9
Post Scatter plots - the suggestions
Ok, continuing from viewtopic.php?f=1&t=64 :

I've done a few experiments with the scatter plot in 1.27, which does seem to fit my data pretty well, at least in theory. The 1.27 scatter plots are the only ones I've used, and I will base my suggestions on my experiments with them.

My data is very sparse. It has minute resolution, and span at least 24 hours, up to one week; that's between 1440 and 10080 points, of which the count of actual values are in the tens or so. The rest is VOID.

If you use a line chart, a data set of

25 => 3,
1087 => 5,
9967 => 2

would have to be expanded to

<24 x VOID>,
25 => 3,
<1061 x VOID>,
1087 => 5,
<8879 x VOID>,
9967 => 2,
<112 x VOID>

to cover all 10080 points for one week. That takes time to fill and draw. With a scatter plot, one could simply feed the minutes into the X axis, and the values into the Y axis, have three data points drawn, and be done with it.

I ran into a few limitations with the 1.27 version, and thought I'd share a few thoughts on how it could be expanded. My apologies if any of these points already have been taken care of or already is planned:

1) setFixedScale() is nice. It allows me to, for example, set the X scale to 0-1440, allowing for exactly 24 hours of data to be shown. If I set the X scale to 0-24 and divide the minutes by 24, I automatically get labels for 0-24, still with minute resolution when plotting.

This lead to the first suggestion: Formatting support for the labels. Hours ranging from 00 to 24, with %02d, would look better.

If I wanted to show a whole week in this way, I'd get an X axis ranging from 0 to 168. Modulo 24 would be useful here, giving labels ranging from 00-23, repeating seven times.

2) The line plot supports an array containing axis labels. If the scatter plot supported the same mechanism, point 1 above would probably become irrelevant, as one could pre-compute all the labels before drawing the chart.

Provided, of course, that the label array could be "scatter plotted", much in the same way a scatter plot works.

array(0 => "00\nDay 1", 60 => "01", 120 => "02", 180 => "03", 240 => "04", ...)

could create an X axis with minute resolution and one label every hour.

3) I thought I had more suggestions... Oh well, it would be nice if it supported lines, splines, dots and all that, too, obviously.


Mon Jan 17, 2011 10:22 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Scatter plots - the suggestions
I've started the implementation of the pScatter class extension last night. The scaling engine has been adapted to allow total manual customization if required. Plot, Line & Curve charts are already supported. (The curve one was really fun as it required some tunning of the spline function to allow parametric force vectors)

I've followed your suggestions, only issue : the labels array (I'm not sure to see clearly how to implement it)

JD.


Attachments:
example.drawScatterSplineChart.png
example.drawScatterSplineChart.png [ 19.75 KiB | Viewed 8666 times ]
example.drawScatterScale.manual.png
example.drawScatterScale.manual.png [ 11.66 KiB | Viewed 8666 times ]
example.drawScatterPlotChart.png
example.drawScatterPlotChart.png [ 21.43 KiB | Viewed 8666 times ]
example.drawScatterLineChart.png
example.drawScatterLineChart.png [ 22.88 KiB | Viewed 8666 times ]
Wed Jan 19, 2011 3:16 pm
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Scatter plots - the suggestions
I've extended the pData structure to provide a clean and unified way to feed the data.

I've added the legend, style & linear regression functions to the scatter class.


Attachments:
example_drawScatterSplineChart.png
example_drawScatterSplineChart.png [ 27.46 KiB | Viewed 8653 times ]
example_drawScatterBestFit.png
example_drawScatterBestFit.png [ 33.15 KiB | Viewed 8653 times ]
Thu Jan 20, 2011 9:05 pm
Profile WWW
Regular pChart user
Regular pChart user

Joined: Sat Jan 08, 2011 10:37 pm
Posts: 9
Post Re: Scatter plots - the suggestions
Ooo, this sounds exciting! My apologies for not checking in on this for a few days.

I'll definitely try these things out. About the axis labels; it would be convenient to have, but not a must.

I'm guessing that a plot with an axis from 0 to 8, where you want a label at 1, 2, 3, 5 and 8, but none at 4, 6 or 7, would have to look something like this:

array("", "1", "2", "3", "", "5", "", "", "8")

Is that correct?


Sat Jan 22, 2011 9:35 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Scatter plots - the suggestions
I didn't found the time to find a suitable solution to have static labels on dynamic scales.

Scatter charts have been added in the 2.1.0 that you can get from here : download.

Kind regards,
JD.


Wed Jan 26, 2011 3:04 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron