[scilab-Users] heatmap / Matplot

Nelson Mambre nmambre at gmail.com
Mon Jun 9 17:48:17 CEST 2008


Hi Joshua,

Don't have Scilab installed right now, but maybe contour or contour2d 
could help you, if they are more or less the same as contourf in Matlab.

Nelson.

Joshua Auerbach wrote:
> Thanks for the info on grayplot.  A little confusing that something 
> that plots colors would be called "gray"plot don't you think?
>
> In any case, this almost gets me to where I want, except grayplot 
> determines the color for each rectangle from the average value at each 
> corner and I do not want this.  I want each rectangle to only take its 
> color from one value (what is at the center of the rectangle).  ie if 
> my z matrix is binary I want to only see two colors but with grayplot 
> i will get a color for 0 (all four corners 0), 0.25 (one corner 1), 
> 0.5 (two corners 1), 0.75 (three corners 1) and 1 (all four corners 1).
>
> Any advice on how to do that?
>
> Thanks,
> Josh
>
> duboism at limsi.fr wrote:
>> Hi Joshua,
>>
>> I think that the function grayplot (and its friends fgrayplot, 
>> Sgrayplot)
>> would be useful for you but you will have to reformat your data.
>>
>> grayplot takes 3 arguments: x (vector of x coordinates, size nx), y
>> (vector of y coordinates, size ny) and a nx*ny matrix data (the value at
>> data(i,j) is the value of point (x(i), y(j)) ). See the script
>> test_grayplot.sce.
>>
>> It should not be hard to re-format your data this way.
>>
>> Note the use of the zminmax option to plot different data with the same
>> color scale (see test_grayplot2.sce).
>> Note also that on the x86_64 architecture the function colorbar seems
>> broken (in fact you cannot use it since it raises an error).
>>
>> Mathieu
>>
>>  
>>> Hi,
>>>
>>> I am looking for some assistance.  I am trying to make what I know as a
>>> heatmap.  Basically I have data for many points on a grid and want to
>>> construct a 2d plot where each point is given a color on a gradient
>>> (From blue to red say) based on the data value at that point.  I have
>>> the data in the form of a matrix with 3 columns x-coord, y-coord, data
>>> value
>>>
>>> Currently I am making this type of plot by transforming my grid
>>> coordinates into matrix coordinates of a new matrix and scaling my data
>>> values into the range [0, NUM_COLORS] and using the Matplot function to
>>> plot this data.  This method does work, but has a few shortcomings: I
>>> lose the original scale of my grid since the axis labels are based on
>>> the matrix coordinates.  There is no key explaining the gradient and
>>> even if there were I would lose the original scale of my data values.
>>>
>>> Does anyone know how to get around these limitations or know of a 
>>> better
>>> way to accomplish what I am trying to do?  I'd appreciate any help.
>>>
>>> Cheers,
>>> Josh
>>>
>>>     
>
>



More information about the users mailing list