How to change the contour discretization in ezcontourf
2 ビュー (過去 30 日間)
古いコメントを表示
So basically I want the plot from this
syms x1 x2
f(x1,x2) = (x1^2 + x2 - 11)^2 + (x1 + x2^2 - 7)^2
figure
ezcontourf(f)
To look like this (but using ezcontourf), and not having to explicity convert it to a matrix.
v = [0:2:10 10:10:160 160:5:175 175:2:181 200:50:500];
X1=-5:0.01:5;
X2=-5:0.01:5;
[x1,x2] = meshgrid(X1,X2);
f2 =(x1.^2 + x2 - 11).^2 + (x1 + x2.^2 - 7).^2;
figure
[c,h]=contourf(x1,x2,f2,v);
set(h,'LineStyle','none')
I found this http://www.mathworks.se/help/matlab/ref/contourgroupproperties.html, and thought maybe the 'LevelList' property could be the solution, but somehow I can't seem to get the handle of the plot returned by ezcontourf.
In summary, I want to be able to change the contour color intervals in ezcontour so that I don't loose the dynamics which can be seen by comparing the two above plots--in the ezcontour plot, the whole center seems flat, where in the second plot, defined by the intervals v, it's possible to see the center is not completely flat.
0 件のコメント
回答 (2 件)
Bruno Pop-Stefanov
2014 年 10 月 1 日
The contour graphics object will be a child of the axes. You can get the children of the axes with:
>> children = get(gca,'Children');
If there is nothing in the axes but the contour plot, then there will be only one child and you can directly do:
>> set(children,'LevelList',[0:2:10 10:10:160 160:5:175 175:2:181 200:50:500])
Adding
>> set(children,'LineStyle','none')
will give you the exact same plot.
0 件のコメント
Anthony
2014 年 10 月 12 日
I have a question to extend off of that. Say you had several ezcontour functions and you wanted to display them on the same figure with different colors for each one, how would you go about that?
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!