rotating contourf in r2014b

조회 수: 1 (최근 30일)
Venkatessh
Venkatessh 2014년 10월 20일
댓글: Weimin Zhang 2024년 7월 8일
How to rotate contours generated using contourf command in MATLAB R2014b?
rotating using get(gca, 'Children') doesn't seem to work.
  댓글 수: 1
Ben11
Ben11 2014년 10월 20일
do you mean actually rotating the data or something like 'rotate3d on'?

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

채택된 답변

Mike Garrity
Mike Garrity 2014년 10월 20일
Sean's right. The rotate command only works on a few types of objects, and you probably want to try hgtransform instead.
That would look something like this:
g = hgtransform
contourf(peaks,'Parent',g)
set(g,'Matrix',makehgtform('zrotate',pi/3))
  댓글 수: 1
Weimin Zhang
Weimin Zhang 2024년 7월 8일
The contourf plot roation works, thanks! However, after the rotation, the clabel text do not follow the contour lines's directions. Any cure?

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2014년 10월 20일
What do you mean by rotate?
>>rotate3d on
Still works.
In R2014b, contour is no longer a collection of patches but rather a contour plot object. If you look at it's properties, you might find what you want:
[c,h] = contourf(Z,10);
>> h
h =
Contour with properties:
LineColor: [0 0 0]
LineStyle: '-'
LineWidth: 0.5000
Fill: 'on'
LevelList: [-6.3605 -5.0954 -3.8302 -2.5651 -1.2999 -0.0348 1.2304 2.4955 3.7606 5.0258 6.2909]
XData: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
YData: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
ZData: [20x20 double]
Show all properties
  댓글 수: 2
Venkatessh
Venkatessh 2014년 10월 20일
Does this imply that the rotation of the contours had to be done numerically? I don't want to do it interactively such as using the
rotate3d on
since there are other plotted overlaid in the same figure.
Sean de Wolski
Sean de Wolski 2014년 10월 20일
I'm not clear on what you mean by rotating. Whether it's interactive or programmatic, the whole figure will rotate. If you mean rotate the individual color patches relative to the rest of the figure, then you might want to look into using hgtransform.

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

카테고리

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