Change color pdegplot/ gradient

11 visualizaciones (últimos 30 días)
Arthur
Arthur el 8 de Mayo de 2020
Comentada: Arthur el 9 de Mayo de 2020
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

Respuesta aceptada

Ravi Kumar
Ravi Kumar el 9 de Mayo de 2020
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 comentario
Arthur
Arthur el 9 de Mayo de 2020
I did not see the answer being this easy.
Thanks

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by