[Scilab-users] Plot2d and legends

classic Classic list List threaded Threaded
2 messages Options
James Holland James Holland
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Plot2d and legends

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");
xgrid;
</code>



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: Plot2d and legends

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.

--
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

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users