[Scilab-users] Scilab checkerboard plot (grayplot)
Ekin Akoglu
ekinakoglu at gmail.com
Wed Apr 26 13:48:16 CEST 2017
Dear Samuel,
Thank you for your help. This way it works as I wanted it to be. Matplot
is the better way to go for my purposes. Thank you again.
It is a pity that the data need to be re-scaled before plotting, though.
Otherwise, it gives a black plot with Matplot.
Best regards,
Ekin
On 22/04/17 12:15, Samuel Gougeon wrote:
> There was a mistake in the mapping (+zmax instead of +1).
> And may be about data transposition. The following shows
> 0 in the bottom row, as the plot you posted:
>
> function myMTIplot(data)
>
> // Rescaling data to a given range of indices
> nc = 32; // number of colors
> zmin = -1;
> zmax = 1;
> data2 = (data - zmin)/(zmax-zmin)*(nc-1) + 1;
> data2 = flipdim(data2',1);
> // Plotting
> clf
> f = gcf();
> f.color_map = jetcolormap(nc);
> Matplot(data2)
> a = gca();
> colorbar(zmin, zmax);
>
> xlabel("Impacting Group", "fontsize",4)
> ylabel("Impacted Group", "fontsize", 4)
> title("Relative MTI", "fontsize", 5);
>
> [nrows, ncols] = size(data);
> a.sub_ticks(1) = 0;
> a.font_size = 3;
> a.font_style = 8;
> ticksText = tlist(["ticks", "locations", "labels"], 1:ncols, ..
> ["Plants", "Bacteria", "Det. Feeders", "Carnivores", "Detritus"]);
> a.x_ticks = ticksText;
> a.y_ticks = ticksText;
> endfunction
>
> data = csvRead("matrix.csv");
> myMTIplot(M) --> flipdim(data',1)ans =0.4778269 -0.3005833 -0.0842439
> 0.0636698 -0.38217690.2895315 -0.1630711 0.5548875 -0.3547458
> 0.37435990.2895315 -0.1630711 -0.4451125 -0.3547458 0.37435990.4665757
> -0.2942464 -0.1058069 0.0774553 0.60327540. 0. 0. 0. 0.
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170426/4b18c111/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aikplhkfgacflkca.png
Type: image/png
Size: 16544 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20170426/4b18c111/attachment.png>
More information about the users
mailing list