Alternative to contour plot: pixel plot?

30 ビュー (過去 30 日間)
Jonathan
Jonathan 2015 年 1 月 5 日
編集済み: Jiri Mateju 2015 年 7 月 19 日
Hi There,
I'm plotting out some latitude vs. (pressure) altitude data with a gridded resolution of .25 deg latitude by 20 millibar of (pressure) altitude, and with a scalar value that is represented as color. Until now, I've been using contourf to do this, and it works reasonably well. However, for publication purposes, I'd really prefer to plot each grid point as a "pixel" to clean the figure up a bit. This should be reasonably simple, since it's basically just using "plot" with a color axis, but that requires getting the pixel size juuuust right so that each pixel doesn't overlap the next, and problematically each pixel is not perfectly square. Is there a plot function that automates this so that the size of the rectangular pixel is a function of the distance to the next point (in both x and y), so that it looks clean without overlapping?
I'm attaching an figure from a colleague's R script that does this reasonably well to give you a sense for what I'm trying to achieve. Please ignore the gray lines in the plot--they represent something unrelated to this problem.
If such a function doesn't exist, any other suggestions on how to make this work using a basic function like plot?
Thanks!

採用された回答

Doug Hull
Doug Hull 2015 年 1 月 5 日
This looks like it can be done with the command "Image"
  2 件のコメント
Jonathan
Jonathan 2015 年 1 月 5 日
Thanks, Doug! This was a good call. I should mention, in case anyone else has a similar question, and comes across this post, that "imagesc" is equally or more helpful because it scales the color axis to the values you define (at least that's my understanding). I do have a problem with both image and imagesc that I'll post in another thread since this response answered the original question. Thanks.
Image Analyst
Image Analyst 2015 年 1 月 5 日
You can also use imshow() - it's now available in base MATLAB. Don't use pcolor() though.

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

その他の回答 (1 件)

Jiri Mateju
Jiri Mateju 2015 年 7 月 19 日
編集済み: Jiri Mateju 2015 年 7 月 19 日
I had a similar problem and solved it with patch (attached).

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by