Make pandas plot() show xlabel and xvalues

后端 未结 2 1226
不思量自难忘°
不思量自难忘° 2021-01-22 16:52

I am using the standard pandas.df.plot() function to plot two columns in a dataframe. For some reason, the x-axis values and the xlabel are not visible! There seem

2条回答
  •  我在风中等你
    2021-01-22 17:43

    Create your axes instance first and then send it as an argument to the plot()

    import matplotlib.cm as cm
    import pandas as pd
    
    
    X = np.random.rand(10,3)
    df = pd.DataFrame(X,columns=['t','hlReference', 'STEP_STRENGTH'])
    fig,ax1=plt.subplots()
    df.plot.scatter(x='t', y='hlReference', c='STEP_STRENGTH', cmap=cm.autumn,ax=ax1)
    

提交回复
热议问题