On Mon, Sep 27, 2010 at 8:50 PM, Alan W. Irwin
> Hi Andrew:
> On 2010-09-27 20:36+0100 Andrew Ross wrote:
>> I've had a quick look at this [pllegend API]. It is something I've desired for a while
>> so it is great to see it! A few random thoughts.
>> 1) This is great for non-interactive uses. For interactive use you may
>> not know in advance how many legend entries there are. It would be nice
>> to add entries as you go along. This is a lot more complicated, and
>> may well not be worth the effort. It doesn't fit with the plplot
>> design very neatly. How does plplot cope with multiple calls to
>> pllegend if you update the legend as you go?
> I think interactive use like you describe would be mostly fine. For
> solid backgrounds, you could just increment nlegend and fill in data
> for the last index to (re-)produce the legend enlarged by one legend
> line each time. For no background, you could turn off all legends for
> any legend index by setting opt_array to zero for that index. For
> later calls, you could do that for all prior indices, increment
> nlegend, and fill in data for the last index to produce just one
> legend line in the correct place per call to pllegend. Transparent
> backgrounds, however, would be problematic for repeated interactive
I agree with Alan's summary here. One (very post-release!)
possibility would be to add support for multiple plot layers to
PLplot. For example, x04c.c may have 3 layers:
(1) The plot content inside the viewport
(2) Axes and labels
(3) The legend
This could be a handy way to improve interactive plotting as it would
allow PLplot to prevent the plot contents from obscuring axes,
legends, etc. with minimal user intervention. This would be
relatively straightforward with Cairo and I imagine with Qt as well.
>> 2) A different, but related, issue is colourbars for colour contour
>> plots. Support for this would also be good.
> I think a separate plcolorbar API for that capability should be worked
> on post-release.
I'm not sure I'm following this portion of the API correctly - does
pllegend support some of this already? It looks like cmap0_colors,
cmap1_colors, cmap_patterns and cmap_scales are meant to support
something along these lines. If that is the case, then I still think
that these would fit better in the plcolorbar API.
Or, as I'm starting to suspect, if provided, would each entry draw a
single block of a given color + pattern? If this is the case then I
think keeping this in pllegend seems reasonable. It would be nice to
have these options used in an example.
>> 3) I'm not quite sure from the examples or what you have said whether
>> a legend outside the plot is possible, but I certainly think it
>> should be.
> Yes, that capability is available now. In fact, the legend x,y
> position and plot_width are now expressed in normalized sub-page
> coordinates rather than normalized viewport coordinates as before.
Sounds good to me!
>> Overall I think the current API is probably fit for most uses.
> Thanks for your review.
While I agree with this, I do think it is worth leaving the pllegend
API flexible through the post-5.9.7 development cycle. I like the API
overall, but given how high-level this function is compared to most of
PLplot's C API I think extra time to try out pllegend before
committing to the current API would be useful.
I will try to get the OCaml pllegend binding working before the 5.9.7
release for testing. I would rather have to change the binding than
realize a month later that we are missing some key functionality (like
the missing rotation support in plarc!).