How do I plot 2 sets of contours on a single plot?

8 ビュー (過去 30 日間)
FARSHID
FARSHID 2011 年 1 月 21 日
I have following code for plotting contour lines overlap to contour shaded.
contourf(X,Z,Temp)
hold on
[c,h]=contour(X,Z,V)
clabel(c,h,'FontSize',15,'Color','k','Rotation',0)
hold off
It works but shaded contour doesn't show temperature. It shows velocity contour lines.
Can you help show these two variables on one figure?
  2 件のコメント
Todd Flanagan
Todd Flanagan 2011 年 1 月 21 日
Could you post a screen shot? You can use the <<>> tag. You can upload images to any free hosting service like photobucket or imageshack.
Selwyn
Selwyn 2012 年 2 月 17 日
Hi,
From your code it looks like you intended to plot speed contour lines - so its doing just what you wanted.
Can you perhaps let us know what you wanted in the first place?
I do know that there might be some issues which would confuse me with a plot like the way you've done. I'm mentioning them just in case you're seeing the same things.
- when you use contourf, by default Matlab adds black contour lines around each of the filled shaded sections on the plot. There is a way of removing them in a for loop but its easier to just make them dotted lines with the 'k:' like so:
contourf(X,Z,Temp,'k:')
- when you use the contour function, it doesnt by default produce black contour lines but rather, lines of specific colours that are sometimes difficult to see.
If thats whats confusing you I'd try the following:
hold on
contourf(X,Z,Temp,'r:'); % Makes the contour lines red and dotted for Temperature
contour(X,Z,V,'k'); % Makes all the contour lines black for Speed
That would produce a shaded image with red dotted contour lines for temperature and it will be overlaid with black contour lines for speed.

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

回答 (1 件)

Todd
Todd 2012 年 3 月 7 日
You can use contourf to shade without plotting isopleths by adding " 'LineColor', 'none' " (no double quotes) to the argument list.
I suspect that contour and contourf destroy preexisting colortables, and that is why the shading of temperatures is lost when wind is contoured. Matlab is primitive that way, but hey it does "sun glint"!. What might work would be the following: [ c, h ] = contour( wind ); contourf( temperature ); hold on; plot( c, 'k-' )

カテゴリ

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