Why is the "contourf" command plotting my data backwards?

1 Ansicht (letzte 30 Tage)
I have data that I would like to plot using MATLAB's "contourf" command.  However, when the data is plotted, it is reflected over the y-axis.  When I use the "contour" command, it plots normally.  Why does "contourf" plot my data backwards?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 14 Apr. 2015
This behavior is a bug that has persisted until R2014a.  With the introduction of the HG2 graphics system in R2014b, this issue has since been resolved.  Attached is a MAT file with variables that reproduce this issue.  The following example uses these variables to generate both incorrect and correct plots from the same code
>> hold on
>> contourf(xksi_mesh,yksi_mesh,strfun);
>> plot(xksi_mesh ,yksi_mesh ,'b');
Incorrect contour plot (R2014a):
Correct contour plot (R2014b):
The workaround to this issue is to use the "fliplr" command to flip all the data from right to left.  Doing so yields the correct plot in R2014a and below:
>> hold on
>> contourf(fliplr(xksi_mesh),fliplr(yksi_mesh),fliplr(strfun));
>> plot(xksi_mesh ,yksi_mesh ,'b');

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by