フィルターのクリア

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

1 回表示 (過去 30 日間)
sanjay Krishnamurthy
sanjay Krishnamurthy 2022 年 3 月 31 日
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

採用された回答

Chunru
Chunru 2022 年 3 月 31 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by