[scilab-Users] heatmap / Matplot

Joshua Auerbach joshua.auerbach at uvm.edu
Wed Jun 11 15:26:15 CEST 2008


Excellent!!  This is pretty much exactly what I was looking for.  Thank 
you so much François!

Josh

François Vogel wrote:
> OK, OK...
>
>
> //----------
>
> xmin=-5;
> xmax=5;
> ymin=0;
> ymax=5;
> xystep=0.1;
> nx=abs((xmax-xmin)/xystep)+1;
> ny=abs((ymax-ymin)/xystep)+1;
> data_array = rand(nx,ny);  // between 0 and 1
>
> dm=min(data_array);
> dM=max(data_array);// below it is supposed that dm<>dM
>
> n_colors=64;
>
> f=scf(max(winsid())+1);
> f.color_map=jetcolormap(n_colors);
> colorbar(dm,dM)
>
> ax=gca();
> ax.axes_visible=["on","on"];
> ax.tight_limits="on";
> ax.data_bounds=[xmin,ymin;xmax,ymax];
>
> data_colors=(data_array-dm)/(dM-dm)*(n_colors-1) + 1;
>
> Matplot1(data_colors,[xmin,ymin,xmax,ymax])
>
> //----------
>
> And now please don't tell me that each rectangle should be *centered* 
> on the x and y coordinates. You are correct, of course, but this 
> feature I could never get right. Your turn to contribute on this (and 
> I would really be interested).
>
> Final note: the above works in Scilab 4.1.2.
> If you try it with Scilab 5 you hit bug 2814 (not fixed, no sign it 
> will be in the foreseeable future).
>
> Francois
>
>
> Joshua Auerbach said on 09/06/2008 21:13:
>> What I have found with plotframe as with using the rect argument of 
>> Matplot is that it gives me axises  with the bounds I give it, but 
>> still is using the matrix indices for the coordinates.  For example 
>> my real bounds are xmin = -5 xmax = 5, ymin = 0 and ymax = 5 which I 
>> have data collected at intervals of 0.1 in both directions, so my 
>> matrix has 101 columns and 51 rows, but if I call   plotframe([-5 0 5 
>> 5]);
>> All I will see is the lower left part of my data.  What I really want 
>> is all the data to show, but instead of the axises showing x go from 
>> 1 to 101 and y go from 1 to 51 I want it to show as x going from -5 
>> to 5 and y going from 0 to 5
>>
>> I was able to get what I described above using grayplot, but (see my 
>> other responses) that has problems of its own.  Perhaps I will just 
>> not display the axises at all and edit them into the image later, but 
>> was really hoping to be able to do this all in scilab.
>>
>> Cheers,
>> Josh
>>
>>
>> François Vogel wrote:
>>> help plotframe ?
>>>
>>> F.
>>>
>>> Joshua Auerbach said on 07/06/2008 18:38:
>>>> That gives me the key on the side, which helps things a little, but 
>>>> is there a way to adjust the coordinates of the plot so it uses my 
>>>> grid coordinates as opposed to the matrix indices?
>>>>
>>>> Josh
>>>>
>>>> François Vogel wrote:
>>>>> IIUC, just adding a colorbar would do the trick, or...?
>>>>>
>>>>> See help colorbar
>>>>>
>>>>> Francois




More information about the users mailing list