How to contour plot over large negative and positive values?

4 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by