JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

warning message: `@pyimport foo` is deprecated in favor of `foo = pyimport("foo")` #429

Closed cwb0 closed 5 years ago

cwb0 commented 5 years ago

For some time I'v got the following warning message: Warning: @pyimport foo is deprecated in favor of foo = pyimport("foo"). │ caller = _pywrap_pyimport(::PyObject) at PyCall.jl:400 └ @ PyCall C:\Users\Carsten.julia\packages\PyCall\RQjD7\src\PyCall.jl:400 after importing: @pyimport matplotlib.patches as patch. This is needed to draw filled rectangle.

stevengj commented 5 years ago

This is not bug in PyPlot, it is a problem in your code: as the deprecation message says, just do

patch = pyimport("matplotlib.patches").

If you are using PyPlot already, you can also access this module as:

using PyPlot
patches = PyPlot.matplotlib.patches