美文网首页
Seaborn colormap 图示

Seaborn colormap 图示

作者: mmcxz | 来源:发表于2021-12-24 12:15 被阅读0次

code

import numpy as np

from pylab import mpl,matplotlib

import matplotlib.pyplot as plt

import seaborn as sns

clist=[# colormap names]

nrows = len(clist)

fig, axes = plt.subplots(nrows=nrows)

for ax, name in zip(axes, clist):

    sns.set_palette(name)

    pal=sns.color_palette()

    n = len(pal)

    ax.imshow(np.arange(n).reshape(1, n),

              cmap=mpl.colors.ListedColormap(list(pal)),

              interpolation="nearest", aspect="auto")

    pos = list(ax.get_position().bounds)

    x_text = pos[0] - 0.01

    y_text = pos[1] + pos[3]/2.

    fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10)

    for ax in axes:

        ax.set_axis_off()

plt.show()

同色系渐变色

灰色

双色系/三色系

其他

相关文章

网友评论

      本文标题:Seaborn colormap 图示

      本文链接:https://www.haomeiwen.com/subject/nwslqrtx.html