Set non-uniform axis - extension of certain part of y-axis.
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Adam Danz
am 14 Mai 2021
Bearbeitet: Adam Danz
am 14 Mai 2021
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.
Antworten (1)
Adam Danz
am 13 Mai 2021
Bearbeitet: Adam Danz
am 13 Mai 2021
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)))
0 Kommentare
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!