From 9d988ae9200c6985634ba6e1cac8ab73ccb300e9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 30 Jun 2020 12:08:07 +0800 Subject: [PATCH 1/2] PRF @geekpi --- ...le your data plots in Python with Pygal.md | 58 ++++++++----------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/translated/tech/20200609 Style your data plots in Python with Pygal.md b/translated/tech/20200609 Style your data plots in Python with Pygal.md index b2fd3650c2..c1f79b5d54 100644 --- a/translated/tech/20200609 Style your data plots in Python with Pygal.md +++ b/translated/tech/20200609 Style your data plots in Python with Pygal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Style your data plots in Python with Pygal) @@ -9,14 +9,16 @@ 使用 Pygal 在 Python 中设置数据图的样式 ====== -介绍一种更时尚的 Python 绘图库。 -![Python in a coffee cup.][1] -[Python][2] 一个可以可视化数据的库。一个更具互动性的选择是 Pygal,我认为这个库适合喜欢好看的人。它生成用户可以与之交互的漂亮的 SVG(可缩放矢量图形)文件。SVG 是交互式图形的标准格式,仅使用几行 Python 就可以带来丰富的用户体验。 +> 介绍一种更时尚的 Python 绘图库。 + +![](https://img.linux.net.cn/data/attachment/album/202006/30/120650hlf8lm0em3l1m8zd.jpg) + +[Python][2] 有很多可以将数据可视化的库。其中一个互动性较强的库是 Pygal,我认为这个库适合喜欢漂亮事物的人。它可以生成用户可以与之交互的漂亮的 SVG(可缩放矢量图形)文件。SVG 是交互式图形的标准格式,仅使用几行 Python 就可以带来丰富的用户体验。 ### 使用 Pygal 进行时尚的 Python 绘图 -在本文中,我们要重新创建多柱状图,它代表了 1966 年至 2020 年英国大选的结果: +在本文中,我们要重新创建多柱状图,用来表示 1966 年至 2020 年英国大选的结果: ![Pygal plot][3] @@ -25,18 +27,14 @@ * 运行最新版本的 Python([Linux][4]、[Mac][5] 和 [Windows][6] 的说明) * 确认你运行的是与这些库兼容的 Python 版本 - - 数据可在线获得,并可使用 pandas 导入: - ``` import pandas as pd -df = pd.read_csv('') +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') ``` -现在可以了。数据如下所示: - +现在我们可以继续进行了。。数据如下所示: ```         year  conservative  labour  liberal  others @@ -49,33 +47,29 @@ df = pd.read_csv(' Date: Tue, 30 Jun 2020 12:09:38 +0800 Subject: [PATCH 2/2] PUB @geekpi https://linux.cn/article-12364-1.html --- .../20200609 Style your data plots in Python with Pygal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200609 Style your data plots in Python with Pygal.md (98%) diff --git a/translated/tech/20200609 Style your data plots in Python with Pygal.md b/published/20200609 Style your data plots in Python with Pygal.md similarity index 98% rename from translated/tech/20200609 Style your data plots in Python with Pygal.md rename to published/20200609 Style your data plots in Python with Pygal.md index c1f79b5d54..89fc30a3a1 100644 --- a/translated/tech/20200609 Style your data plots in Python with Pygal.md +++ b/published/20200609 Style your data plots in Python with Pygal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12364-1.html) [#]: subject: (Style your data plots in Python with Pygal) [#]: via: (https://opensource.com/article/20/6/pygal-python) [#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan)