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
python matplotlib plot 2d


source to share


No one has answered this question yet

Check out similar questions:

40
Parallel plot of coordinates in Matplotlib
sixteen
Non-linear axes for imshow in matplotlib
13
plotting a square axis with a log scale in matplotlib
3
Matplotlib - Boxplot is calculated for log10 values, but shown in logarithmic scale
2
Creating a surface mesh from cloud point data in Python
2
Matplotlib PatchCollection color palette
2
Matplotlib: how to set single axis ticks in a log chart
1
Casting columns from 2D numpy array to larger 2D array based on float array
1
Ellipses and polygons on a logarithmic scale
0
customize x and y axes of webgl surface plot in javascript



All Articles
Loading...
X
Show
Funny
Dev
Pics