Two y axis with the same data set

2 次查看(过去 30 天)
Hi,
Just to be clear, I don't think i am asking the same question that is already abundant which is basically plotting two graphs with two axis in one graph.
But I need to plot one 2d contour plot with one dataset with two y axis on left and right side. But I am not plotting a second contour plot dependent on the second y axis but rather the 2nd yaxis is just there as a reference to different scales.
An example plot is included below. Ignore the filled gradient and focus on just line contour. This contour plot is plotted with respect to left yaxis and bottom xaxis. But it also includes secondary yaxis on the right and the secondary xaxis on top. If I just use yyaxis and plot another contour with the secondary yaxis, it will just generate a secondary contour which I don't want. I think this plot was generated using tecplot but I would like to use matlab if possible for scripting reasons. Is this possible in matlab? Thank you in advance.

采纳的回答

VBBV
VBBV 2022-3-12
编辑:VBBV 2022-3-12
dk = 1000;
dB = linspace(0.002,dk,7)*1e-6; % in micrometer
Sg = linspace(0.001,20,7);
hold all
M = rand(7);
t = tiledlayout(1,1);
ax1 = axes(t);
contour(ax1,Sg,dB/1e-6,M);
ax1 = gca;
ax1.XScale = 'log';
ax1.YScale = 'log' ;
hold(ax1);
Current plot held
ax2 = axes(t);
contour(ax2,Sg,dB/1e-6,M);
ax2 = gca;
ax2.XScale = 'log';
ax2.YScale = 'log';
ax2.XAxisLocation = 'top';
ax2.YAxisLocation = 'right';
colorbar;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by