Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make a cool rolling earth with python

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report