[Scilab-users] Plot2d and legends

Stéphane Mottelet stephane.mottelet at utc.fr
Tue May 22 12:44:01 CEST 2018


Hello,

Le 22/05/2018 à 12:28, James Holland a écrit :
> I am plotting three columns of data using plot2d and I'm adding a legend box
> using legends. I have declared the line colours for each plot to make the
> graph easier to view. The problem that I have is that the legends box shows
> all three of the lines in the same colour (blue). Is this an issue with the
> way my code is written?
> TIA James
>
> <code>
> // plot data
>
> // the third column: -->m(:,3)
> x1 = M1(:,1);   // frequency
> y1 = M1(:,2);   // M1 Average
> y2 = M2(:,2);   // M2 Average
> x2 = M3(:,1);   // Limits frequency
> y3 = M3(:,2);   // Limits - average
>
>
> plot2d(x1, y1, style= color('orange'), logflag = "ln");
> plot2d(x1, y2, style= color('blue'), logflag = "ln");
> plot2d(x2, y3, style= color('red'), logflag = "ln");
> f = gca();                     // get the current axes
> bg_color = color('lightgray');
> f.background= bg_color;        //RGB
> xtitle("EN55022 Conducted Emissions", "Frequency (MHz)", "dBuV");
> legends(['uA7805';'7805SR'; 'EN55022B'],[2,2,2],opt="ur");

here [2 2 2] overwrites the colors you specified in the plot2d calls. I 
would suggest:

legend('uA7805','7805SR','EN55022B','in_upper_right')

S.
> xgrid;
> </code>
>
>
>
> --
> Sent from: https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users


-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet




More information about the users mailing list