Changing the color of a 3D plot

40 ビュー (過去 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by