Boost logo

Boost :

From: Jake Voytko (jakevoytko_at_[hidden])
Date: 2007-07-04 13:17:32


On 7/4/07, Matias Capeletto <matias.capeletto_at_[hidden]> wrote:
>
> On 7/4/07, Giovanni Piero Deretta <gpderetta_at_[hidden]> wrote:
> > On 7/4/07, Jake Voytko <jakevoytko_at_[hidden]> wrote:
> > > On 7/4/07, Phil Endecott <spam_from_boost_dev_at_[hidden]> wrote:
> > > >
> > > > Jake Voytko wrote:
> > > > > plot_range(my_plot, data.begin(), data.end(),
> > > > > default_functor, human_age,
> > > > > circle,
> > > > > orange, red,
> > > > > 3, 10);
> > > >
> > > > It would be great to be able to write just 'data' in place of
> > > > 'data.begin(), data.end()'. Is there anything stopping this?
> > >
> > > The STL algorithm functions are used as the basis here, and it carries
> all
> > > of the same benefits. First, you can select a small subset of your
> data if
> > > you'd like that to be plotted (for example, plotting a single year out
> of
> > > 100 years of data).
> >
> > You can do the same with a range based interface, you just need to
> > pass to boost::make_iterator_range() the iterators defining your
> > subrange.
> > Most of the time you might want to plot a whole container, so the range
> based
> > algorithm is easier to use. Not considering that you can chain the
> > result of lazy
> > algorithms:
> >
> > plot_range(my_plot, filtered(data, point_selector));
>
> +1 for range based plot
>
> "I want it to do this" example:
> ----------------------------------------------------------------
> boost::bimap<float,float> bm;
> assign::insert(bm) (1,123) (2,345) (3,184) (4, 256) (5, 241);
> plot_range(my_plot, bm.left.range( 2 <= _key, _key < 5 ) );
> ----------------------------------------------------------------

I was not aware of the existence of Boost.Range, and it looks like it's a
very nice library. I'll have to explore its use a little further

So now I have the interface for plot_range() narrowed to

  plot(my_plot, my_container, title, ...);
and
  plot_range(my_plot, my_range, title, ...);

but now I'm back in the same boat I was in the beginning of the thread.. how
to display the rest of the data. There are 3 more areas of concern for the
interface of the plot functions:
* conversion functors for arguments 1 and 2 of a pair< , >
* color / style information for each individual point (circle/square, stroke
color, fill color, size)
* color / style information for all lines between each point (show at all?,
interpolated curve?, stroke color, fill color, stroke width, dotted?)

Even if I refactor each of those into their related categories, there are 8
possible combinations of needing/not needing them. The simple case now looks
simple, but I'm not any further on the complex cases.

To me, this looks like a job for Boost.Parameter :)

Jake


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk