[Scilab-users] About legend instruction in graphics -
Perrichon
perrichon.pierre at wanadoo.fr
Fri Jan 10 12:30:13 CET 2020
Hello,
Samuels « legends_mc » is a very nice instruction.
It does exactly what I wanted
xLeg=0.;
yLeg=1.04;
Xlegend=["CVitesse";"Vitesse";"Vannage";"Débit";"Chute";"Puissance"]
legends_mc(Xlegend, Lpc=-10, framed?=%f, pos=[xLeg yLeg])
Other case
Xlegend=["Cons.Vitesse";'Vitesse filtrée';"Dérivée";"Intégrale";"Lim.
Ouverture";"Cons. Vannage CVA";"Cons. charge CC"]
legends_mc(Xlegend, Lpc=2, framed?=%f, pos=[xLeg yLeg])
:
Best regard
Pierre P.
De : users <users-bounces at lists.scilab.org> De la part de Samuel Gougeon
Envoyé : mercredi 8 janvier 2020 20:13
À : users at lists.scilab.org
Objet : Re: [Scilab-users] About legend instruction in graphics
Hello,
Le 08/01/2020 à 19:30, Perrichon a écrit :
Hello,
When drawing scope X(t) with multiple chanels, is there a way to get a
horizontal legend to maximalize the graphic area (as matlab does)
All proposal for the legend positionning reduce the graphic area (vertical
display with box or no box)
1. Legend are into the graphic. Some curves are not visible
2. Legend are out of graphic, but reduces the graphic area.
Best Regards
Pierre P.
legend_mc() aims to do that:
https://fileexchange.scilab.org/toolboxes/274000
--> legends_mc
function [] = legends_mc(Texts,Styles,Lpc,font_size,thickness,pos,framed?)
For many curves & related legends, displays a multicolumn bloc of legends:
- The shape of the bloc can be specified (Lpc)
- Positionning with Logarithmic or/and reversed axes is supported
- Lines styles and Markers styles are supported and can be mixed.
A set of polyline handles or having polyline children can be
alternatively provided
- Lines thickness(es) can be specified (ignored if handles are
given: read out from the polylines properties)
HELP: run legends_mc() without any parameter
DEMO: run legends_mc(..) without specifying Texts
Texts : vector of legends
Styles : a) vector of related lines or markers styles (integer indices)
Styles(i)>0 -> line color (only solid style supported)
-14<= Styles(i) <=0 -> marker (overlay with line unsupported)
b) (2,n) matrix:
Styles(1,:) = as in a)
Styles(2,:) = line style, or color of marker
c) vector of graphical handles. Then all Polyline children
are searched (in chronological order of creation).
Texts must have as many entries as there are available
polylines.
If only 1 handle is given and is an axes, the legends is
set in this axes. When returning, the focus is restored
to the axes priorly active.
If a set of handles or an handle not being an axes is given,
the legends are set in the currently active axes.
Default Styles : gca()
Lpc>0 : (maximal) number of Lines Per Column (integer)
Lpc<0 : -(maximal) number of Columns per line (integer)
framed? : boolean: if %T, draws the global box of legends (default)
pos : position of the block:
"ur" | 1 : in the upper right corner (default)
"ul" | 2 : in the upper left corner
"ll" | 3 : in the lower left corner
"lr" | 4 : in the lower right corner
"?" | 5 : interactive positionning with the mouse
[xr,yr]: relative coordinates 0 <= xr,yr <= 1 of the upper left
corner of the block, with respect to the upper left corner
of the data bounds area. [0,0] is equivalent to "ul"
thickness: scalar or vector of lines thickness.
If a vector is provided, its length must = Styles one.
If styles are from handles, thickness vector is ignored.
DEMOS: run legends_mc(..) without Texts of legends:
clf, legends_mc( framed?=%f )
clf, legends_mc( Lpc=7, pos="?" )
clf, legends_mc( Lpc=-3, pos="lr" )
clf, legends_mc( Lpc=-2, pos=[0.15 0.3] )
clf, legends_mc( font_size=2, pos="ll" )
clf, legends_mc( pos="?", thickness=2 )
clf, legends_mc( pos="lr", thickness=1+round(rand(1:19)) )
clf, plot2d(), legends_mc( Lpc=-3, pos="ll" )
clf, plot(), f=gcf(); legends_mc(Styles=f.children($), pos="?")
EXAMPLE:
clf, plot2d(), legends_mc("line #"+string(1:3), Lpc=-3, pos="?" )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200110/c41ce0c3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 7872 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20200110/c41ce0c3/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 8905 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20200110/c41ce0c3/attachment-0001.jpg>
More information about the users
mailing list