[scilab-Users] plotting marks different colors
Mathieu Dubois
mathieu.dubois at limsi.fr
Mon Feb 1 15:02:59 CET 2010
Hello Maso,
To answer your question I will explain a bit of how Scilab plots objects
(at least of how I understand that :). Sorry if you already know that.
Each time you call plot2d Scilab create a "Compound" object in your plot
(take a look at the Figure Editor : in your graphic window click on
"Edit" and then "Figure Editor"). The "Compound" object contains a
"Polyline" object which is your point (it can represents a full line).
This objects has a lot of properties.
To change the properties the style of each point you can use something like:
for i=1:matrixlength
x=matrix(1,i)
y=matrix(2,i)
class=matrix(3,i)
plot2d(x , y)
e=gce(); // Get a handle on the last Compound object
point=e.children(1); // Get a handle on the polyline
point.mark_mode="on"; // Turn on mark mode (i.e. each point is
represented by a small symbol)
point.mark_style=i; // Each marker is an integer (see help
polyline_properties for a list)
end
Once you have the handle you can change almost anything you want.
You may have problems with the auto scaling of the axes (see attachment
for how to set this).
One more thing: plot2d may not be the right function for you. There may
be a simpler function to draw just a point...
Hope that helps,
Mathieu
Maso Ricci wrote:
> Mathieu,
>
> thanks for your reply. I wasn't so clear. I understand.
>
> I have a dataset resulting from a cluster analysis procedure.
>
> so the resultig matrix is like :
>
> X Y Class
> 0.8 0.1 1
> 0.1 0.7 2
>
> ...
>
> where the X and the Y are the data parameters and the class is the
> class where the script allocates a datapoint.
>
> I plotted the entire matrix extracting one row at time. In this way I
> have the chance to declare the variable mystyle which controls the
> mark style.
> Something like:
>
> for i=1:matrixlength
>
> x= matrix(1,i)
> y=matrix(2,i)
> class=matrix(3,i)
>
> mystyle=class
>
> plot2d(x , y , style=-mystyle)
>
> end
>
> Unfortunately the standard styles are quite similar each other so I
> wonder I could modify the mark (size and color) at each loop
>
> thanks
>
> /maso
>
>
>
>
> Il 01/02/2010 9.12, Mathieu Dubois ha scritto:
>> Hello Maso,
>>
>> What would you like to do exactly?
>>
>> Do you want to plot the columns/rows of the matrix as independent curves
>> (like plot2d does)?
>> Or do you want to display each element of the matrix as a 2D surface
>> (like Matplot1)?
>>
>> Mathieu
>>
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_maso.sce
URL: <https://lists.scilab.org/pipermail/users/attachments/20100201/17c55530/attachment.ksh>
More information about the users
mailing list