matplotlib scatterplot x axis labels

后端 未结 2 1035
旧时难觅i
旧时难觅i 2020-12-06 05:49

When I\'m adding the c option to a scatterplot in matplotlib, the x axis labels dissapear. Here\'s an example: https://github.com/Kornel/scatterplot-matplotlib/blob/master/S

相关标签:
2条回答
  • 2020-12-06 06:02

    If you are using Anaconda, installing pandas with conda-forge channel resolves the issue.

    conda install -c conda-forge pandas
    

    0 讨论(0)
  • 2020-12-06 06:03

    That looks like a strange bug with pandas plotting to me! Here's a way around it:

    fig, ax = plt.subplots()
    df.plot(kind='scatter',x='X', y='Y', c='C', ax=ax)
    ax.set_xlabel("X")
    plt.show()
    

    This will give you the graph you expect:

    0 讨论(0)
提交回复
热议问题