Why does Pcolor reduce the resolution of my n x m matrix

3 ビュー (過去 30 日間)
Anneke ten Doeschate
Anneke ten Doeschate 2017 年 3 月 3 日
コメント済み: Walter Roberson 2017 年 3 月 3 日
I am trying to make a plot of a matrix T (n x m) which corresponds to data at n-depth levels 'Z', evolving over m timestamps 't'. I always used to use imagesc(, but somehow this gives me a blank figure (???). t is slightly irregularly spaced, Z is regular.
Alternatively plotting imagesc(T) gives a nice plot, but I would prefer imagesc(t,Z,T) to work. Instead using pcolor() gives an ugly plot, which looks like an imagesc of n/6 columns only. What's going on?
  2 件のコメント
KSSV
KSSV 2017 年 3 月 3 日
Try pcolor and then shading interp.
Anneke ten Doeschate
Anneke ten Doeschate 2017 年 3 月 3 日
Thank you. that removes the lines but still very 'blocky'

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2017 年 3 月 3 日
The pcolor function uses the edges to define the patch colours, so it is ‘trimmed’ by one row and one column.
Use the image function instead.
  7 件のコメント
Adam
Adam 2017 年 3 月 3 日
If you have irregularly space data I would suggest interpolating it onto a regular grid.
Personally I always use imagesc (and have only ever heard of pcolor from questions in the forum and never really knew what it did or why since its name does not convey to me anything that would suggest I'd want to plot an image with it!), but it depends what you are plotting and what you want to get from it.
I work with images that are recorded data rather than pictures (as you appear to be doing) so imagesc does exactly what I want, stretching the colourmap (though admittedly I usually over-ride this myself anyway). I have never had any desire to use imshow, but I know other people like it and I guess for photograph/picture type images it works fine and you don't have to map your data via a colourmap (though images either come with a colourmap or are greyscale or true RGB anyway so that is not difficult).
Walter Roberson
Walter Roberson 2017 年 3 月 3 日
"If you have irregularly space data I would suggest interpolating it onto a regular grid."
pcolor / texture mapping is more efficient, in that it allows you to offload that work to your graphics hardware. That can make a significant difference if you are animating by updating coordinates.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by