I'm trying to produce a plot which uses both contour and contourf where they both use the same colormap, plotting the same data. However, contourf is only used to plot data which is 'significant' in some way (using a masked array). Meanwhile, contour is used to plot all the data. The aim is to produce a plot where all the information is available, but the eye is drawn to the more important areas.
I nearly have this working as I would like, but I am finding that the color of the contour lines is slightly different from the color of the filled contours from contourf.
I'm guessing that the differences come from the fact that either the contour colors are actually half-way between the contour colors (which would make sense, as the contour lines are defined at a value, e.g. 1, 2, etc, and the filled contours are between 1 and 2, i.e. with a 'value' of 1.5 etc).
I am defining my colormap as
cmap = cm.coolwarm
cnorm=clrs.Normalize(cmap,clip=False)
cmap.set_under(color=cmap(0.0),alpha=1.0)
cmap.set_over(color=cmap(1.0),alpha=1.0)
my contour levels, used for both contour and contourf are
clevs = [-3.,-2.,-1.,1.,2.,3.]
The contour lines are plotted as
cplot=map.contour(x,y,diff,clevs,\
cmap=cmap,\
norm=cnorm,\
extend='both')
and the filled contours are plotted as
cplot=map.contourf(x,y,true_mask,clevs,cmap=cmap,\
norm=cnorm,
extend='both')
Is there a straight-forward way to have the colors of the contour lines 'match' those of the filled contours, i.e. the line at 1 is the color of the 1-2 filled contour, the line at 2 is the color of the 2-3 filled contour, the line at -1 have the color of the -2--1 filled contour etc.?
Many thanks for your help.
contourfcall with acontourcall on the same masked data but with 3x the line density or something like that. - tacaswell