Fastest pcolor-like method with scale scale support

I experimented with various pcolor-like methods to find the fastest one that would support log scaling (y-axis) and some image smoothing (shading or interpolation) as well. I am asking here to make sure I haven't missed something.

purpose

The goal is to construct a 2D array s

that is a scalogram, an array t

representing time samples, and f

representing the logarithmically sampled frequencies. The forms are not exactly material in pcolor style, because they are the point, not the border: s.shape == (f.size, t.size)

. Ideally, I would like a method that accepts the coordinates of the points, not the boundaries.

The result should be fast enough to interactively plot with dimensions map(log10, s.shape)

around (3-4, 2-3).

My research so far

  • matplotlib.image.NonUniformImage

    • provides exactly the interface I would like, it expects point coordinates
    • very fast
    • supports bilinear interpolation
    • does not support logarithmic scales. After the call is on yscale('log')

      , the axis ticks are rescaled, but there is no display.
    • uses matplotlib.image.pcolor

      internally, which is undocumented
      • code seems to show that it does not support large arrays
  • matplotlib.image.PcolorImage

    very similar to the above
    • has a pcolor style interface
    • has the same disadvantages in regards to log scaling.
    • uses matplotlib.image.pcolor2

      internally, which is undocumented
      • judging by the code it doesn't support interpolation
  • matplotlib.axes.Axes.pcolorfast

    :
    • for 1D coordinates of a point, use PcolorImage

    • for 2D point coordinates (generated by meshgrid for example) uses QuadMesh

      which supports log scaling.
      • does not support gouraud shading.
  • matplotlib.axes.Axes.pcolormesh

    is still the winner
    • supports gouraud shading but it is rather slow
    • also uses QuadMesh

      , I couldn't find any significant speedups in pcolorfast in the case of the ATV (unless using gouraud shading).

Alternative approaches

The alternative is to use contourf

, but with many levels it slows down as well.

Another possibility is to use NonUniformImage

or even imshow

but scale the coordinates and tick of the handle axis manually.

+3


source to share





All Articles