How do I rotate contour plot?
조회 수: 14 (최근 30일)
이전 댓글 표시
I want this contour image to have the wake moving from left to right with y, along the x axis, and conversely x along y. I've managed to change the axis but can't get the image to rotate appropriately any ideas?
댓글 수: 2
답변 (1개)
Star Strider
2018년 8월 17일
It would help to know how you calculated your data, and what you’re plotting. Rotating the plot might be as simple as reversing the order of your independent variable matrices, and either transposing ‘Z’ or letting contourf default to the correct orientation.
Example —
x = linspace(0, 0.35, 75); % Create Data
y = linspace(0, 0.2, 50); % Create Data
[X,Y] = meshgrid(x,y); % Create Data
Z = sin(X*3*pi) .* exp(-0.5*Y); % Create Data
figure(1)
contourf(x, y, Z) % ‘Normal’ Orientation (Vectors)
colorbar
figure(2)
contourf(X, Y, Z) % ‘Normal’ Orientation (Matrices)
colorbar
figure(3)
contourf(y, x, Z') % ‘Rotated’ Orientation (Vectors)
colorbar
figure(4)
contourf(Y, X, Z) % ‘Rotated’ Orientation (Matrices)
colorbar
I use meshgrid here. It produces different output matrices from those ndgrid would produce, so you may need to experiment with this if you used other functions.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!