mplleaflet
mplleaflet copied to clipboard
_gridOnMajor bug with recent versions of Matplotlib
After upgrading to Matplotlib 3.3.3, the following error appears when trying to use mplleaflet:
'XAxis' object has no attribute '_gridOnMajor
The problem comes from mplexporter and was corrected in mpld3's mplexporter (see https://github.com/mpld3/mpld3/issues/479) but the correction has not been propagated to the version of mplexporter used by mplleaflet.
I run into similar error. any workaround please?
I run into similar error. any workaround please?
The easiest workaround is probably to use an earlier version of Matplotlib (although I am not certain of the exact version number at which the bug started to occur).
The other workaround (that I implemented) was to make mplleaflet use the updated mplexporter module (from mpld3), not the older version currently used my mplleaflet. I had to modify two lines of code in mplleaflet (to transform local mplexporter imports into external imports) and pip install mplexporter as an external package. This works very well, and I can provide some details on how to do this if necessary ...
... of course, it would be better to update mplleaflet directly, but I stuggled with the git-submodule/makefile system and could not find an easy way to submit a straighforward pull request.
I run into similar error. any workaround please?
The easiest workaround is probably to use an earlier version of Matplotlib (although I am not certain of the exact version number at which the bug started to occur).
The other workaround (that I implemented) was to make mplleaflet use the updated mplexporter module (from mpld3), not the older version currently used my mplleaflet. I had to modify two lines of code in mplleaflet (to transform local mplexporter imports into external imports) and pip install mplexporter as an external package. This works very well, and I can provide some details on how to do this if necessary ...
... of course, it would be better to update mplleaflet directly, but I stuggled with the git-submodule/makefile system and could not find an easy way to submit a straighforward pull request.
Thanks @ovinc for your response. I will appreciate it more if you can provide details on the second workaround (using mplexporter module).
Regards
Ok, basically the workaround consists in installing separately mplexporter and my forked version of mplleaflet. Here is how to achieve this:
Option A: using git
Download into your folder of choice my forked version of mplleaflet, with modifications on the dev
branch:
git clone https://github.com/ovinc/mplleaflet.git
cd mplleaflet
git checkout dev
Still from the mplleaflet directory, activate the mplexporter submodule:
git submodule init
git submodule update
Again from the mplleaflet directory, install the mplexporter submodule, then mplleaflet:
pip install ./mplexporter
pip install .
Option B: without using git
-
Go to https://github.com/ovinc/mplleaflet, select the
dev
branch instead ofmaster
in the top left menu, then use the "download code" to download the ZIP file of the code. Unzipping should produce amplleaflet-dev
directory. -
Go to https://github.com/mpld3/mplexporter, download the code of the
master
branch and unzip it. This creates amplexporter
directory. -
In a console,
cd
intomplexporter
and runpip install .
-
Then,
cd
intomplleaflet-dev
and runpip install .
After these steps, you should be able to use mplleaflet in python with recent versions of matplotlib.
(Note: this could be simpler using makefile to activate and install the submodule, but I had trouble with this process on my machine, this is why I'm proposing the longer steps above).
Ok, basically the workaround consists in installing separately mplexporter and my forked version of mplleaflet. Here is how to achieve this:
Option A: using git
Download into your folder of choice my forked version of mplleaflet, with modifications on the
dev
branch:git clone https://github.com/ovinc/mplleaflet.git cd mplleaflet git checkout dev
Still from the mplleaflet directory, activate the mplexporter submodule:
git submodule init git submodule update
Again from the mplleaflet directory, install the mplexporter submodule, then mplleaflet:
pip install ./mplexporter pip install .
Option B: without using git
- Go to https://github.com/ovinc/mplleaflet, select the
dev
branch instead ofmaster
in the top left menu, then use the "download code" to download the ZIP file of the code. Unzipping should produce amplleaflet-dev
directory.- Go to https://github.com/mpld3/mplexporter, download the code of the
master
branch and unzip it. This creates amplexporter
directory.- In a console,
cd
intomplexporter
and runpip install .
- Then,
cd
intomplleaflet-dev
and runpip install .
After these steps, you should be able to use mplleaflet in python with recent versions of matplotlib.
(Note: this could be simpler using makefile to activate and install the submodule, but I had trouble with this process on my machine, this is why I'm proposing the longer steps above).
Thank you
I will try and revert back to if need be
I run into similar error. any workaround please?
The easiest workaround is probably to use an earlier version of Matplotlib (although I am not certain of the exact version number at which the bug started to occur).
Downgrading with pip install matplotlib==3.3.2
fixed it for me.
I am also having the same probelm.
Have the same issue, but downgrading to matplotlib 3.3.2 did not fix the problem for me.
I am having the same problem, and downgrading did work