Changing the color of a 3D plot

25 次查看(过去 30 天)
EM
EM 2020-8-4
评论: KSSV 2020-8-4
Hi everyone,
I'm plotting two 3D ssurface plots that are generated from the cure fitting toolbox. In the following you can see how I call the plots. The problem is that, both plots have the same color. I want to change the color of at least one of the plots to be recognizable from the other. I appreciate you help.
figure(1)
U = LF_fit(Nc_1, Eo_L1, s_1);
hold on
V = HF_fit(Nc_2, Eo_2, s_2);
hold on
  2 个评论
KSSV
KSSV 2020-8-4
LF_fit, HF_fit are not inbuilt functions.....those are user defined functions. You need to post the functions here to see how the plotting is done.
EM
EM 2020-8-4
编辑:Rik 2020-8-4
Here is one of the functions: (the otherone is similat)
function [fitresult, gof] = HF_fit(Nc_HF, Eo_HF, s_d_or_HF)
%CREATEFIT(NC_HF,EO_HF,S_D_OR_HF)
% Create a fit.
% Data for 'untitled fit 1' fit:
% X Input : Nc_HF
% Y Input : Eo_HF
% Z Output: s_d_or_HF
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 08-Jul-2020 20:13:56
%% Fit: 'untitled fit 1'.
[xData, yData, zData] = prepareSurfaceData( Nc_HF, Eo_HF, s_d_or_HF );
% Set up fittype and options.
ft = fittype( 'poly13' );
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft );
% Plot fit with data.
% figure( 'Name', 'untitled fit 1' );
h = plot( fitresult);
% legend( h, 'untitled fit 1', 's_d_or_HF vs. Nc_HF, Eo_HF', 'Location', 'NorthEast' );
% % Label axes
% xlabel Nc_HF
% ylabel Eo_HF
% zlabel s_d_or_HF
% grid on
% view( 70.8, 22.0 );

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2020-8-4
编辑:KSSV 2020-8-4
This command:
h = plot( fitresult);
You specify a marker/ different color for both the functions.
h = plot( fitresult,'b'); % in one function
h = plot( fitresult,'r'); % in another function
  2 个评论
EM
EM 2020-8-4
I get the following error:
Error using plot
No value was given for 'cb'. Name-value pair arguments require a
name followed by a value.
KSSV
KSSV 2020-8-4
Use simply b.Read about plot in the documentation.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fit Postprocessing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by