हाँ, पर Seaborn हार्ड-कोडेड colorbar के लिए एक रेखीय टिक लोकेटर है, तो परिणाम हो सकता है नहीं किया जा काफी क्या आप चाहते हैं:
# http://matplotlib.org/examples/pylab_examples/pcolor_log.html
# modified to use seaborn
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import numpy as np
from matplotlib.mlab import bivariate_normal
import seaborn as sns; sns.set()
N = 20
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
# A low hump with a spike coming out of the top right.
# Needs to have z/colour axis on a log scale so we see both hump and spike.
# linear scale only shows the spike.
Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
fig, axs = plt.subplots(ncols=2)
sns.heatmap(Z1, ax = axs[0])
sns.heatmap(Z1, ax = axs[1],
#cbar_kws={'ticks':[2,3]}, #Can't specify because seaborn does
norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()))
axs[0].set_title('Linear norm colorbar, seaborn')
axs[1].set_title('Log norm colorbar, seaborn')
plt.show()
pylab उदाहरण यह एक pylab संस्करण के लिए के साथ शुरू देखें कि स्वचालित रूप से रंगीन टिक लेबल लेता है (हालांकि अन्यथा सुंदर नहीं है)।
आप इसे काम करने के लिए Seaborn कोड को संपादित कर सकते हैं: अगर आप /seaborn/matrix.py में plot()
कार्यप्रणाली के साथ छेड़छाड़ (0.7.0 ver):
# Possibly add a colorbar
if self.cbar:
ticker = mpl.ticker.MaxNLocator(6)
if 'norm' in kws.keys():
if type(kws['norm']) is mpl.colors.LogNorm:
ticker = mpl.ticker.LogLocator(numticks=8)
आपको मिलता है:
मैं Seaborn GitHub पर कि सुझाव देंगे, लेकिन अगर आप यह पहले चाहते हैं, तो यह है।
सीबर्न समस्या https://github.com/mwaskom/seaborn/issues/459 यह भी ठीक करने योग्य बनाता है (एक अलग तरीका) – cphlewis
केवल एक चीज यह है कि यदि आपके कुछ मूल्य नकारात्मक हैं, तो यह एक समस्या है। हाइपरबॉलिक इनवर्क्स पाप (arcsinh) नकारात्मक और 0 मानों के लिए बेहतर काम करता है। – wordsforthewise
matplotlib में अंतर्निहित arcsinh नहीं है, लेकिन आप ऋणात्मक मानों के लिए SymLogNorm का उपयोग कर सकते हैं। सुनिश्चित नहीं है कि यह 0 के बावजूद है। https://matplotlib.org/devdocs/tutorials/colors/colormapnorms.html#sphx-glr-tutorials-colors-colormapnorms-py – wordsforthewise