0

I'm trying to increase the density of hatch marks I have for a map. This is how I'm currently doing it and I can't get anything to show up on my map when it should. I want to contour values less than 0.05 (sig p-valuea). And repeating the type of hashing I want doesn't help with the problem.

levels = [spnewdata[:,:,1].min(), 0.05] cs1 = plt.contour(x, y, spnewdata[:,:,1],levels=levels, colors='none', hatch='X', alpha=0)

Edit: Here's a little more complete form of the code I'm using to make the maps. I've tried both plt.contour and plt.contourf and neither work. However I do know there should be values under 0.05 in the data, so I know that is not the issue here.

import matplotlib as mpl
import matplotlib.pylab as plt

plt.figure(1,figsize=(10, 8))
 # Setting a cylindrical coordinate map
 map = Basemap(projection='cyl',\
        llcrnrlat=LLlat,urcrnrlat=URlat,\
        llcrnrlon=LLlon,urcrnrlon=URlon,\
        rsphere=6371200.,resolution='i')
map.drawcoastlines(linewidth=0.5) # Draw some coastlines
lons,lats = map(lon,lat) # Setting up the grid in cylindrical coords.
cs = plt.contourf(lons,lats,spnewdata[:,:,0],np.arange(-.3,.4,.1),cmap=plt.cm.RdYlBu, extend='both')
x, y =(lons, lats)

levels = [spnewdata[:,:,1].min(), 0.05]
cs1 = plt.contour(x, y, spnewdata[:,:,1],levels=levels, colors='none', hatch='X', alpha=0)`
Alex Morrison
  • 149
  • 1
  • 13
  • From the documentation [here](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html#matplotlib.pyplot.contour) it seems hatching is supported only for `contourf` and that too only for PostScript, PDF, SVG and Agg backends. So, can you please post a more complete code to reproduce the issue? Also mention the backend that you are using. –  Dec 19 '17 at 05:13
  • Check if your `spnewdata[:,:,1].min()` is actually < 0.05 – VBB Dec 19 '17 at 05:16
  • It has values less that 0.05, so I know that is not the issue – Alex Morrison Dec 19 '17 at 05:35
  • As the first comment already says: You cannot apply hatching to `contour`, it only works for `contourf` (which is also intuitively clear, I guess). For anything else, you need to provide a [mcve], such that people can reproduce the issue. – ImportanceOfBeingErnest Dec 19 '17 at 09:20

0 Answers0