{
"cells": [
{
"cell_type": "markdown",
"id": "341c97ad",
"metadata": {},
"source": [
"## ggparliament\n",
"ggparliament 包是为了使用 `ggplot2` 创建议会图表而开发的。该库还提供了一个示例数据集,其中包含了多个国家的选举数据。\n",
"\n",
"在本教程中,我们将使用来自2016年俄罗斯国家杜马选举的数据来进行所有示例。需要注意的是,根据每个国家的不同,议会的类型也会不同,因此您应该根据您想要显示的数据使用相应的类型。可用的类型包括 \"semicircle\"(美国、法国、西班牙等)、\"circle\"、\"opposing_benches\"(英国)、\"classroom\" 和 \"horsehoe\"(澳大利亚、新西兰)。\n",
"\n",
"这段文字描述了 `ggparliament` 包的功能以及如何在教程中使用2016年俄罗斯国家杜马选举的数据来进行演示。同时,它还提到了不同国家使用不同类型的议会图表,需要根据数据选择相应的类型。\n",
"\n",
"
\n",
"\n",
"## 一、准备数据\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e223db08",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
year | country | house | party_long | party_short | seats | government | colour |
---|---|---|---|---|---|---|---|
<int> | <chr> | <chr> | <chr> | <chr> | <int> | <int> | <chr> |
2016 | Russia | Duma | Communist | CPRF | 42 | 0 | #D50000 |
2016 | Russia | Duma | Liberal Democratic Party of Russia | LDPR | 39 | 0 | #2862B3 |
2016 | Russia | Duma | A Just Russia | JR | 23 | 0 | #FAB512 |
2016 | Russia | Duma | Rodina | Rodina | 1 | 0 | #EA484A |
2016 | Russia | Duma | Civic Platform | CPI | 1 | 0 | #641263 |
2016 | Russia | Duma | Independent | Ind | 1 | 0 | #B4B4B4 |
2016 | Russia | Duma | United Russia | UR | 343 | 1 | #0C2C84 |