i've been experimenting different pcolor-like methods find fastest 1 support log scaling (of y axis) , kind of image smoothing (shading or interpolation). i'm asking here make sure i'm not missing something.
the goal
the goal plot 2d array s
representing scalogram, t
array representing time samples , f
representing logarithmically sampled frequencies. shapes aren't pcolor-style material, because represent points, not bounds: s.shape == (f.size, t.size)
. ideally want method takes point coordinates, not bounds.
the result should fast enough interactive plotting sizes map(log10, s.shape)
around (3-4, 2-3).
my research far
matplotlib.image.nonuniformimage
- provides interface want, expects point coordinates
- is fast
- supports bilinear interpolation
- does not support log scales. axis ticks rescaled after call
yscale('log')
, image isn't. - uses
matplotlib.image.pcolor
internally, undocumented- the code seems show not support larger arrays
matplotlib.image.pcolorimage
similar above- has pcolor-style interface
- has same deficiencies regarding log scaling.
- uses
matplotlib.image.pcolor2
internally, undocumented- judging code not support interpolation
matplotlib.axes.axes.pcolorfast
:- for 1d point coordinates uses
pcolorimage
- for 2d point coordinates (created e.g. meshgrid) uses
quadmesh
supports log scaling.- does not support gouraud shading
- for 1d point coordinates uses
matplotlib.axes.axes.pcolormesh
seems winner far- supports gouraud shading, quite slow
- also uses
quadmesh
, not find significant speedups in pcolorfast in quadmesh case (when not using gouraud shading).
alternative approaches
an alternative use contourf
, many levels slow down too.
another possibility use nonuniformimage
or imshow
, scale coordinates , handle axis ticks manually.
Comments
Post a Comment