octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Matlab compatible legends for FLTK/Gnuplot backends?


From: Shai Ayal
Subject: Re: Matlab compatible legends for FLTK/Gnuplot backends?
Date: Wed, 1 Sep 2010 22:20:21 +0300

On Wed, Sep 1, 2010 at 10:14 PM, David Bateman <address@hidden> wrote:
>
> As it seems to me that the blocking feature for 3.4.0 is the support of 
> legends in FLTK, I've been looking at writing a matlab compatiable, or at 
> least more compatible than currently, legend function. I however want this 
> function to not be specific to a backend and I want it to work with both FLTK 
> and the gnuplot backend and be implemented entirely as a frontend function. 
> I'm however blocked in that goal when calculating the extents of the text 
> strings.
>
> How I'm trying to implement this function is to create an axis object, with 
> the "tag" property set to "legend" and the userdata with a structure with a 
> field pointing to the axis the legend is attached to. The position, limits, 
> etc of the legend axis are initially arbitrary and into this axis I write all 
> of the text strings. The object of doing this is to calculate the extent of 
> each of the text strings so that I can then select an optimal positioning of 
> the keys in the legend, and only after that resize the axis, position it and 
> write the symbols. The get_extents method of the graphics.cc(text) class 
> fills in the "extents" property of the text objects. However, it relies on 
> having both FreeType and font_config installed. I'd rather not add new 
> dependency for the gnuplot backend and in any case why should I assume that 
> FreeType will give extents that are compatible with gnuplot. So from here I 
> see I have one of four choices
>
> 1) Accept the FreeType and font_config dependencies, making these essential 
> for any plotting with legends in Octave. However, this might not be ideal for 
> the gnuplot backend,
>
> 2) Try and find another means of implementing the get_extents method of the 
> the graphics.cc(text) class that will be used if FreeType isn't installed (or 
> for backends that don't use FreeType), but this is likely to be approximative
>
> 3) Give up on trying to have a legend function that is implemented entirely 
> in the frontend and  continue to use gnuplot itself for the legend insertion 
> for the gnuplot backend. I'd probably implement the missing horizontal legend 
> orientation in gnuplot and make the gnuplot legend more compatible with 
> matlab in this case.
>
> 4) Get someone on this list to tell me I'm a bloody idiot and there is 
> another means of getting the text extents that will be correct (at least 
> approximately) for all backends.
>
> I'm kind of hoping for 4), but failing that help in choosing which of the 
> other three options would be appreciated
>
I'm not the one which will tell you #4. Text extents are highly
dependent on the text rendering technique, and unless gnuplot has some
way of conveying its text extents back to octave (which I doubt --
gnuplot is designed to be standalone, not a backend), you have no way
of knowing.
I have no strong opinion on the other 3 choices.

Shai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]