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

8 visualizaciones (últimos 30 días)
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')

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Oct. de 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 comentarios
Muhammad Tariq
Muhammad Tariq el 22 de Oct. de 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 el 22 de Oct. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Labels and Styling en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by