Change color pdegplot/ gradient

5 ビュー (過去 30 日間)
Arthur
Arthur 2020 年 5 月 8 日
コメント済み: Arthur 2020 年 5 月 9 日
I'm working on a project where it's useful to view the geometry and the gradient at the same time, but need a way to change the color of at least one of them.
I've written you guys some lines to show what I'd want to do
model = createpde;
R = [3,4,-2,-2,2,2,-3,3,3,-3]';
C = [1,0,0,1]';
C = [C;zeros(length(R)-length(C),1)];
gm = [R,C];
sf = 'R+C';
ns = char('R','C');
ns = ns';
[dl1,~] = decsg(gm,sf,ns);
geometryFromEdges(model,dl1);
applyBoundaryCondition(model,'dirichlet','Edge',[1,2,3,4],'u',0);
applyBoundaryCondition(model,'dirichlet','Edge',[5,6,7,8],'u',-10);
specifyCoefficients(model,'m',0,'d',0,'a',0,'c',5,'f',0,'face',1);
specifyCoefficients(model,'m',0,'d',0,'a',0,'c',5,'f',-2,'face',2);
mesh = generateMesh(model);
res = solvepde(model);
figure()
pdeplot(model,'FlowData',[res.XGradients,res.YGradients],'ColorMap',gray);
hold on
pdegplot(model,'FaceLabels','off','EdgeLabels','off','VertexLabels','off');
axis equal
hold off
The problem with this code is that both the gradient and the edges are in red, and this isn't that easy to read.
Can you tell me how to change preferably 2, but at least 1 of these colors?
Thanks

採用された回答

Ravi Kumar
Ravi Kumar 2020 年 5 月 9 日
One workaround would be switch the order of plots:
figure()
pdegplot(model,'FaceLabels','off','EdgeLabels','off','VertexLabels','off');
axis equal
hold on
pdeplot(model,'FlowData',[res.XGradients,res.YGradients]);
hold off
Regards,
Ravi
  1 件のコメント
Arthur
Arthur 2020 年 5 月 9 日
I did not see the answer being this easy.
Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by