Defining RGB color in curve fitting

11 次查看(过去 30 天)
Sarah Fergione
Sarah Fergione 2015-7-27
编辑: Jon 2015-7-27
I want to customize the color of my plots and error bars. When I enter 'r' for example where the [R G B] values are, the color shows up perfectly fine. When replaced with the RGB value, the connecting curve is no longer present on the graph. What do I need to change to make the line re-appear?
Thanks
<<
>>
hold on
h1 = scatter(X,Y1);
set(h1,'MarkerEdgeColor',[.204,.098,.055],'MarkerFaceColor',[.204,.098,.055]);
csp = csape( X, Y1, 'periodic' );
fnplt(csp,[.204,.098,.055]);
s1 = errorbar(X, Y1, Z1,'.');
set(s1,'Color',[.204,.098,.055]);
h2 = scatter(X,Y2);
set(h2,'MarkerEdgeColor',[.596,.192,.153],'MarkerFaceColor',[.596,.192,.153]);
csp = csape( X, Y2, 'periodic' );
fnplt(csp,[.596,.192,.153]);
s2 = errorbar(X, Y2, Z2,'.');
set(s2,'Color',[.596,.192,.153]);
h3 = scatter(X,Y3);
set(h3,'MarkerEdgeColor',[.749,.318,.106],'MarkerFaceColor',[.749,.318,.106]);
csp = csape( X, Y3, 'periodic' );
fnplt(csp,[.749,.318,.106]);
s3 = errorbar(X, Y3, Z3,'.');
set(s3,'Color',[.749,.318,.106])
xlim([0 220]);
ax = gca;
ax.XTick = [0 24 48 72 168 192 216];
ylim([10000 10000000]);
ay = gca;
ay.YScale = 'log';
xlabel('Hours') % x-axis label
ylabel('CFU/mL') % y-axis label
title ('R.pickettii growth in various solutions')

回答(1 个)

Jon
Jon 2015-7-27
编辑:Jon 2015-7-27
I don't see in the help file for fnplt that you can specify a color (though you must not be getting an error...)
You could try
f1 = fnplt(csp);
set(f1,'linecolor',[your values]);

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by