필터 지우기
필터 지우기

I am plotting probability plots, but I want different colors for different data. All data are of different size ?

조회 수: 11 (최근 30일)
figure;
probplot('lognormal', Loadingtime_4);
hold on;
probplot('lognormal', Loadingtime_5);
hold on;
probplot('lognormal', Loadingtime_6);
xlabel('Loading Duration (secs)');
set(gca, 'XScale', 'log'); % Set the x-axis to use a logarithmic scale
xticks([10 50 100 500 1000 10000]);
xticklabels({'10', '50','100', '500', '1000', '10000'});
grid on;
legend('Lognormal Distribution','Data Drift 4,5 & 6','Location','southeast')
title('Lognormal')

채택된 답변

Walter Roberson
Walter Roberson 2023년 10월 19일
https://www.mathworks.com/help/stats/probplot.html#bu27cw3-1 is an example that shows adding a line to a probplot(), and one of the steps it shows is changing the color
h = probplot(gca,t,p);
h.Color = 'r';
You can use that same technique to give different colors to your different probplot()
  댓글 수: 7
Muhammad Tariq
Muhammad Tariq 2023년 10월 22일
The only problem is that when I do it on my matlab it still gives the same color for all. I don't know what is the problem
%Using Random data
figure;
p1 = probplot('lognormal', randi(1000,1,100));
hold on;
p2 = probplot('lognormal', randi(100,1,100));
hold on;
p3 = probplot('lognormal', randi(500,1,100));
%color the function lines
p1(2).Color = p1(1).Color;
p2(2).Color = p2(1).Color;
p3(2).Color = p3(1).Color;
xlabel('Loading Duration (secs)');
set(gca, 'XScale', 'log'); % Set the x-axis to use a logarithmic scale
xticks([10 50 100 500 1000 10000]);
xticklabels({'10', '50','100', '500', '1000', '10000'});
grid on;
%legend('Lognormal Distribution','Data Drift 4,5 & 6','Location','southeast')
title('Lognormal')
Muhammad Tariq
Muhammad Tariq 2023년 10월 22일
%%
%Using Random data
figure;
p1 = probplot('lognormal', randi(1000,1,100));
hold on;
p2 = probplot('lognormal', randi(100,1,100));
hold on;
p3 = probplot('lognormal', randi(500,1,100));
%color the function lines
p1(1).Color = 'r';
p2(1).Color = 'b';
p3(1).Color = 'g';
p1(2).Color = 'r';
p2(2).Color = 'b';
p3(2).Color = 'g';
xlabel('Loading Duration (secs)');
set(gca, 'XScale', 'log'); % Set the x-axis to use a logarithmic scale
xticks([10 50 100 500 1000 10000]);
xticklabels({'10', '50','100', '500', '1000', '10000'});
grid on;
legend('Lognormal Distribution','Data 1','Lognormal Distribution','Data 2','Lognormal Distribution','Data 3,''Location','best')
title('Lognormal').
%%
I needed to change it to this and now it works

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by