Filter löschen
Filter löschen

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

11 Ansichten (letzte 30 Tage)
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')

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Okt. 2023
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 Kommentare
Muhammad Tariq
Muhammad Tariq am 22 Okt. 2023
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 am 22 Okt. 2023
%%
%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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by