Boost logo

Boost :

From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2007-06-13 12:34:17

> For those who have put time or energy into making suggestions for the
> SVG_Plot program, an update (with pretty pictures!) is on the wiki:
> Feedback / use cases welcome ;).

 From your example on the wiki:

svg_plot my_plot("./image.svg");

my_plot << image_size(500, 200) << x_scale(-7, 9) << draw_axis()
         << plot_range(data1.begin(), data1.end(), blue)
         << plot_range(data2.begin(), data2.end(), green)
         << write();

I would suggest:

svg_plot my_plot;
my_plot.plot(data1, blue);

- I don't think that operator overloading of << adds enough to be justified.
- Large numbers of constructor parameters are confusing unless you use
named parameters, which are themselves sufficiently unusual that they
are non-intuitive. I suggest avoiding constructor parameters when
possible and using e.g. set_* methods instead.
- Make it possible to plot an entire container more simply than
specifying both begin and end iterators.

If you feel the need to make the style more compact, it should be
possible to return a reference to the plot and chain methods like this:

        .plot(data1, blue)

- though I haven't tried to do this recently, so maybe I have forgotten
some detail.

You might like to look at how GIL specifies colours, to see if there is
anything that you can re-use. At least, you should make sure that you
don't implement something that is similar-but-not-quite-the-same for
colour names.

The results look great, by the way. I was doing something with Gnuplot
the other night that would have benefited from something like this:

I think that a simple wrapper program around your library that can read
and plot CSV files would be most useful.



Boost list run by bdawes at, gregod at, cpdaniel at, john at