Two y axis with the same data set

2 visualizzazioni (ultimi 30 giorni)
Han Ju Lee
Han Ju Lee il 11 Mar 2022
Modificato: VBBV il 12 Mar 2022
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.

Risposta accettata

VBBV
VBBV il 12 Mar 2022
Modificato: VBBV il 12 Mar 2022
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;

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by