I'm trying to use a AxisSubplot
object to convert some display coordinates to real coordinates for drawing shapes onto the plot. The problem is I can't find documentation or AxisSubplot
anywhere , I see Axis but can't figure out what on earth is contained in an AxisSubplot
object.
My plot coordinates are displayed by Time x Altitude, so display wise a set may be
[ ['03:42:01', 2.3] , ['03:42:06', 3.4] , ...]
In my display function I format the axis of the subplot like so:
fig.get_xaxis().set_major_locator(mpl.dates.AutoDateLocator())
fig.get_xaxis().set_major_formatter(mpl.dates.DateFormatter('%H:%M:%S'))
Now when I want to display a polygon using for example the set above, how can I convert that date string to plot cooridnates?
points = [['03:42:01', 1], ['03:43:01', 2.1], ['03:21:01', 1]]
polygon = plt.Polygon(points)
fig.add_patch(polygon)
And of course this gives me the error ValueError: invalid literal for float(): 03:42:01
. Would anyone know how to do this? Here's an example of what the plot axis looks like: