2015-12-03 2 views
1

Я попытался violin участок в Сиборн с различными цветами для каждой скрипки, как:набор цветов для каждой скрипки скрипки участка

sns.violinplot(x='type', y='den', data=mydf, ax=axes[0], color=['red','blue','yellow']) 

однако я получил:

ValueError: to_rgb: Invalid rgb arg "('red', 'blue', 'yellow')" could not convert string to float: red

ответ

3

Я думаю, вы должны использовать palette ключевое слово:

color : matplotlib color, optional

Color for all of the elements, or seed for light_palette() when using hue nesting.

palette : seaborn color palette or dict, optional

Colors to use for the different levels of the hue variable. Should be something that can be interpreted by color_palette(), or a dictionary mapping hue levels to matplotlib colors.

import seaborn as sb 
import numpy as np 

data = np.random.random([100,4]) 

sb.violinplot(data=data, palette=['r','g','b','m']) 

enter image description here

+0

спасибо. понял. –