Change color pdegplot/ gradient

17 次查看(过去 30 天)
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by