how to create different plots in the same figure and create different yaxis for all the plots
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
i want to create figure like the attach file and create different yaxis in different places. how can i do this?
2 Commenti
jonas
il 1 Set 2018
Modificato: jonas
il 1 Set 2018
Is the bottom x-axis (x1/D) actually connected to those lines? Without context I find this graph quite confusing. I suspect this is just three different aligned subplots with the same y- and x-axis where the horizontal location of each subplot has been set to signify increasing x1/D. Why else are there no ticks on the x-axis? Also, the origin is not in the intercept, making it almost impossible to read the value of x1/D over x2/D. However, I'm just guessing here. Need more context to help.
Risposte (2)
Star Strider
il 1 Set 2018
Modificato: Star Strider
il 1 Set 2018
Try something like this:
x = linspace(-2, 2, 50);
y = [10*exp(-2*(x.^2))+10; 10*exp(-4*(x.^2))+20; 10*exp(-8*(x.^2))+30];
figure
hp = plot(x, y);
rotate(hp, [0 0 1], 90)
Experiment to get the result you want. (The ‘trick’ is the rotate call!)
Also see the xlabel (link) and Axes Properties (link) documentation to set the appropriate axis and tick labels for your plot.
Edit —

Added plot figure.
2 Commenti
jonas
il 1 Set 2018
As already pointed out by Star Strider, the key is rotate. I just wanted to add this template for reproducing this specific plot, if that's what you're looking to do. Find the resulting graph in the attachment.
% Data
x = 0:.1:2*pi;
y = sin(x);
% Plot template
figure;
% Subplot 1
h(1)=subplot(1,3,1);hold on
hp{1}=plot(x,y)
ylabel('xaxis')
rotate(hp{1},[0 0 1],90)
% Subplot 2
h(2)=subplot(1,3,2);hold on
hp{2}=plot(x,y)
xlabel('yaxis')
rotate(hp{2},[0 0 1],90)
% Subplot 3
h(3)=subplot(1,3,3);hold on
hp{3}=plot(x,y)
rotate(hp{3},[0 0 1],90)
% Axes settings
set(h,'xaxislocation','top','ycolor','none')
hg=axes('color','none','xtick',[],'xticklabels',{})
xlabel('random line')
ylabel('yaxis')
set(gcf,'color','w')
linkaxes([h hg],'y')
linkaxes([h],'x')
dPos=hg.Position-h(1).Position;
for i=1:3
h(i).Position=h(i).Position+[0.05 0 0 dPos(4)];
end
hg.Position=hg.Position+[0 0 0.05 0];
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!