Reputation: 2679
I’m producing a fairly complex plot (a thermodynamic diagram, Emagram). I’ll try to explain my issue with Matplotlib without messing with the physics details.
There are various types of lines in this diagram I want to show which in essence relate values of Temperature vs. Pressure (in a semi logarithmic scale).
I’m now drawing a type of curve called isohume. The details are not important. In a nutshell, for a given value of r
, I numerically obtain T(P)
in both numpy arrays. I do this within a loop in the y axis, i.e. in Pressure, and then I have two numpy lists, which I draw. So far this works. I paste below the figure I get for r=0.01
.
Now, I have to add various lines for various values of r
, so I’ll do this within a loop. The problem is that I need these lines to be labelled, as otherwise they are useless. I want to add a label r=0.01
In the upper x axis in the coordinates (x = T(200), y = 200)
, which I have already calculated. I just don’t know how to command matplotlib to put a tick in that location with that label. I have hand written the desired output.
Any help?
Upvotes: 1
Views: 297
Reputation: 21
I realize this is a broad answer, but there is an annotation tutorial in the matplotlib documentation. click here
But here is a general line of code:
ax.annotate('local max', xy=(3, 1), xycoords='data',
xytext=(0.8, 0.95), textcoords='axes fraction',
arrowprops=dict(facecolor='black', shrink=0.05),
horizontalalignment='right', verticalalignment='top',
)
Upvotes: 1