Problems with plotting multiple objects

2 次查看(过去 30 天)
Hi! I have a question. There are the label of contour on the rectangle. Can I delete this for a better reading? Thank you
This is the code for the graphic part.
[c,cc]=contour(x,y,u',[13.1,13.5,14,14.5,15,15.5,15.9]);
clabel(c,cc,'LabelSpacing',72,'Color','r','FontWeight','normal');
rectangle('position',[0,0,Lx,Ly])
rectangle('position',[x(6),y(4),d,3*d],'FaceColor',[0.5 0.5 0.5],'LineWidth',1)
axis('equal');
set(cc,'ShowText','on');
colormap cool;
axis([0 Lx 0 Ly]);
hold on;
streamline(x,y,qx,qy,[x(2:4),x(9:nx)], y(ny+1)*ones(1,6));
quiver(x(2:5),y(2:ny),qx(2:ny,2:5),qy(2:ny,2:5),'b');
quiver(x(8:nx),y(2:ny),qx(2:ny,8:nx),qy(2:ny,8:nx),'b');
quiver(x(6:7),y(2:3),qx(2:3,6:7),qy(2:3,6:7),'b');
trimesh(T,P(:,1),P(:,2),hh);
title('Sheet pile wall');
xlabel('x');ylabel('y');zlabel('z');

回答(2 个)

MICHELA VOLGARE
MICHELA VOLGARE 2018-12-14
If I remove this line
clabel(c,cc,'LabelSpacing',72,'Color','r','FontWeight','normal');
the numbers are black, not "red".
And with "off" i remove all numers, not only on rectangle.
set(cc,'ShowText','on');
I want hide numbers only on rectangle.
  1 个评论
Adam Danz
Adam Danz 2018-12-14
编辑:Adam Danz 2018-12-14
Now that I understand what rectangle you mean, I removed my previous answer and added a new one. If you have any follow-up comments, reply to my answer or to the comment section under your quesiton rather than adding an 'answer' that isn't an answer.

请先登录,再进行评论。


Adam Danz
Adam Danz 2018-12-14
编辑:Adam Danz 2018-12-14
I assume you're talking about the gray rectangle created by this line:
rectangle('position',[x(6),y(4),d,3*d],'FaceColor',[0.5 0.5 0.5],'LineWidth',1)
2 options:
Option 1. Plot the rectangle at the end of the code so it's on top of everything else.
Option 2. Save the handle to the rectangle and then after the rest of the plot is created, put the object on top of the UI stack.
rh = rectangle('position',[x(6),y(4),d,3*d],'FaceColor',[0.5 0.5 0.5],'LineWidth',1);
% the rest of your code is here..... then at the end, the next line
uistack(rh, 'top')
Note that if the rectangle is on top, it will also cover the contour lines so you may want to play around with the uistack() to position the rectangle so that you can see the contour lines but not the lables (if possible). For example, uistack(rh, 'up').

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by