Alain Baeckeroot wrote:
> Le 23/07/2009 à 17:27, Hazen Babcock a écrit :
>> Alain Baeckeroot wrote:
>>> Dear all
>>>
>>> i 'd like to create my function for drawing the legend of graph,
>>> i want to modify line width for the legend, and font color and reset
>>>  to previous value before exiting the legend function. so i need to know
>>>  current line width, line color
>>>
>>> I found no function that gives me this informations (no plg...)
>>> Am i wrong ? 
>>> how could i get this information ?
>> I believe you are correct. Could you describe the problem that you are 
>> facing a little more? In PLplot the defaults are just whatever they were 
>> last set to. I think that they start at plwid(1) with plcol0(0) as the 
>> background color and plcol0(1) as the foreground color.
>>
>> -Hazen
>>
> 
> I plot on the same graph Text and Tint, from octave :
> 
>       ... various settings including naming colors (blue = 9, green = 3)
> 
>       #TExt
>       plcol0(blue);
>       plwid (width);
>       plline(x, temper(:,text)); 
>       legende(1, "T Ext", xmin, xmax, ymin, ymax);
> 
>       #Tint
>       plcol0(green);
>       plwid (width); # needed to set width again <-----------------------
>       plline(x, temper(:,tint));
>       legende(2, "T Int", xmin, xmax, ymin, ymax);
> 
> 
> 
> function legende ( num, text, xmin, xmax, ymin, ymax )
>       ## draw legend on top left of the graph.
>       ##    (or top right if xmin > xmax ....)
>       ##
>       dx = (xmax - xmin) / 20.;
>       dy = (ymax - ymin) / 20.;
> 
>       x(1) = xmin + dx;
>       x(2) = x(1) + 2 * dx;
>       xt = x(2) + dx;
> 
>       y(1) = ymax - num * dy;
>       y(2) = y(1);
>       yt = y(1);
> 
>       plwid ( 6 );
>       plline (x', y');
>       palette; # colormap with names for each color
>       plcol0(grey); # text is written in grey
>       plptex ( xt, yt, 0, 0, 0, text);
> 
> endfunction
> 
> 
> 
> 
> As i set width in legend, i need to set it again in the main loop.
> Also i need to pass (xmin xmax ymin ymax) as i dont know how
> to just say draw at x = 10% of window ....
> 
> ideally i would like to have just :
>    legend (num, text)  
> and all other informations from some plgxyz inside legend function.
> 
> I hope my explainations are clear enought this time :)

I think you should be able to get xmin, xmax, ymin and ymax using the 
function plgvpw().

At present the only way I can see to handle the width issue is to write 
a wrapper function for plwid() that saves the previous pen width so you 
can revert the width as necessary.

-Hazen



------------------------------------------------------------------------------
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to