У меня есть этот код
#plot < /p>
# Define a custom palette for the strains
custom_palette = {
'H9CK': 'green',
'H9RT': 'blue',
'H9TK': 'red',
'H9WD': 'orange'
}
# Define a custom hatching pattern for each strain
hatch_patterns = {
'H9CK': '//', # Diagonal lines
'H9RT': '\\\\', # Opposite diagonal lines
'H9TK': '--', # Horizontal dashes
'H9WD': 'xx' # Cross hatching
}
# Plot
plt.figure(figsize=(10, 6))
boxplot = sns.boxplot(
data=subset_df,
x='dpi',
y='ΔΔCt',
hue='strain',
palette=custom_palette,
showfliers=False
)
# Add hatching patterns to the boxes
for i, patch in enumerate(boxplot.patches):
# Determine the strain for the current box
strain = subset_df['strain'].unique()[i % len(hatch_patterns)]
patch.set_hatch(hatch_patterns[strain])
# Add labels and title
plt.title('Boxplot of ΔΔCt by dpi and strain')
plt.xlabel('DPI (Days post-infection)')
plt.ylabel('ΔΔCt')
# Move the legend to the upper right corner
plt.legend(title='Strain', loc='upper right', bbox_to_anchor=(1.05, 1), borderaxespad=0.)
# Adjust layout
plt.tight_layout()
# Show the plot
plt.show()
< /code>
, который дает мне такого рода сюжеты Введите описание изображения здесь
Почему и как исправить, что шаблон отличается в день дня 1? < /p>
Спасибо всем! < /p>
Я хочу>
Подробнее здесь: https://stackoverflow.com/questions/793 ... ch-pattern
Проблема с коробкой SNS и шаблоном люка ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение