Contour is plotting my data in reflected order?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Amanda Liu
am 17 Jun. 2021
Kommentiert: Amanda Liu
am 17 Jun. 2021
I'm using flip to solve this but is this intentional?
2 Kommentare
Akzeptierte Antwort
Joseph Cheng
am 17 Jun. 2021
Bearbeitet: Joseph Cheng
am 17 Jun. 2021
From a quick test you might not be asigning the x and y values when performing your contour() function. by doing so matlab will automatically assign the row and column indexing to match the matrix. So in your example your max data is at the bottom row which is technically the higher value in cartesian coordinates of row 10 (ie y axis 10). you can get around this by defining your x and y values to plot against.
so matrix position (1,1) (row 1, column 1) is top left, but when displayed it'll be bottom left.
%dummy data
[x y]=meshgrid(-5:1:5,-5:1:5);
z = x+(2*y+4).^2;
% plot with just z and then specifying the rows and columns of the matrix z
figure(1),subplot(211),contour(z),colorbar
title('original contour')
subplot(212),contour(-5:1:5,5:-1:-5,z),colorbar
5 Kommentare
Joseph Cheng
am 17 Jun. 2021
so then it would mean that the first row would be denoted at y values of 0 and the last row would be H which i'm assuming here is a positive value. which is why it plots flipped.
Weitere Antworten (1)
Steven Lord
am 17 Jun. 2021
Are you trying perhaps to put the contour plot on top of another graphics object, an image perhaps or maybe a pcolor? If so, see the "Change Direction of Coordinate System" example on the documentation page for the axis function.
Siehe auch
Kategorien
Mehr zu Contour Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!