How to draw a graph where curves can overlap?

I am trying to make a plot similar to this

enter image description here

Because there are curves that completely overlap each other, I love the way he puts the legends right on the curve, so he can draw so many curves without messing up, and a separate figure shows what those legends mean.

When I tried to do this plot in Matlab but I don't know how to create legends. And the double magazine with mesh is also a complete mess.

How can I make this plot using matplotlib or Matlab? Is matplotlib more flexible?

+3


source to share


1 answer


Just use annotate

it will give you 90%:

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 circles can be tricky. If you really want to use circles, I would suggest submitting a feature request to github. (Looks like digging guts into the mpl for hours to add bounding boxes).

+1


source







All Articles