Set non-uniform axis - extension of certain part of y-axis.

16 ビュー (過去 30 日間)
Himanshu Saxena
Himanshu Saxena 2021 年 5 月 12 日
編集済み: Adam Danz 2021 年 5 月 14 日
I want to extend a certain section of the y-axis in a contour plot. For e.g., 0 to 200 m and 200 to 400 m depths are extended to different extents in a plot as shown in the attached figure.
Is there a direct function to do so?
If not the extension of multiple sections of axis, 'function' for extension of one section only shall also work.
  7 件のコメント
Himanshu Saxena
Himanshu Saxena 2021 年 5 月 14 日
I do not see the documentation online regarding that explanation. But I have attached a screenshot of the software that clearly shows that the y-axis can be stretched without converting it into log scale.
So now I know MATLAB do not stretch the axes, I cannot plot such plot.
Adam Danz
Adam Danz 2021 年 5 月 14 日
編集済み: Adam Danz 2021 年 5 月 14 日
The ODV User Guide unfortunately doesn't mention how they implement the appearance of a strechted y-axis. The tick-intervals are not linear nor do they appear to be logarithmic which are the only two options in Matlab.
To create plots that appear to have nonlinear axes that aren't logrithmic, you can stretch the data itself and apply axis ticks and tick-labels accordingly.
Note that applying a log-axis does stretch the upper portion of the data as shown in my answer, but differently than what appears in the ODV plots you shared.

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

回答 (1 件)

Adam Danz
Adam Danz 2021 年 5 月 13 日
編集済み: Adam Danz 2021 年 5 月 13 日
The y-axis in your image is log-scaled and flipped. However, log(0) is undefined (it's -inf in matlab) so the 0-tick in the image makes me believe that the tick labels were manually placed.
Here's an example, of a log-scale on the flipped y-axis with custom ticks but without changing ticklabels.
ax = axes();
[X,Y,Z] = peaks;
contourf(X,(Y+3)*233.33,abs(Z),7)
ax.YDir = 'Reverse';
ax.YScale = 'log';
ax.YTick =[100 200 400 600 800 1000 1400];
ax.TickDir = 'out';
ylim([100 1400])
colormap(flipud(turbo(255)))

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by