Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How does Python use matplotlib toolkit to map the world?

Shulou Source: shulou.com Published: 2022-06-01 21:19:44 09月30日 Update

This article mainly explains "Python how to use the matplotlib toolkit to map the world", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Python how to use the matplotlib toolkit to map the world"!

1. Installation

In order to run the project smoothly, you need to install the following dependencies and enter the following command in cmd or Terminal:

Pip install numpypip install matplotlib

In order to use mpl_toolkits, simply installing matplotlib is not enough. We also need to install basemap separately. If you have already installed Anaconda, this step is very easy. Enter the following command to install it:

Conda install basemap

If not, it's a little more troublesome:

1. Install geos:

Pip install geos

two。 Download basemap based on your Python version

Http://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap

Note that the number after cp is the version of Python. (press ctrl+F on the page and enter basemap for quick positioning)

3. Go to the directory of the file under cmd and run

Pip install basemap-1.2.1-cp37-cp37m-win_amd64.whl2. Simple map

Let's start drawing an earth with the center pointing to China:

The effect is not bad, not only that, it is not just an image, it is also a fully functional matplot canvas. This means that you can draw a line on it! Let's enlarge the map, enter the Chinese area, and then mark the location of Shenzhen:

Don't use the blue background picture, it's not very clear, let's change it to an embossed one:

Thank you for your reading, the above is the content of "Python how to use the matplotlib toolkit to map the world". After the study of this article, I believe you have a deeper understanding of how Python uses the matplotlib toolkit to map the world. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Maps world maps tools toolkits learning input content commands versions China good complete not only that not enough location functions full functions regions just Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information Docker vpn NVidia