フィルターのクリア

How to plot a contourf ?

1 回表示 (過去 30 日間)
Inês Mendes
Inês Mendes 2015 年 7 月 9 日
コメント済み: Inês Mendes 2015 年 7 月 9 日
Hi guys,
Do any of you know if it is possible to plot a contourf in which my y axis corresponds to a string array, my x axis to a time array, and my Z to a numeric array?
Thanks in advance!
Inês

採用された回答

Mike Garrity
Mike Garrity 2015 年 7 月 9 日
編集済み: Mike Garrity 2015 年 7 月 9 日
The easiest way to deal with non-numeric data is to give contour numeric indices into the data and use the data as your TickLabels:
xoptions = {'left','center','right'};
yoptions = {'bottom','middle','top'};
nx = length(xoptions);
ny = length(yoptions);
contourf(1:nx,1:ny,randn(ny,nx))
set(gca,'XTick',1:nx,'XTickLabels',xoptions)
set(gca,'YTick',1:ny,'YTickLabels',yoptions)
Datetimes are similar, but you need to turn them into strings before using them as tick labels:
yoptions = datetime(2015,1:3,1);
ny = length(yoptions);
set(gca,'YTick',1:ny,'YTickLabels',datestr(yoptions))
  1 件のコメント
Inês Mendes
Inês Mendes 2015 年 7 月 9 日
Thank you :)

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

その他の回答 (0 件)

カテゴリ

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