How to plot grey contour lines?

12 ビュー (過去 30 日間)
Mohammed
Mohammed 2014 年 3 月 23 日
コメント済み: Mohammed 2014 年 3 月 23 日
Hi,
I have the following code and I am trying to add a GRAY color contour line but I can't?!! Any suggestions or ideas?!
  • Hint:*I don't want to remove 'shading flat'.
F = scatteredInterpolant(Lon,Lat,EcIo,'natural','linear');
xlimit = linspace(min(Lon),max(Lon));
ylimit = linspace(min(Lat),max(Lat));
[Xq Yq] = meshgrid(xlimit,ylimit);
Vq = F(Xq,Yq);
contourf(Xq,Yq,Vq)
shading flat
colorbar('location','EastOutside')
xlabel('Longtitude','FontWeight','Bold')
ylabel('Latitude','FontWeight','Bold')

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 3 月 23 日
contourf() produces a patch() object, and the "lines" are the boundaries of faces. The appropriate control is therefore to set the EdgeColor of the patch object.
Fpatch = contourf(Xq, Yq, Vq);
set( findobj(Fpatch, '-type', 'patch'), 'EdgeColor', [128 128 128]);
the findobj() is there in case there is an hggroup wrapped around the patch (which I seem to recall there is.)
  1 件のコメント
Mohammed
Mohammed 2014 年 3 月 23 日
Thanks! I've just run the m-file again but gives me an error like below;
Error using findobj
Invalid handle
besides the line color is not gray, it is black. I want it like a picture below and smooth if possible
.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by