Problems with plotting multiple objects
古いコメントを表示

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
2018 年 12 月 14 日
1 件のコメント
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.
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').
3 件のコメント
MICHELA VOLGARE
2018 年 12 月 15 日
Adam Danz
2018 年 12 月 15 日
"Nope, nothing "
What does that mean?
MICHELA VOLGARE
2018 年 12 月 16 日
カテゴリ
ヘルプ センター および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!