On 2010-11-04 11:10-0000 Andrew Ross wrote:

> Gnuplot also use a similar generic positioning for legends (i.e. top left)
> which works well in my experience. They also provide for fine-grained
> positioning by setting the coordinates of the legend (in plot coordinates).
> I think this approach works well. 95% of the time the general approach is
> sufficient, and means things work even if the axes etc change, however
> I do find the fine-grained control necessary on occasions to minimise
> interference between the plot and the legend. I agree with Alan, that
> fixed positions for the custom origin are better. You can argue whether
> you want them in relative coordinates (i.e. 0-1) or in the current
> axis coordinates. Probably relative I think, although there are arguments
> each way.

Hi Andrew:

Thanks for your input. I have been in touch with Hez off list about
another better idea I had, and with one further change we have come to
consensus on that idea which is similar to what you have stated above.
Here are the details of that idea.

Define

PL_LEGEND_TOP
PL_LEGEND_BOTTOM
PL_LEGEND_LEFT
PL_LEGEND_RIGHT
PL_LEGEND_OUTSIDE
PL_LEGEND_INSIDE

where LEFT alone means middle LEFT, TOP alone means middle TOP, etc.
The corners would be specified by the appropriate combination (e.g.,
LEFT and TOP) of two of the bits.  So with various combinations of
these bits we can specify any one of the 4 corners or 4 middle
positions of each side of the viewport as the zero point of the
coordinate system regardless of the value of OUTSIDE or INSIDE.  The
interpretation of TOP, BOTTOM, LEFT, or RIGHT depends on INSIDE or
OUTSIDE when simultanously specifying the reference point of the
legend using the above bits.  For example, for LEFT, TOP, INSIDE the
zero point would be the left top of the viewport and the reference
point would be the left top of the legend.  The OUTSIDE flag gives 8
more possibilities for the reference point on the opposite side of the
legend for a total of 16 standard positions.  For example, for LEFT,
TOP, OUTSIDE the zero point would be the left top of the viewport (as
for the INSIDE case) and the reference point would be the bottom right
of the legend. Each of these 16 standard positions for the legend
could be customized by specifying x and y offset values (both positive
and negative), but often you would just take zero for both x and y to
conform to one of the standard 16 positions.  Of course, illegal
combinations of bits (e.g., PL_LEGEND_OUTSIDE and PL_LEGEND_INSIDE or
PL_LEGEND_LEFT and PL_LEGEND_RIGHT) will generate a warning and
immediate return from pllegend.

I hope to start implementing this positioning scheme for pllegend
later today, and Hez plans to also use this positioning scheme for
plcolorbar (in a couple of weeks once he has time to deal with that).

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to