Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_gridOnMajor bug with recent versions of Matplotlib #75

Open
ovinc opened this issue Dec 12, 2020 · 9 comments
Open

_gridOnMajor bug with recent versions of Matplotlib #75

ovinc opened this issue Dec 12, 2020 · 9 comments

Comments

@ovinc
Copy link

ovinc commented Dec 12, 2020

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 mpld3/mpld3#479) but the correction has not been propagated to the version of mplexporter used by mplleaflet.

@Mumlas
Copy link

Mumlas commented Dec 28, 2020

I run into similar error.
any workaround please?

@ovinc
Copy link
Author

ovinc commented Dec 28, 2020

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.

@Mumlas
Copy link

Mumlas commented Dec 28, 2020

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

@ovinc
Copy link
Author

ovinc commented Dec 29, 2020

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 of master in the top left menu, then use the "download code" to download the ZIP file of the code. Unzipping should produce a mplleaflet-dev directory.

  • Go to https://github.com/mpld3/mplexporter, download the code of the master branch and unzip it. This creates a mplexporter directory.

  • In a console, cd into mplexporter and run pip install .

  • Then, cd into mplleaflet-dev and run pip 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).

@Mumlas
Copy link

Mumlas commented Dec 29, 2020

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 of master in the top left menu, then use the "download code" to download the ZIP file of the code. Unzipping should produce a mplleaflet-dev directory.
  • Go to https://github.com/mpld3/mplexporter, download the code of the master branch and unzip it. This creates a mplexporter directory.
  • In a console, cd into mplexporter and run pip install .
  • Then, cd into mplleaflet-dev and run pip 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

@mattgoh
Copy link

mattgoh commented Dec 30, 2020

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.

@bprasad26
Copy link

I am also having the same probelm.

@Yasharesk
Copy link

Have the same issue, but downgrading to matplotlib 3.3.2 did not fix the problem for me.

@rmoglen
Copy link

rmoglen commented Aug 12, 2021

I am having the same problem, and downgrading did work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants