How can I plot the second zoomed plot with legend colour ?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
sanjay Krishnamurthy
il 31 Mar 2022
Commentato: sanjay Krishnamurthy
il 31 Mar 2022
The objective here is to have the same legend colour for the zoomed plot [in rectangle box] instead of just blue as shown in the image (second). Can anyone suggest how can i do that? Thank you
here is my code
clc
clear all
%load the tensile test data
load tensile_matlab.mat
% data variables stored in matrix
X=[AR_e WQ_e AC_e FC_e WQS_e ACS_e FCS_e];
Y=[AR_s WQ_s AC_s FC_s WQS_s ACS_s FCS_s];
plot(X,Y, Linewidth=1.5);
% plot font and legend
legend('AR','WQ','AC','FC','WQ+S','AC+S','FC+S','Location','southeast')
xlabel('Strain')
ylabel('Stress in Mpa')
%second zoom plot
axes('Position',[0.2 0.3 0.45 0.25]);
box on
my_index = 0.04<X & X<0.08;
plot(X(my_index),Y(my_index))
axis tight
0 Commenti
Risposta accettata
Chunru
il 31 Mar 2022
load tensile_matlab.mat
% data variables stored in matrix
X=[AR_e WQ_e AC_e FC_e WQS_e ACS_e FCS_e];
Y=[AR_s WQ_s AC_s FC_s WQS_s ACS_s FCS_s];
plot(X,Y, Linewidth=1.5);
% whos
% plot font and legend
legend('AR','WQ','AC','FC','WQ+S','AC+S','FC+S','Location','southeast')
xlabel('Strain')
ylabel('Stress in Mpa')
%second zoom plot
h = axes('Position',[0.2 0.3 0.45 0.25]);
box on
%my_index = 0.04<X & X<0.08;
plot(X,Y)
xlim(h, [0.04 0.08])
%axis tight
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Exploration 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!