How to plot Gaussian in purple
Afficher commentaires plus anciens
Hi. I am plotting several Gaussians. I want to make the black line be purple instead, with a linewidth of 1.5. But I don't know how to do that. I know you have to use a vector, but all the vectors I tried don't work and I'm not getting purple, and that also screws up my linewidth too. MakeNormalDis is a function which links to another .m file which specifies a normal distribution function, for inputs mu and sigma. I am using R2014b version of matlab.
firstp = makeNormalDis(0,1.5);
secondp = makeNormalDis(0,1);
thirdp = makeNormalDis(0,3);
fourthp = makeNormalDis(0,0.5);
x = [-5,5];
% Plot the results:
figure;
hold on
fplot(firstp, x, 'b');
set(findobj(gca, 'Type', 'Line', 'Color', 'b'), 'LineWidth', 1.5);
fplot(secondp, x, 'r');
set(findobj(gca, 'Type', 'Line', 'Color', 'r'), 'LineWidth', 1.5);
fplot(thirdp, x, 'y');
set(findobj(gca, 'Type', 'Line', 'Color', 'y'), 'LineWidth', 1.5);
fplot(fourthp, x, 'k');
set(findobj(gca, 'Type', 'Line', 'Color', 'k'), 'LineWidth', 1.5);
ylabel('pdf(x)');
xlabel('x');
title('Probability Density Function');
legend('mu = 0, sigma = 1.50', 'mu = 0, sigma = 1.00', ...
'mu = 0, sigma = 3.00', 'mu = 0, sigma = 0.50', ...
'Location', 'northeast');
hold off

Réponses (1)
Image Analyst
le 13 Nov 2015
0 votes
See if a color of 'm' works for you. Otherwise use 'Color', [0.5,0,0.5] or something like that to make it a little darker.
Catégories
En savoir plus sur Exploration and Visualization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!