| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
@NickG123 Could you test if the problem is still there with Matplotlib 2.1?
On my own workstation (Fedora 26), with Python 3.6.3 and Matplotlib 2.1 (both from conda), the results are more similar to yours with Matplotlib 2.0.0 than those with Matplotlib 2.0.1:
Runtime: 2.199585437774658
744304 function calls (733696 primitive calls) in 2.669 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
2 0.703 0.352 0.703 0.352 {built-in method matplotlib._png.write_png}
6 0.520 0.087 0.521 0.087 {built-in method matplotlib._image.resample}
890 0.075 0.000 0.075 0.000 {method 'is_valid' of '_geoslib.BaseGeometry' objects}
46 0.067 0.001 0.067 0.001 {built-in method numpy.core.multiarray.copyto}
10851 0.066 0.000 0.067 0.000 {built-in method numpy.core.multiarray.array}
6 0.061 0.010 0.113 0.019 colors.py:985(__call__)
296 0.055 0.000 0.055 0.000 {method 'intersection' of '_geoslib.BaseGeometry' objects}
46/45 0.053 0.001 0.056 0.001 {built-in method _imp.create_dynamic}
2 0.053 0.026 0.082 0.041 __init__.py:14(<module>)
447 0.051 0.000 0.076 0.000 {method 'draw_path' of 'matplotlib.backends._backend_agg.RendererAgg' objects}
I did not perform a proper git bisect but this might have been fixed by @tacaswell in #8966 (more precisely 12c27f3)
@afvincent Thanks for having a look.
I do see a significant improvement in performance with Matplotlib 2.1, back down to roughly the same speed as 2.0.0.
However, the resulting image is very strage:

I do get a couple of warnings that might be related, but they are coming out of the Basemap library, not my code:
C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py:1704: MatplotlibDeprecationWarning: The axesPatch function was deprecated in version 2.1. Use Axes.patch instead. limb = ax.axesPatch C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py:1707: MatplotlibDeprecationWarning: The axesPatch function was deprecated in version 2.1. Use Axes.patch instead. if limb is not ax.axesPatch:
The fuzz over the oceans is almost certainly the same as the fuzz we saw at the edges of #8966 Trying with a lower-order interpolation might help.
Looks like that's the problem
Both interpolation='none' and interpolation='nearest' generate the expected image (the same one as version 2.0.0), while all other options produce varying degrees of "fuzz" across the whole map.
Thanks,
Nick
@NickG123 can you reproduce this with 2.2.3?
Hi @tacaswell, It looks like v2.2.3 still produces the same result as with 2.1 above.
However, my use case is satisfied by using a lower order interpolation, so I guess it is up to you how much of a priority this is.
Thanks,
Nick
I think we solved the original problem, so I'm closing, but feel free to re-open...
| Back | FazBrowse Home | New Git URL |
Bug report
Bug summary
I am using Matplotlib with Basemap to create heatmaps of data.
A change introduced between version 2.0.0 and 2.0.1 caused my code to:
The problem still seems to exist in 2.0.2.
I also ran some profiling to have a look at the differences, and the increase in time seems to be in the resample function (from 0.473s total time to 19.042s total time)
Code for reproduction
Version 2.0.0 outcome
python -m cProfile --sort=tottime script.py:
667764 function calls (659117 primitive calls) in 3.555 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 2 0.702 0.351 0.702 0.351 {matplotlib._png.write_png} 2 0.473 0.237 0.473 0.237 {matplotlib._image.resample} 1 0.138 0.138 0.138 0.138 {_tkinter.create} 890 0.117 0.000 0.117 0.000 {method 'is_valid' of '_geoslib.BaseGeometry' objects} 15 0.106 0.007 0.632 0.042 __init__.py:1(<module>) 1 0.090 0.090 0.135 0.135 __init__.py:14(<module>) 296 0.083 0.000 0.083 0.000 {method 'intersection' of '_geoslib.BaseGeometry' objects} 2 0.068 0.034 0.681 0.340 image.py:275(_make_image) 11413 0.055 0.000 0.058 0.000 {numpy.core.multiarray.array} 300 0.050 0.000 0.072 0.000 {method 'draw_path' of 'matplotlib.backends._backend_agg.RendererAgg' objects} ...Version 2.0.1 outcome
python -m cProfile --sort=tottime script.py:
1763720 function calls (1754827 primitive calls) in 23.725 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 4 19.042 4.761 19.043 4.761 {matplotlib._image.resample} 2 0.735 0.367 0.735 0.367 {matplotlib._png.write_png} 2 0.609 0.304 1.377 0.688 font_manager.py:558(createFontList) 60 0.138 0.002 0.336 0.006 afm.py:181(_parse_char_metrics) 1 0.135 0.135 0.135 0.135 {_tkinter.create} 2 0.133 0.067 19.309 9.655 image.py:275(_make_image) 890 0.115 0.000 0.115 0.000 {method 'is_valid' of '_geoslib.BaseGeometry' objects} 1 0.107 0.107 0.159 0.159 __init__.py:14(<module>) 15 0.106 0.007 0.637 0.042 __init__.py:1(<module>) 559 0.104 0.000 0.104 0.000 {method 'get_sfnt' of 'matplotlib.ft2font.FT2Font' objects}Matplotlib version