当索引缺少一些值时,使用索引python seaborn绘图
我有一个数据帧如下。索引对于某些行来说是空白的。我想绘制它,而我的代码在下面
- 我正在用
Marker
挣扎,它仅出现几点 - 我如何显示所有要点? - 我如何旋转X轴标签。我尝试了我发表评论的最后一行。
lst = [5,10,8,7,8,4,6,8,9]
df = pd.dataframe(lst,index = ['a'a'','',' ','d',''','','','e','f'],列= ['names'])
df
#how to show poings with missing index and how to rotate x axis labels by 90 degree?
import seaborn as sns
#sns.set(rc = {'figure.figsize':(20,10)})
plt.figure(figsize = (20,10))
plot=sns.lineplot(data=df['Names'],marker='o')
#plot.set_xticklabels(plot.get_xticklabels(),rotation = 30)
I have a dataframe as below. Index is blank for some rows. I want to plot it and my code is as below
- i am struggling with
marker
It is appearing only for few points - how could i show all the points? - How could I rotate x axis labels. I tried the last line that i have commented.
lst = [5,10,8,7,8,4,6,8,9]
df = pd.DataFrame(lst, index =['a', '', '', 'd', '', '', '','e','f'], columns =['Names'])
df
#how to show poings with missing index and how to rotate x axis labels by 90 degree?
import seaborn as sns
#sns.set(rc = {'figure.figsize':(20,10)})
plt.figure(figsize = (20,10))
plot=sns.lineplot(data=df['Names'],marker='o')
#plot.set_xticklabels(plot.get_xticklabels(),rotation = 30)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以为X轴使用虚拟
np.arange
,然后重新标记x轴。You could use a dummy
np.arange
for the x-axis, and then relabel the x-axis.