【问题标题】:Matplotlib y axis value not show my data? [duplicate]Matplotlib y 轴值不显示我的数据? [复制]
【发布时间】:2021-08-25 04:47:11
【问题描述】:

在我的数据集中,我有一个像这样的薪水列

array([[  45000],
   [  50000],
   [  60000],
   [  80000],
   [ 110000],
   [ 150000],
   [ 200000],
   [ 300000],
   [ 500000],
   [1000000]], dtype=int64)

当我尝试使用 scatter 进行绘制时,输出如图所示。

plt.scatter(features,label)

我的预期是这样的。

我是初学者。请解决我的困惑。

【问题讨论】:

    标签: python dataframe matplotlib plot scatter-plot


    【解决方案1】:

    已回复here

    from pylab import *
    
    plt.scatter([0,1,2,3,4,5],[10001,10002,10003,10004,10005,10006]);
    gca().yaxis.set_major_formatter(mpl.ticker.StrMethodFormatter('{x:,.0f}'))
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-14
      • 2020-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 2019-05-27
      • 2018-06-12
      相关资源
      最近更新 更多