フィルターのクリア

How to contour plot over large negative and positive values?

10 ビュー (過去 30 日間)
Harald Stefanitsch
Harald Stefanitsch 2018 年 8 月 7 日
回答済み: Chad Greene 2018 年 8 月 7 日
I'm trying to plot contour lines for a vorticity scalar field of a turbulent flow. However, since the values range from -1e6 to 1e6 approximately, ideally I would like a colorbar with "logarithmic" scale, however, negative values should not be logarithmic in the mathematical sense, instead they should be like a mirror of the positive values.
Consider the following contour lines
clines = [-logspace(6,1,6) 0 logspace(1,6,6)] %-1000000 -100000 ... -10 0 10 ... 1000000
If I plot them using contour, the colorbar will be linear.
Since Matlab 2018a the
set(gca,'ColorScale','log')
command works, but obviously only for the logarithmic scale in the mathematical sense (negative values approach 0)
How can I create a colorbar for my needs?

回答 (1 件)

Chad Greene
Chad Greene 2018 年 8 月 7 日
Can you simply do
contour(x,y,log(z),log(clines))

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by