I'm using this script to plot a Ramachandran plot (the kind of plot is not really relevant here, what matters is the outputted graph):
#!/usr/bin/python
# coding: utf-8
"""
Script to plot a heat map of the dihedral angles
http://stackoverflow.com/questions/26351621/turn-hist2d-output-into-contours-in-matplotlib
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
# print(sys.argv[1])
frame, x, y = np.loadtxt(sys.argv[1], unpack=True)
fig = plt.figure(1)
ax = plt.subplot(111)
counts, ybins, xbins, image = plt.hist2d(x, y, bins=180, norm=LogNorm())
plt.clf()
plt.contourf(counts.transpose(), 10, extent=[xbins.min(),xbins.max(),ybins.min(),ybins.max()])
plt.colorbar()
fig.set_size_inches(30, 20)
plt.savefig(sys.argv[1], bbox_inches='tight')
And here is what I obtain:
That's almost what I want. I would like the first level (0-15 on the color bar), which appears in the darkest purple, to appears white on the graph.
Can it be done ?