[prev in list] [next in list] [prev in thread] [next in thread]
List: scilab-users
Subject: Re: [Scilab-users] ?==?utf-8?q? Scilab checkerboard plot (grayplot)
From: Ekin Akoglu <ekinakoglu () gmail ! com>
Date: 2017-04-21 12:27:03
Message-ID: da3d48d5-7349-0bf3-ac74-18eb33a0e8f6 () gmail ! com
[Download RAW message or body]
Dear Antoine,
Thank you very much for the resolution. It solves my problem by
producing a graphically consistent plot. However, data-wise, the
colorbar does not match the plot unless I rescale it to (1,32). I want
to be able to infer the approximate value of the data from the colors.
However, thank you.
Kind regards,
Ekin
On 21/04/17 14:25, Antoine Monmayrant wrote:
> Le Vendredi, Avril 21, 2017 11:19 CEST, Ekin Akoglu <ekinakoglu@gmail.com> a \
> écrit:
> > Dear all,
> >
> > I am producing a checkerboard plot with Scilab and the plot seems
> > erroneously colored. The matrix I plot is attached as well as the
> > scripts to plot and the plot produced by Scilab.
> >
> > The problem is that the data at matrix(1,3) and matrix(1,4) are equal,
> > however, on the plot produced by Scilab it is represented by different
> > colors (plants vs det. feeders and plants vs carnivores on the plot).
> > Let me remind you that the plot is transposed form of the matrix.
> >
> > I would appreciate any help on the matter.
> >
> > Kind regards,
> >
> > Ekin
> >
>
> Hello,
>
> The default behavior for grayplot is to paint a given pixel (a given square) with \
> the color corresponding to its four corners.
> See: "help data_mapping"
> You can either change the data_mapping after calling grayplot or use Matplot.
> However, you'll have to rescale your data so that it ranges from 1 to nc where nc \
> is the number of colors in your color_map. See my modified function below.
> Does it solve your problem?
>
> Cheers,
>
> Antoine
>
> function myMTIplot(data)
>
> [nrows ncols] = size(data);
>
> data = [zeros(1,ncols); data; zeros(1,ncols)];
> data = [zeros(1,nrows+2)' data zeros(1,nrows+2)'];
>
> [nrows ncols] = size(data);
>
> figure1 = scf();
> a = newaxes();
>
> colorbar(-1, 1);
> grayplot(1:nrows, 1:ncols, data);
>
> figure1.color_map = jetcolormap(32);
>
> a.y_label.text = "Impacted Group";
> a.y_label.font_size = 4;
> a.x_label.text = "Impacting Group";
> a.x_label.font_size = 4;
> a.title.text = "Relative MTI";
> a.title.font_size = 5;
> a.font_size = 4;
> a.data_bounds = [1, 6, 1, 6];
>
> a.x_ticks = tlist(["ticks", "locations", "labels"], (1.5:1:5.5), ["Plants", \
> "Bacteria", "Det. Feeders", "Carnivores", "Detritus"]); a.y_ticks = tlist(["ticks", \
> "locations", "labels"], (1.5:1:5.5), ["Plants", "Bacteria", "Det. Feeders", \
> "Carnivores", "Detritus"]);
>
> //new version without interpolation
> // we rescale the data so that is goes from 1 to 32
> dat=(data-min(data))/(max(data)-min(data))*31+1;
> figure2 = scf();
> a = newaxes();
>
> colorbar(-1, 1);
> grayplot(1:nrows, 1:ncols, dat);
> e=gce();e.data_mapping="direct";//no interpolation
>
> figure2.color_map = jetcolormap(32);
>
> a.y_label.text = "Impacted Group";
> a.y_label.font_size = 4;
> a.x_label.text = "Impacting Group";
> a.x_label.font_size = 4;
> a.title.text = "Relative MTI";
> a.title.font_size = 5;
> a.font_size = 4;
> a.data_bounds = [1, 6, 1, 6];
>
> a.x_ticks = tlist(["ticks", "locations", "labels"], (1.5:1:5.5), ["Plants", \
> "Bacteria", "Det. Feeders", "Carnivores", "Detritus"]); a.y_ticks = tlist(["ticks", \
> "locations", "labels"], (1.5:1:5.5), ["Plants", "Bacteria", "Det. Feeders", \
> "Carnivores", "Detritus"]);
>
> endfunction
>
> _______________________________________________
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic