How to make a cool rolling earth with python
This article mainly explains "how to make a cool rolling earth with python". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use python to make a cool rolling earth".
The method is relatively simple, first install the pyecharts==1.7.1 version, and under the jupyter notebook editor, enter the following code:
Import pyecharts.options as opts from pyecharts.charts import MapGlobe from pyecharts.faker import POPULATION data = [x for _, x in policy [1:]] low, high = min (data), max (data) c = (MapGlobe (init_opts=opts.InitOpts ()) .add _ schema () .add (maptype= "world", series_name= "World Population", data_pair=POPULATION [1:], is_map_symbol_show=False Label_opts=opts.LabelOpts (is_show=False),) .set _ global_opts (visualmap_opts=opts.VisualMapOpts (min_=low, max_=high, range_text= ["max", "min"], is_calculable=True, is_piecewise=True, range_color= ["lightskyblue", "yellow", "orangered"] )) c.render_notebook ()
In order to be able to make the earth you like, here is a detailed introduction to the meaning of the key parameters:
1.POPULATION
What is imported is the population of countries around the world, so different colors on the earth represent the number of people in each country, and you can also import other data according to your preferences.
2.theme
You can import different topics, and the topic types are as follows:
Themes = [('chalk',' chalk style'), ('dark',' Dark Wind'), ('essos',' Essos mainland'), ('infographic',' infographic'), ('light',' bright style'), ('macarons',' macaron'), ('purple-passion',' purple passion'), ('roma',' pomegranate'), ('romantic'') 'romantic wind'), ('shine',' sparkling wind'), ('vintage',' retro wind'), ('walden',' Walden'), ('westeros',' Westeros continent'), ('white',' white wind'), ('wonderland',' Wonderland')]
Change the dark wind to the earth:
3.LabelOpts
Display the map label, change False to True, and the name of the country is displayed, as shown below:
4.maptype
Change the map range, change world to china;, or make a map of the earth that shows only Beijing and other provinces and cities.
Thank you for your reading, the above is the content of "how to make a cool rolling earth with python". After the study of this article, I believe you have a deeper understanding of how to use python to make a cool rolling earth, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!