On 1 November 2013 13:55, Jule <Ri...@gm...> wrote:
> Hey guys,
>
> I have a question regarding my plot.
> <http://matplotlib.1069221.n5.nabble.com/file/n42446/seaice.png>
> I want to plot seaice thickness distribution. The data is derived from a
> model run using an unstructured grid. To plot data on a map I use
> Triangulation and tricontourf. The problem I´m facing now is, that due to
> the triangulation my data is interpolated, resulting in an ocean covered by
> a thin layer of sea ice everywehere, which is unrealistic! So my question
> is, is there a way to limit the interpolation to the maximum extend of my
> data? I did a plot with MATLAB just to let you know how it should look
> like.
> <http://matplotlib.1069221.n5.nabble.com/file/n42446/ice_thick_N.jpg>
>
> My code looks like this so far:
>
> triang = tri.Triangulation(x,y)
> fig = plt.figure()
> plt.tricontourf(triang, ee, levels = levs, extend = 'both')
> cbar=plt.colorbar(orientation = 'horizontal', ticks=[0, 1, 2, 3, 4])
> cbar.set_label('Seaice thickness [m]', size=20,fontname='Arial')
> fc=map.fillcontinents(color = 'grey')
>
> Since I´m a beginner I would really appreciate any thoughts and
> suggestions!
> Thanks!
>
Try the following two changes, they should give you what you want.
1) Don't use extend='both' in your tricontourf call. This is explicitly
asking for all areas below 0 (your lowest level) to be coloured dark blue.
Use extend='max' instead to ignore areas that are below your lowest level.
2) Change your lowest level. It looks like you are using levs=[0.0, 0.5,
1.0, etc. The lowest levels that are contoured are therefore where z >=
0.0 and z < 0.5. This obviously includes all your non-sea ice areas as
they have z = 0.0. Change your first value in levs to be something
slightly greater than zero, e.g. 1e-10.
By the way, your question is slightly confusing as you talk about
interpolation, which has nothing to do with what you are seeing!
Ian
|