{
"cells": [
{
"cell_type": "markdown",
"id": "eddb05dc",
"metadata": {},
"source": [
"(plotly:basic-charts/filled-area-plots)=\n",
"# Plotly 填充区域 plot\n",
"\n",
"参考:[Filled Area Plots | Python | Plotly](https://plotly.com/python/filled-area-plots/)\n",
"\n",
"如何在 Python 中使用 Plotly 绘制填充区域图。\n",
"\n",
"## 使用 `plotly.express` 填充 plot\n",
"\n",
"[](plotly:plotly-express) 是 Plotly 的易于使用的高级接口,它 [操作各种类型的数据](plotly:px-arguments) 并产生 [易于样式的图形](plotly:styling-plotly-express)。\n",
"\n",
"`px.area` 创建一个堆叠的区域 plot。每个填充区域对应于 `line_group` 参数给出的列的一个值。"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e8dca762",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "continent=Asia
country=Afghanistan
year=%{x}
pop=%{y}
country=Bahrain
year=%{x}
pop=%{y}
country=Bangladesh
year=%{x}
pop=%{y}
country=Cambodia
year=%{x}
pop=%{y}
country=China
year=%{x}
pop=%{y}
country=Hong Kong, China
year=%{x}
pop=%{y}
country=India
year=%{x}
pop=%{y}
country=Indonesia
year=%{x}
pop=%{y}
country=Iran
year=%{x}
pop=%{y}
country=Iraq
year=%{x}
pop=%{y}
country=Israel
year=%{x}
pop=%{y}
country=Japan
year=%{x}
pop=%{y}
country=Jordan
year=%{x}
pop=%{y}
country=Korea, Dem. Rep.
year=%{x}
pop=%{y}
country=Korea, Rep.
year=%{x}
pop=%{y}
country=Kuwait
year=%{x}
pop=%{y}
country=Lebanon
year=%{x}
pop=%{y}
country=Malaysia
year=%{x}
pop=%{y}
country=Mongolia
year=%{x}
pop=%{y}
country=Myanmar
year=%{x}
pop=%{y}
country=Nepal
year=%{x}
pop=%{y}
country=Oman
year=%{x}
pop=%{y}
country=Pakistan
year=%{x}
pop=%{y}
country=Philippines
year=%{x}
pop=%{y}
country=Saudi Arabia
year=%{x}
pop=%{y}
country=Singapore
year=%{x}
pop=%{y}
country=Sri Lanka
year=%{x}
pop=%{y}
country=Syria
year=%{x}
pop=%{y}
country=Taiwan
year=%{x}
pop=%{y}
country=Thailand
year=%{x}
pop=%{y}
country=Vietnam
year=%{x}
pop=%{y}
country=West Bank and Gaza
year=%{x}
pop=%{y}
country=Yemen, Rep.
year=%{x}
pop=%{y}
country=Albania
year=%{x}
pop=%{y}
country=Austria
year=%{x}
pop=%{y}
country=Belgium
year=%{x}
pop=%{y}
country=Bosnia and Herzegovina
year=%{x}
pop=%{y}
country=Bulgaria
year=%{x}
pop=%{y}
country=Croatia
year=%{x}
pop=%{y}
country=Czech Republic
year=%{x}
pop=%{y}
country=Denmark
year=%{x}
pop=%{y}
country=Finland
year=%{x}
pop=%{y}
country=France
year=%{x}
pop=%{y}
country=Germany
year=%{x}
pop=%{y}
country=Greece
year=%{x}
pop=%{y}
country=Hungary
year=%{x}
pop=%{y}
country=Iceland
year=%{x}
pop=%{y}
country=Ireland
year=%{x}
pop=%{y}
country=Italy
year=%{x}
pop=%{y}
country=Montenegro
year=%{x}
pop=%{y}
country=Netherlands
year=%{x}
pop=%{y}
country=Norway
year=%{x}
pop=%{y}
country=Poland
year=%{x}
pop=%{y}
country=Portugal
year=%{x}
pop=%{y}
country=Romania
year=%{x}
pop=%{y}
country=Serbia
year=%{x}
pop=%{y}
country=Slovak Republic
year=%{x}
pop=%{y}
country=Slovenia
year=%{x}
pop=%{y}
country=Spain
year=%{x}
pop=%{y}
country=Sweden
year=%{x}
pop=%{y}
country=Switzerland
year=%{x}
pop=%{y}
country=Turkey
year=%{x}
pop=%{y}
country=United Kingdom
year=%{x}
pop=%{y}
country=Algeria
year=%{x}
pop=%{y}
country=Angola
year=%{x}
pop=%{y}
country=Benin
year=%{x}
pop=%{y}
country=Botswana
year=%{x}
pop=%{y}
country=Burkina Faso
year=%{x}
pop=%{y}
country=Burundi
year=%{x}
pop=%{y}
country=Cameroon
year=%{x}
pop=%{y}
country=Central African Republic
year=%{x}
pop=%{y}
country=Chad
year=%{x}
pop=%{y}
country=Comoros
year=%{x}
pop=%{y}
country=Congo, Dem. Rep.
year=%{x}
pop=%{y}
country=Congo, Rep.
year=%{x}
pop=%{y}
country=Cote d'Ivoire
year=%{x}
pop=%{y}
country=Djibouti
year=%{x}
pop=%{y}
country=Egypt
year=%{x}
pop=%{y}
country=Equatorial Guinea
year=%{x}
pop=%{y}
country=Eritrea
year=%{x}
pop=%{y}
country=Ethiopia
year=%{x}
pop=%{y}
country=Gabon
year=%{x}
pop=%{y}
country=Gambia
year=%{x}
pop=%{y}
country=Ghana
year=%{x}
pop=%{y}
country=Guinea
year=%{x}
pop=%{y}
country=Guinea-Bissau
year=%{x}
pop=%{y}
country=Kenya
year=%{x}
pop=%{y}
country=Lesotho
year=%{x}
pop=%{y}
country=Liberia
year=%{x}
pop=%{y}
country=Libya
year=%{x}
pop=%{y}
country=Madagascar
year=%{x}
pop=%{y}
country=Malawi
year=%{x}
pop=%{y}
country=Mali
year=%{x}
pop=%{y}
country=Mauritania
year=%{x}
pop=%{y}
country=Mauritius
year=%{x}
pop=%{y}
country=Morocco
year=%{x}
pop=%{y}
country=Mozambique
year=%{x}
pop=%{y}
country=Namibia
year=%{x}
pop=%{y}
country=Niger
year=%{x}
pop=%{y}
country=Nigeria
year=%{x}
pop=%{y}
country=Reunion
year=%{x}
pop=%{y}
country=Rwanda
year=%{x}
pop=%{y}
country=Sao Tome and Principe
year=%{x}
pop=%{y}
country=Senegal
year=%{x}
pop=%{y}
country=Sierra Leone
year=%{x}
pop=%{y}
country=Somalia
year=%{x}
pop=%{y}
country=South Africa
year=%{x}
pop=%{y}
country=Sudan
year=%{x}
pop=%{y}
country=Swaziland
year=%{x}
pop=%{y}
country=Tanzania
year=%{x}
pop=%{y}
country=Togo
year=%{x}
pop=%{y}
country=Tunisia
year=%{x}
pop=%{y}
country=Uganda
year=%{x}
pop=%{y}
country=Zambia
year=%{x}
pop=%{y}
country=Zimbabwe
year=%{x}
pop=%{y}
country=Argentina
year=%{x}
pop=%{y}
country=Bolivia
year=%{x}
pop=%{y}
country=Brazil
year=%{x}
pop=%{y}
country=Canada
year=%{x}
pop=%{y}
country=Chile
year=%{x}
pop=%{y}
country=Colombia
year=%{x}
pop=%{y}
country=Costa Rica
year=%{x}
pop=%{y}
country=Cuba
year=%{x}
pop=%{y}
country=Dominican Republic
year=%{x}
pop=%{y}
country=Ecuador
year=%{x}
pop=%{y}
country=El Salvador
year=%{x}
pop=%{y}
country=Guatemala
year=%{x}
pop=%{y}
country=Haiti
year=%{x}
pop=%{y}
country=Honduras
year=%{x}
pop=%{y}
country=Jamaica
year=%{x}
pop=%{y}
country=Mexico
year=%{x}
pop=%{y}
country=Nicaragua
year=%{x}
pop=%{y}
country=Panama
year=%{x}
pop=%{y}
country=Paraguay
year=%{x}
pop=%{y}
country=Peru
year=%{x}
pop=%{y}
country=Puerto Rico
year=%{x}
pop=%{y}
country=Trinidad and Tobago
year=%{x}
pop=%{y}
country=United States
year=%{x}
pop=%{y}
country=Uruguay
year=%{x}
pop=%{y}
country=Venezuela
year=%{x}
pop=%{y}
country=Australia
year=%{x}
pop=%{y}
country=New Zealand
year=%{x}
pop=%{y}