From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-03-16 05:23:03
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Johannes Laudenberg
>Sent: 15 March 2007 22:01
>Subject: [boost] [SoC] SVG-graph-plotting questions
>I would really like to come up with a SoC-application for the
>graph-plotting-thing. However there are some questions that came to my
>(1) It is mentioned, that data inside a container should be
>plotted as a
>function graph. Is this data arbitrarily collected or does it
>popped out of a math-function? The latter would make it way easier to
>interpolate a smooth function from the data (by passing the
>function as a whole or at least the first derivatives of the data).
I see a need for at least:
1 Plotting actual data points with markers like + * etc. 'Arbitrary'
2 Plotting straight lines - eg the least squares line to fit the above.
3 Plotting very well-behaved math functions - curves showing slightly non-linear fits.
4 Plotting a little less well-behaved curves like sin and cos plots. SVG polyline should be enough here.
5 Plotting badly behaved functions that whizz off to infinity and back.
This suggests that BOTH collections of arbitrary data values AND at least well-behaved math functions are needed.
And of course one would want to plot several of these on the same graph, with colors, (sin in red and cos in green) legends, labels
to reduce the confusion.
>(2) Are there suggestions about the context this should be
> Should it go into a specific boost-lib?
I would expect it can be used via a simple include, something like
Of course, it could also be packaged as a library but these have proved more problematic to be portable, and less popular, so keep
> Should it be a single function
>that takes loads of parameters (like color, range, size, ...).
> Should it
>be a class where the user would set these parameters as attributes?
Well I think an interesting part of the project is to explore which of these, or some combination, is most convenient.
Boosters will undoubtedly have some (many?) opinions on this ;-))
I'm sure a single function would have far too many parameters, but one could have several functions. But this being a C++ project,
classes will probably be de rigeur ;-)
>(3) It is said, that the data comes from some stl-containers.
>Just to be
>sure: You mean 2 dimensional containers for plotting a 2d function?
Well yes, and no ;-)
If the values are equi-spaced, then a vector, say, of values AND start, finish and spacing and/or count will do. Otherwise you'll
need to deal with containers of x,y pairs. Providing a variety of these to meet users individual demands may be the challenging
95% of data applications will be a vector full of equally spaced doubles, and a straight line or quadratic 'through' them. Of
course, you'll want to use iterators and/or counts of number of points to allow users more control.
Auto axis scaling, labelling and marking would be a popular option.
Others will want to just pass a math function and get a plot. My instinct is to make this a 'phase 2' because you can quite easily,
if less slickly, achieve this with point plotting.
A major problem with short projects has proved to be biting off more than you can chew. So making sure that the project results in
achieving at least this would be good.
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk