Creating a customized grid on a imagesc() figure

4 次查看(过去 30 天)
Hi,
I have a matrix of values between -1 and 1, I look it up with imagesc().
I would like to trace a customized grid over that image to delimit portions of the "matrix" (datapoints that share a common property).
I thougt it would work to make up a second matrix with lines and rows full of NaNs or Inf or some special value.
But imagesc() will trace NaN and Inf in the color of the min and max in the matrix, not some special color.
So, is there a way to trace a grid on top of imagesc(), or to set the colormap in such a way that Inf (for example) are renderred black and the other values are renderred as in the normal colormap "jet"?
Thank you very much laurie

采纳的回答

Walter Roberson
Walter Roberson 2012-4-20
Create a second image located at exactly the same position as the first, with the lines that you want, and with AlphaData set to 0 where the underlying image should show through, and 1 where the overlay should show through. The second image would have to be truecolor (RGB) to use different colors than are in the original image. Note that if you do this then you will need to use the OpenGL renderer as it is the only one that supports transparency.
Alternately after drawing your base image, use line() specifying RGB colors to draw on the grid.
It is not possible to "exempt" particular values from the colormap: if you are using pseudocolor then every color in the image must appear somewhere in the colormap.
  2 个评论
laurie
laurie 2012-4-20
thank you. the first solution seems too complicated for me so i'll try with line() and come back :-)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Orange 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by