【问题标题】:How can I plot something similar to this in python?如何在 python 中绘制类似的东西?
【发布时间】:2020-09-23 01:50:19
【问题描述】:

我有一些带有字符串的 (x,y) 值。例如,名为速度的数据点具有坐标 (1,1)。我想绘制与所附图片几乎相同的东西。如何在python中生成这样的图?

【问题讨论】:

    标签: python pandas matplotlib plot graph


    【解决方案1】:

    我觉得你需要matplotlib.pyplot.annotate:

    import matplotlib.pyplot as plt
    
    data = {'velocity': (1, 1), }  # data points
    
    fig, ax = plt.subplots()
    ax.scatter(*zip(*data.values()))
    ax.set_xlim(left=0, right=250)  # x axis limits
    ax.set_ylim(bottom=0, top=30)  # y axis limits
    ax.set_xlabel('μ*')  # x axis label
    ax.set_ylabel('β')  # y axis label
    
    for name, coordinates in data.items():
        ax.annotate(name, coordinates)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-26
      • 1970-01-01
      • 1970-01-01
      • 2021-07-30
      • 2020-02-04
      • 2023-03-26
      • 2023-03-18
      相关资源
      最近更新 更多