Reputation: 12368
I'm trying to make a plot similar to this one
Because there are curves that completely overlap each other, I like how he puts legends right on the curve, so he can plot so many curves without causing a mess, and have a separate figure shows what these legends stand for.
When I tried to make this plot in Matlab but I don't know how to make legends like this. And the double log with grid is a complete mess too.
How can I make this plot using either matplotlib or Matlab? Is matplotlib more flexible?
Upvotes: 3
Views: 484
Reputation: 87566
Just use annotate
, this should get you 90% there:
x = np.linspace(0,1000)
y = x ** -2
figure()
ax = gca()
ax.loglog(x,y)
ax.grid(True)
ax.grid(True, which='minor')
ax.annotate('a1', (x[15], y[15]),
backgroundcolor='w',
color='b',
va='center',
ha='center',
bbox=dict(boxstyle="round", color='b'),)
annotate
doc and examples. Getting the circles might be tricky. If you really want to use circles, I would suggest submitting a feature request on github. (It looks like a few hours of digging into mpl guts to add ellipse bounding boxes).
Upvotes: 1