Reputation: 73
I have some (x,y) values with a string. For example data point named velocity has coordinates (1,1). I want to plot something almost identical to the picture attached. How to generate such a graph in python?
Upvotes: 1
Views: 60
Reputation: 544
I think you need 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)
Upvotes: 1