필터 지우기
필터 지우기

With what command i can change the width of contours created with SURFC from the beginning?

조회 수: 1 (최근 30일)
Hi friends
I created a 3D figure using SURFC. Now I want to increase the width of contours appeared in figure to 2, but I can not select contours to change their width. How can I plot the figure with wider contours from the beginning (what property or command)?
thank you

채택된 답변

Mike Garrity
Mike Garrity 2016년 1월 19일
The property is LineWidth, but things are a little tricky with surfc. The surfc command turns around and calls surf and contour. It is going to pass all of the property/value pairs you give it to the surf command, not the contour command. That means that if we do this:
surfc(peaks,'LineWidth',4)
We'll get wide lines on our surface, rather than on our contour.
The easiest way to set properties on the contour object is to get the return value from surfc.
h = surfc(peaks)
This should say something like this:
h =
2x1 graphics array:
Surface
Contour
That's saying that h is an array of two graphics objects. The first is the surface and the second is the contour. That means that we can do things like this:
h(2).LineWidth = 4
  댓글 수: 6
Moein
Moein 2016년 1월 19일
so funny! new problem!
just one contour (the smallest one) shaped with wider curve.
other ones shaped as before. look at the attached photo.
Moein
Moein 2016년 1월 19일
at last i found the answer.following code:
T=linspace(-pi/8,pi/8,30);
R=linspace(0,1,30);
[t, r]=meshgrid(T, R);
z=(0.2079921258e1 .* (cos((4 .* t)) .^ 2 .* ((4 .* r .^ 3 - 2 .* r) .^ 2) ./ 0.144e3 + sin((4 .* t)) .^ 2 .* ((r .^ 4 - r .^ 2) .^ 2) ./ (r .^ 2) ./ 0.9e1) ./ (-0.1361305280e0 .* cos((4 .* t)) .* (r .^ 4 - r .^ 2) + 0.1e1) + 0.1e1) ./ (-0.1361305280e0 .* cos((4 .* t)) .* (r .^ 4 - r .^ 2) + 0.1e1);
[x,y,z]=pol2cart(t,r,z);
h=surfc(x,y,z,'FaceColor','interp','FaceLighting','phong');
for i=2:16
set(h(i),'LineWidth',2)
end
thank you very much Mike for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by