Hello list,
Some time ago Stephane Raynaud answered my question on how to produce a
stickplot using quiver:
http://www.mail-archive.com/mat...@li.../msg15314.html
Since then, I have been forwarding that to several people interested in
producing such a plot.
Maybe it is a good idea to add an example at the Gallery with the quiver
as "stickplot"? Or it is too obvious?
Anyway, here is my suggestion:
# -*- coding: utf-8 -*-
""" Stephane Raynaud """
import matplotlib.pyplot as plt
import numpy as np
import datetime as dtime
from matplotlib.dates import date2num
""" fake dates starting now """
x = np.arange(100, 110, 0.1)
start = dtime.datetime.now()
dates = [start + dtime.timedelta(days=n) for n in range(len(x))]
""" dummy u, v """
u = np.sin(x)
v = np.cos(x)
fig, ax = plt.subplots(1, 1, figsize=(16,6))
qiv = ax.quiver(date2num(dates), [[0]*len(x)], u, v, headlength=0,
headwidth=0, headaxislength=0 )
key = ax.quiverkey(qiv, 0.25, 0.75, 0.5, "0.5 N m$^{-2}$", labelpos='N',
coordinates='axes' )
plt.setp( ax.get_yticklabels(), visible=False)
plt.gca().xaxis_date()
plt.show()
|