用 Seaborn 强调网格线
Emphasize on line of the grid with Seaborn
我正在使用 Seaborn 绘制小提琴图(如下图所示):
我想强调y轴上0级的那条线(Comparison_perc)然后稍微做一下bigger/darker.
你知道怎么做吗?
非常感谢,
纪尧姆
我相信您可以使用 axhline() 添加一条水平线,例如
#Import libraries
import seaborn as sns
import matplotlib.pyplot as plt
#Load example dataset
dataset = sns.load_dataset("iris")
#Create graph
graph = sns.barplot(x="sepal_width", y="petal_width", data=dataset)
#Draw a horizontal line at 0
graph.axhline(y=0)
#Show plot
plt.show()
您可以更改 color/thickness 等,例如graph.axhline(y=0, linewidth=4, color='r')
我正在使用 Seaborn 绘制小提琴图(如下图所示):
我想强调y轴上0级的那条线(Comparison_perc)然后稍微做一下bigger/darker.
你知道怎么做吗?
非常感谢,
纪尧姆
我相信您可以使用 axhline() 添加一条水平线,例如
#Import libraries
import seaborn as sns
import matplotlib.pyplot as plt
#Load example dataset
dataset = sns.load_dataset("iris")
#Create graph
graph = sns.barplot(x="sepal_width", y="petal_width", data=dataset)
#Draw a horizontal line at 0
graph.axhline(y=0)
#Show plot
plt.show()
您可以更改 color/thickness 等,例如graph.axhline(y=0, linewidth=4, color='r')