How do I rotate contour plot?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 17 de Ag. de 2018
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 comentarios
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!