Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib: Mpl_toolkits, AxesGrid, ImageGrid and Anaconda: How do I get these functions?

I have anaconda3 installed with matplotlib.

Only problem is, mpl_toolkits is not a recognized package. I.e., the following code does not work:

import mpl_toolkits

I have searched high and low on google for some kind of package/download/makefile/etc. way to install mpl_toolkits, AxesGrid, mpl_toolkits.axes_grid1, etc. in trying to do what is shown here.

I have run:

conda install mpl_toolkits
conda install axesgrid
conda install axes_grid1

...etc. 

I have gone to the anaconda bin folder and run:

pip install ...
etc.

How do I get this package working with python (specifically anaconda)?

like image 900
Chris Avatar asked Sep 19 '25 18:09

Chris


2 Answers

Use this:

conda activate # optional / use "source activate" in windows
conda install -c conda-forge basemap # use the -n flag for a particular environment

After that, you will get this folders:

/home/username/anaconda3/lib/python3.7/site-packages/basemap-1.2.0-py3.7.egg-info
/home/username/anaconda3/lib/python3.7/site-packages/mpl_toolkits
like image 195
Ferroao Avatar answered Sep 21 '25 10:09

Ferroao


Something went wrong; the library mpl_toolkits should be in the anaconda environment.

The bazooka to knife-fight answer to this problem is to go to github, create a user name, search for "matplotlib" in the search bar, download matplotlib source code zip file from the matplotlib project...and run:

unzip matplotlib-master.zip
cd matplotlib-master
/your/path/to/anaconda3/bin/python3 setup.py install

Then, everything works. Awesome.

like image 37
Chris Avatar answered Sep 21 '25 09:09

Chris