contourf nolinear y axis
2 ビュー (過去 30 日間)
古いコメントを表示
Dear all!
For a couple of days I am struggling with the following problem and I hope someone here could help me with that. I am using the contourf function to plot my 3D array, I first specifiy x (time), then y (frequencies), then Z power values (array size time x frequencies). The plot looks fine fist, but then I noticed that my axes are plotted lineary. While this is fine for the x axis (time), this does not work for the y axis, where the distances between each frequency is not linear.
On the reference page I read that "If X or Y is irregularly spaced, then contourf calculates contours using a regularly spaced contour grid, and then transforms the data to X or Y."
So now I wonder how I could change this, to to set the Y axis in a non-linear fashion, representing my input.
Thank you,
Kat
0 件のコメント
回答 (1 件)
Naveen Venkata Krishnan
2019 年 10 月 10 日
Hello Kat,
As far as I understood from the description, you have irregulary spaced Y ( assuming only Y is irregulary spaced and X is regularly spaced ) and then you have contourf plot on which you want see your irregularly spaced Y instead of default regularly spaced values.
This can be done in this way :
X = 1:5;
Y = [2,6,9,11,18];
Z = peaks(5);
ax =axes; % handle to the current axes
contourf(X,Y,Z);
ax.YTick = Y; %since Y is irregularly spaced and only that points must be seen on the axes
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!