Error using submodule without import
This may not be the best MWE, but I'm not sure if this is a specific problem, or if I Just don't understand the basics.this works:
import matplotlib as mpl
import matplotlib.backends.backend_tkcairo as tkcairo
fig=mpl.figure.Figure()
canvas=tkcairo.FigureCanvasTkCairo(fig)
I think this should also work:
import matplotlib as mpl
fig=mpl.figure.Figure()
canvas=mpl.backends.backend_tkcairo.FigureCanvasTkCairo(fig)
but it doesn't (Module 'matplotlib' has no attribute 'figure').Why this doesn't work and why the errors related to mpl.figure.Figure() don't differ between the two MWEs?
uj5u.com enthusiastic netizens replied:
matplotlib
submodules will not be imported automatically font>figure
or submodule backends
, but backends.backend_tkcairo
Importfigure
.
Just importing a module does not necessarily mean that all submodules will follow.It depends on how these are written.
In this case, it is better to explicitly import the submodules you need.
order lipitor 80mg without preion & lt;a href="https://lipiws.top/"& gt;lipitor 20mg for sale& lt;/a& gt; buy atorvastatin 10mg generic
Bwlzeu
2024-03-10