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

7 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by