【问题标题】:Adjusting dot size in scatterplot调整散点图中的点大小
【发布时间】:2016-03-07 01:44:18
【问题描述】:

我在做

ax = df.plot(x=x_col, y=y_col, style=['o', 'rx'])

但我不喜欢数据点是大圆圈。我有数千个数据点,所以它使情节变得丑陋。知道如何使点变小,即让它们成为实际点,而不是圆圈吗?或者对这种散点图有什么替代建议?

【问题讨论】:

    标签: python pandas matplotlib plot scatter-plot


    【解决方案1】:

    DataFrame.plot()docs 包括将关键字参数传递给底层matplotlib 绘图方法的选项。如您所见here,有一个参数s 用于点大小。所以你应该能够:

    ax = df.plot(kind='scatter', x=x_col, y=y_col, style=['o', 'rx'], s=12)
    

    pandasvisualization docs 中也说明了这一点。

    【讨论】:

      【解决方案2】:

      valid matplotlib marker styles 包括; '.'(点)和','(像素)。

      所以另一种可能是:

      ax = df.plot(x=x_col, y=y_col, style=['.', 'rx'])
      

      【讨论】:

        猜你喜欢
        • 2016-08-21
        • 1970-01-01
        • 2019-11-23
        • 1970-01-01
        • 2022-01-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多