Why does Pcolor reduce the resolution of my n x m matrix
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
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
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
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 Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!