Python Matplotlib标签重叠,因为数据太多

Python Matplotlib标签重叠,因为数据太多,python,matplotlib,graph,jupyter-notebook,Python,Matplotlib,Graph,Jupyter Notebook,这是我在jupyter笔记本中用python语言编写的代码。 我在垂直方向上有距离,在水平方向上有时间。 当数据溢出(太多)时,水平标签相互重叠。你根本看不懂标签。我怎么能有像动态宽度的框架?或者其他解决方案也很受欢迎。多谢各位 #this code below is to append the data if i==0: time = [timetable[i][0]] else: time.append(timetable[i][0])

这是我在jupyter笔记本中用python语言编写的代码。 我在垂直方向上有距离,在水平方向上有时间。 当数据溢出(太多)时,水平标签相互重叠。你根本看不懂标签。我怎么能有像动态宽度的框架?或者其他解决方案也很受欢迎。多谢各位

    #this code below is to append the data
    if i==0:
        time = [timetable[i][0]]
    else:
        time.append(timetable[i][0])
    if timetable[i][1][:-2].lower() == 'driver':
        distances.append(0)
    elif timetable[i][1][:-2].lower() == 'rider':
        distances.append(rider_request)
    print(time, len(time))
    print(distances, len(distances))

    #dataframe for plot graph
    df=pd.DataFrame({'x': time, 'y': distances })

    # plot
    plt.plot( 'x', 'y', data=df, linestyle='-', marker='o')
    plt.show()


您可以尝试打印(df.dtypes)吗?@warped-dtype:object您可以尝试打印(df.dtypes)吗?@warped-dtype:object