How to plot Gaussian in purple
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Image Analyst
on 13 Nov 2015
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.
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!