On 2010-11-04 13:22-0700 Alan W. Irwin wrote: > 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. >
This has now (revision 11309) been implemented (with PL_LEGEND_TOP and PL_LEGEND_BOTTOM renamed to PL_LEGEND_UPPER and PL_LEGEND_LOWER) in the static legend_position routine which should be reusable for plcolorbar when Hez implements that. The logic in that routine includes calculation of the sign of the x, y offsets depending on the PL_LEGEND position bits that have been set. I have tested all 16 standard positions, but I have only done limited testing of the sign logic. I have also changed the interpretation of x, y, and plot_width from normalized subpage coordinates to normalized viewport coordinates. I have also done a whole lot of renaming of variables to make them correspond more closely to their units (normally relative subpage units). My remaining pllegend ToDo: 1. Implement plstring and also use it internally in pllegend rather than the legacy plsym. 2. Documentation (doxygen and docbook) of pllegend To finish off our legend-related work three additional projects have to be completed. 1. plcolorbar (Hez). 2. String-length calculations done properly for the qt device driver similar to the way they have been done for the cairo device driver (Hazen). 3. Propagation of plcolorbar, pllegend, and plstring to all our languages (everybody). Once all of this is done, I think we will have some pretty awesome (legendary?) legend capability. 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