简体   繁体   English

删除 matplotlib seaborn 点图中的垂直线

[英]Remove vertical lines in matplotlib seaborn pointplots

I have a problem with my Pointplot styling in seaborn and tried eveything to fix it but nothing seems to work.我在 seaborn 中的 Pointplot 样式有问题,并尝试了一切来修复它,但似乎没有任何效果。 You can see my original dataframe below你可以在下面看到我原来的dataframe

    year  künstliche intelligenz   ki  artificial intelligence  ai
0   2000                      28   16                        4   0
1   2001                       0    0                        0   0
2   2002                       0    0                        0   0
3   2003                       4    0                        0   0
4   2004                       0    0                        0   0
5   2005                       0    0                        0   0
6   2006                       8    0                        0   0
7   2007                      12    0                        0   0
8   2008                       0    0                        0   0
9   2009                       0    0                        0   0
10  2010                       4    0                        0   0
11  2011                       4    0                        0   0
12  2012                       4    0                        0   0
13  2013                       4    0                        0   0
14  2014                      12    0                        0   0
15  2015                      48   24                        8  48
16  2016                      88   92                        8   4
17  2017                      96   48                        0   0
18  2018                     124  124                        4   0
19  2019                      84  292                        0   0
20  2020                      28    8                        0   0

on this DF I run these commands and get the resulting graph below在这个 DF 上,我运行这些命令并得到下面的结果图

data = data.melt('year', var_name='cols', value_name='vals')

fig, ax = plt.subplots(figsize=(6.3792, 6.3792))
sns.pointplot(x="year", y="vals", hue='cols', data=data, colors=sns.color_palette('colorblind'), scale=0.4,
                 ci=None)
ax.set(yscale='log')
ax.yaxis.set_major_formatter(mpl.ticker.ScalarFormatter())
ax.set_yticks([1, 2, 4, 8, 16, 32, 64, 128, 256, 512])
ax.set_xticklabels(ax.get_xticklabels(), rotation=30)
plt.show()

在此处输入图像描述

my problem are the vertical lines to the X-Axis at the beginning and end of a point series.我的问题是点系列开始和结束处的 X 轴垂直线。
Is there a way to remove these vertical lines?有没有办法去除这些垂直线?

Those vertical lines represent confidence levels , as stated in docs for sns.pointplot .这些垂直线代表置信水平,如sns.pointplot文档中所述。 If you don't want to show them in the chart, take a look at sns.lineplot .如果您不想在图表中显示它们,请查看sns.lineplot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM