Filter löschen
Filter löschen

How can I plot the second zoomed plot with legend colour ?

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

Chunru
Chunru am 31 Mär. 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

Weitere Antworten (0)

Kategorien

Mehr zu Visual Exploration 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!

Translated by