Changing the color of a 3D plot

조회 수: 43 (최근 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에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by