小编Rob*_*utt的帖子

如何使用seaborn.objects旋转xticks

碰巧,有没有办法旋转下图中的 xticks(只是为了使其更具可读性)?通常 sns.xticks()在新的 seaborn.objects 开发中不起作用(这太棒了!)

tcap.\
    assign(date_time2 = tcap['date_time'].dt.date).\
    groupby(['date_time2', 'person']).\
    agg(counts = ('person', 'count')).\
    reset_index().\
    pipe(so.Plot, x = "date_time2", y = "counts", color = "person").\
            add(so.Line(marker="o", edgecolor="w")).\
            label(x = "Date", y = "# of messages",
                  color = str.capitalize,
                  title = "Plot 2: Volume of messages by person, by day").\
            scale(color=so.Nominal(order=["lorne_a_20014", "kayla_princess94"])).\
            show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

此外,我的 x 轴是分类的,并且此警告: 使用分类单位绘制可解析为浮点数或日期的字符串列表。如果这些字符串应绘制为数字,请在绘制之前转换为适当的数据类型。出现。我尝试使用:

import warnings
warnings.filterwarnings("ignore",category=UserWarning)
Run Code Online (Sandbox Code Playgroud)

python rotation seaborn xticks seaborn-0.12.x

5
推荐指数
1
解决办法
1437
查看次数

标签 统计

python ×1

rotation ×1

seaborn ×1

seaborn-0.12.x ×1

xticks ×1