Problems with plotting multiple objects

1 view (last 30 days)
MICHELA VOLGARE
MICHELA VOLGARE on 13 Dec 2018
Commented: MICHELA VOLGARE on 16 Dec 2018
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');

Answers (2)

MICHELA VOLGARE
MICHELA VOLGARE on 14 Dec 2018
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 Comment
Adam Danz
Adam Danz on 14 Dec 2018
Edited: Adam Danz on 14 Dec 2018
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.

Sign in to comment.


Adam Danz
Adam Danz on 14 Dec 2018
Edited: Adam Danz on 14 Dec 2018
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').

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!