2015-10-07 19 views
6

プロットの色を指定できますが、Seabornはプロット中に色を少し消音します。この動作をオフにする方法はありますか?Seaborn:正確な色を指定

例:

import matplotlib 
import seaborn as sns 
import numpy as np 

# Create some data 
np.random.seed(0) 
x = np.random.randn(100) 

# Set the Seaborn style 
sns.set_style('white') 

# Specify a color for plotting 
current_palette = matplotlib.colors.hex2color('#86b92e') 

# Make a plot 
g = sns.distplot(x, color=current_palette) 

Histogram with muted color

# Show what the color should look like 
sns.palplot(current_palette) 

What the color should look like

私は色やSeabornで利用可能なすべてのスタイルを指定するいくつかの方法を試してみましたが、何も働いていません。私はiPythonノートブックとPython 2.7を使用しています。

+1

'kde_kws' /' hist_kws'を指定しようとしましたか? https://web.stanford.edu/~mwaskom/software/seaborn/generated/seaborn.distplot.html – Caramiriel

+0

plotコマンドを次のように変更しました: 'g = sns.distplot(x、hist_kws = {" alpha " :1、 "color":current_palette}) ' 素晴らしいです!ありがとう! – JoshuaA

答えて

2

seaborn.distplotあなたはスタイリング(*_kws)のために異なるパラメータを渡すことができます。各プロット関数には独自のパラメータがあり、プロットの名前の前にプレフィックスが付けられます。例えば。ヒストグラムはhist_kwsです。 [distplot Reference]

ヒストグラムプロットはmatplotlibにあるため、渡すことができるキーワードパラメータを調べる必要があります。すでに分かっているように、 'alpha'キーワードパラメータを渡すと、ラインの透明性を取り除くことができます。他の引数については、参考文献を参照してください(kwargsセクション)。 [pyplot Reference]

関連する問題