Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-08-06 22:15:48 +08:00
commit 2a89e8750b
6 changed files with 139 additions and 47 deletions

View File

@ -1,18 +1,20 @@
[#]: collector: (lujun9972)
[#]: translator: ()
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: translator: (silentdawn-zz)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12493-1.html)
[#]: subject: (Concise data plotting in Python with Altair)
[#]: via: (https://opensource.com/article/20/6/altair-python)
[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan)
Python 下使用 Altair 数据制图简明教程
Python 下使用 Altair 数据制图
======
Altair 作为一个 Python 数据制图库,提供了优雅的接口及自有的绘图语言。
![metrics and data shown on a computer screen][1]
Python 中的 [绘图库][2] 提供了呈现数据的多种方式,可以满足你不同的偏好,如灵活性、布局、易用性,或者特殊的类型。
> Altair 作为一个 Python 数据制图库,提供了优雅的接口及自有的绘图语言。
![](https://img.linux.net.cn/data/attachment/album/202008/06/110441imrz9ajtpshtfq1i.jpg)
Python 中的 [绘图库][2] 提供了呈现数据的多种方式,可以满足你不同的偏好,如灵活性、布局、易用性,或者特殊的风格。
和其它方式相比我发现Altair 提供的是一种不同的解决方案,且总体而言使用起来更为简单。得益于声明式的绘图语言 [Vega][3]Altair 拥有一套优雅的接口,可以直接定义要绘的图应该是什么样子,而不是通过写一大堆循环和条件判断去一步步构建。
@ -20,17 +22,14 @@ Python 中的 [绘图库][2] 提供了呈现数据的多种方式,可以满足
我通过绘制同一个多柱状图比较了多个 Python 绘图库的差异。正式开始之前,你需要将你的 Python 环境调整到能运行下面代码的状态。具体就是:
* 安装最新版的 Python [Linux][4]、[Mac][5] 和 [Windows][6] 系统下的安装方法)
* 确认该版本 Python 可以运行本教程所使用的库
* 安装最新版的 Python [Linux][4]、[Mac][5] 和 [Windows][6] 系统下的安装方法)
* 确认该版本 Python 可以运行本教程所使用的库
演示用数据可从网络下载,并且可以用 pandas 直接导入:
```
import pandas as pd
df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv>')
df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv')
```
准备开始吧。为了做个比较,先看下面这个用 [Matplotlib][7] 做的图:
@ -41,7 +40,6 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
使用 Altair 绘制相似的图,代码如下:
```
    import altair as alt
@ -55,7 +53,7 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
    chart.save('altair-elections.html')
```
真是简洁多了!与 [Seaborn][9] 类似Altair 所用数据的组织形式是每个变量一列(即 [数据列][10] )。这种方式下可以将每个变量映射到图的一个属性上—— Altair 称之为”通道“。在上例中,我们期望每个 “党派” 在 `x` 轴上显示为一组图柱, 其 “席位” 显示在 `y` 轴,且将图柱按照 “年份” 分开为 “列”。我们还想根据 “党派” 给图柱使用不同的 “颜色”。用语言表述需求的话就是上面这个样子,而这也正是代码所要表述的!
真是简洁多了!与 [Seaborn][9] 类似Altair 所用数据的组织形式是每个变量一列(即 [数据列][10] )。这种方式下可以将每个变量映射到图的一个属性上 —— Altair 称之为“通道”。在上例中,我们期望每个 “党派” 在 `x` 轴上显示为一组图柱, 其 “席位” 显示在 `y` 轴,且将图柱按照 “年份” 分开为 “列”。我们还想根据 “党派” 给图柱使用不同的 “颜色”。用语言表述需求的话就是上面这个样子,而这也正是代码所要表述的!
现在把图画出来:
@ -63,7 +61,7 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
### 调整样式
这和我们期待的效果有点接近了。与 Matplotlib 方案相比,主要区别在于 Altair 方案中,每个 `year` 组显示的时候,内部之间都有个小空白——这不是问题,这只是 Altair 多柱状图显示的一个特性。
这和我们期待的效果有点接近了。与 Matplotlib 方案相比,主要区别在于 Altair 方案中,每个 `year` 组显示的时候,内部之间都有个小空白 —— 这不是问题,这只是 Altair 多柱状图显示的一个特性。
所以说呢,还需要对显示样式再做一些改进。
@ -73,7 +71,7 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
```
`    df['year'] = df['year'].astype(str)`
    df['year'] = df['year'].astype(str)
```
#### 指定数据排序方法
@ -104,7 +102,6 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
最后我们还想自己指定图柱的颜色。Altair 允许建立 `domain` 中数值与 `range` 中颜色的映射来实现所需功能,太贴心了:
```
    cmap = {
        'Conservative': '#0343df',
@ -121,8 +118,7 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
#### 样式调整后的最终代码
应用上述样式调整之后,代码看起来不那么悦目了,但我们仍然是用声明的方式实现的,这正式 Altair 如此有弹性的原因所在。实现过程中,仍然是使用的异于显示数据的独立变量来分离图中不同属性的,而不是像在 Matplotlib 中那样直接对显示数据做复杂的操作。唯一的不同是,我们的变量名字封装在类似 `alt.X()` 的对象中,从而实现对显示效果的控制:
应用上述样式调整之后,代码看起来不那么悦目了,但我们仍然是用声明的方式实现的,这正是 Altair 如此有弹性的原因所在。实现过程中,仍然是使用的异于显示数据的独立变量来分离图中不同属性的,而不是像在 Matplotlib 中那样直接对显示数据做复杂的操作。唯一的不同是,我们的变量名字封装在类似 `alt.X()` 的对象中,从而实现对显示效果的控制:
```
    import altair as alt
@ -155,13 +151,11 @@ df = pd.read_csv('<https://anvil.works/blog/img/plotting-in-python/uk-election-r
![The Altair plot with our custom styling][12]
### **结论**
### 结论
尽管在代码数量上,使用 Altair 绘图没有表现出优势但它的声明式绘图语言使得对图层的操控更为精密这是我比较欣赏的。Altair 还提供了清晰而独立的方式来调校显示样式,这使得 相关代码与绘图的代码块分离开来。Altair 确实是使用 Python 绘图时又一个很棒的工具库。
\---
_本文首次发布于 [这里][13]蒙允编辑后再次发布_
本文首次发布于 [这里][13],蒙允编辑后再次发布。
--------------------------------------------------------------------------------
@ -169,15 +163,15 @@ via: https://opensource.com/article/20/6/altair-python
作者:[Shaun Taylor-Morgan][a]
选题:[lujun9972][b]
译者:[silentdawn-zz](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
译者:[silentdawn-zz](https://github.com/silentdawn-zz)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/shaun-taylor-morgan
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen)
[2]: https://opensource.com/article/20/4/plot-data-python
[2]: https://linux.cn/article-12327-1.html
[3]: https://vega.github.io/vega/
[4]: https://opensource.com/article/20/4/install-python-linux
[5]: https://opensource.com/article/19/5/python-3-default-mac

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12492-1.html)
[#]: subject: (BigBlueButton: Open Source Software for Online Teaching)
[#]: via: (https://itsfoss.com/bigbluebutton/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
@ -10,11 +10,11 @@
BigBlueButton开源在线教学软件
======
_**简介:BigBlueButton 是一个为在线教学量身定制的开源视频会议工具。让我们来看看它提供了什么。**_
> BigBlueButton 是一个为在线教学量身定制的开源视频会议工具。让我们来看看它提供了什么。
在 2020 年,在家远程工作是一种新常态。当然,你不能远程完成所有事情,但是可以进行在线教学。
在 2020 年,在家远程工作是一种新常态。当然,你不能远程完成所有事情,但是在线教学是可以的
即使许多老师和学校组织对那些存在的出色工具都不熟悉,但某些[最佳开源视频会议工具][1]在一定程度上满足了要求。
尽管许多老师和学校组织不熟悉那些所有的出色工具,但某些[最好的开源视频会议工具][1]在一定程度上满足了要求。
在我提到的视频通话软件中,[BigBlueButton][2] 引起了我的注意。在这里,我将为你简单介绍。
@ -24,7 +24,7 @@ _**简介BigBlueButton 是一个为在线教学量身定制的开源视频会
BigBlueButton 是一个开源的网络会议方案,它旨在简化在线学习。
它是完全免费的,但是需要你在自己的服务器上安装才能将其用作完整的在线学习方案。
它是完全免费的,但是需要你在自己的服务器上安装才能将其用作成熟的在线学习解决方案。
BigBlueButton 提供了非常好的一组功能。你可以轻松地尝试[演示实例][4],并在学校的服务器上进行安装。
@ -32,7 +32,7 @@ BigBlueButton 提供了非常好的一组功能。你可以轻松地尝试[演
### BigBlueButton 的功能
BigBlueButton 提供了一系列量身定制的针对教师和学校在线课堂的有用功能,你可以获得:
BigBlueButton 为教师和学校的量身定制了一系列在线课堂的有用功能,你可以获得:
* 现场白板
* 给公共和私人发消息
@ -46,13 +46,11 @@ BigBlueButton 提供了一系列量身定制的针对教师和学校在线课堂
* 能够自行托管
* 提供用于轻松集成到 Web 应用中的 API
除了提供的功能外,你还能看到易于使用的 UI即 [Greenlight][5] BigBlueButton 的前端界面),当你在服务器上配置时可以安装它。
你可以尝试演示实例来临时免费地教你的学生。但是,考虑到使用[演示实例][4]来尝试 BigBlueButton 的局限性(限制为 60 分钟),建议你将它托管在服务器上,以探索其提供的所有功能。
为了更清楚地了解这些功能是如何工作的,你可能需要看下它的官方教程。
为了更清楚地了解这些功能是如何工作的,你可能需要看下它的[官方教程](https://www.youtube.com/embed/Q2tG2SS4gXA)
### 在你的服务器上安装 BigBlueButton
@ -62,11 +60,11 @@ BigBlueButton 提供了一系列量身定制的针对教师和学校在线课堂
你可以在它的 [GitHub 页面][9]中进一步了解该项目。
[Try BigBlueButton][2]
- [试用 BigBlueButton][2]
如果你想为在线教学安装解决方案,那么 BigBlueButton 是一个不错的选择。
如果你正在为在线教学寻求解决方案,那么 BigBlueButton 是一个不错的选择。
它可能不提供原生智能机应用,但你肯定可以用手机上的网络浏览器来访问它。当然,最好找一台笔记本电脑/计算机来访问在线教学平台,但它也可以在移动设备上使用。
它可能不提供原生智能机应用,但你肯定可以用手机上的网络浏览器来访问它。当然,最好找一台笔记本电脑/计算机来访问在线教学平台,但它也可以在移动设备上使用。
你认为 BigBlueButton 的在线教学如何?有没有更好的开源项目可以替代?在下面的评论中让我知道!
@ -77,13 +75,13 @@ via: https://itsfoss.com/bigbluebutton/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/open-source-video-conferencing-tools/
[1]: https://linux.cn/article-12453-1.html
[2]: https://bigbluebutton.org/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/big-blue-button.png?ssl=1
[4]: http://demo.bigbluebutton.org/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (JonnieWayy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,100 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Matthew Arnold: Why I switched to Fedora)
[#]: via: (https://fedoramagazine.org/matthew-arnold-why-i-switched-to-fedora/)
[#]: author: (Matthew Arnold https://fedoramagazine.org/author/marnold512/)
Matthew Arnold: Why I switched to Fedora
======
![][1]
To a veteran user of other distributions, Fedora can be a challenge. Many things are not where you expect them to be. The default LVM volume allocations are a bit tricky. And packages including the kernel are frequently upgraded. So why switch after years of using other distributions?
In my case, for a variety of technical and political reasons, Fedora was the best option if I wanted to continue using Linux as my daily driver. If you are making the transition from another distribution, here are some observations and tips to get you started.
### Firm foundations
In Fedora you will find a community just as fiercely dedicated to its users and free software as Debian, as fanatical about polish and design as anyone in Ubuntu, and as passionate about learning and discovery as users of Arch or Slackware. Flowing under it all you will find a welcoming community dedicated to technical excellence. The form may change, but underneath all the trappings of _systemd_, _dnf_, _rpm_, and other differences, you will find a thriving healthy and growing community of people who have gathered together to make something awesome. Welcome to Fedora, and I hope you stay awhile.
The best way to get to know the Fedora community is to explore it for yourself. I hope a future article will highlight some of the more interesting aspects of Fedora for newcomers. Below are a few tips that I have put together to help you find your way around a new Fedora installation.
### Install and explore
Installation proceeds as you would expect but be aware that you might want to adjust the LVM volume allocations in the install process or shortly afterwards or you might run low on space in a key place unexpectedly! Btrfs is also a supported option that is worth a look if you have lots of small disks.
### Freedom matters
As stated above Fedora has a software freedom commitment similar in spirit to that of Debian. This means that you should be able to give Fedora to anyone, anywhere without violating intellectual property laws. Any software which is either not licensed in a way that Fedora [finds acceptable][2] or that bares US patent encumbrances can be found in the rpmfusion.org repository.
After the install your next concern is undoubtedly configuring things and installing new packages. Fedoras command-line package manager is _dnf_. It works as you would expect.
Note also that since _rpm_ uses file-based dependency tracking instead of package-based dependency tracking, as almost all others do, there are very few traditional metapackages. There are, however, package groups. To get a list of package groups, the command is:
```
$ dnf group list
```
To get a list of all installed packages on the system, the command is:
```
$ rpm -qa
```
All _rpm_ commands are easily filterable using traditional Unix tools. So you should have no trouble adapting your workflow to the new environment. All the information gathered with the below commands can also be gathered through the _dnf_ command. For information gathering, I prefer to use the _rpm_ command because it presents information in a way that is easily parseable by commands like _grep_. But if you are making changes to the system, it is easier and safer to use _dnf_.
To get a packages version, description, and other metainformation the command is:
```
$ rpm -qi <packagename>
```
To list the contents of an installed package the command is:
```
$ rpm -ql <packagename>
```
One way in which _rpm_ is easier to use then _dpkg_ or the slack package tools is that _rpm_ stores change log information for each package in the package manager database itself so it is very easy to diagnose whether an update might have broken or changed something unexpectedly. This command is:
```
$ rpm -q --changes <packagname>
```
### On the kernel
Perhaps one of the most exciting differences between Fedora and other projects, for newcomers at least, is Fedoras policy on the kernel. Fedoras policy is to align the distributions kernel package life cycle with the upstream mainline kernel life cycle. This means that every Fedora release will have multiple major kernel versions during its lifetime.
This offers several advantages for both users and developers. Primarily, Fedora users are among the first to receive all of the latest drivers, security fixes, new features, etc.
If you do not have an installation that uses out-of-tree modules or custom patches this should not be much of concern to you. However, if you rely on a kernel module like _zfs_, for example. Rebuilding the filesystem module every 2-3 months can get tedious and error prone after a while. This problem only compounds if you depend upon custom patches for your system to work correctly. There is good news and bad news on this issue.
The good news is that Fedoras process for [building a custom kernel is well documented][3]
The bad news is, as with all things kernel related in all projects, going the custom route means youre on your own in terms of support. The 2-3 month lifecycle means youll be building modules and kernels far more often then you are used to. This may be a deal breaker for some. But even this offers an advantage to the discerning or adventuress user. You will find that being encouraged to rebase your custom kernel setup every two to three months will give you far greater insight into what is going on upstream in mainline Linux and the various out of tree projects you rely on.
### Conclusion
Hopefully these tips will get you started exploring and configuring your new Fedora system. Once you have done that. I urge you to explore the community. Like any other free software product of Fedoras age and size, there are a plethora of communication channels available. You should read the [code of conduct][4] and then head over to the [communication page on the wiki][5] to get started. As with the distribution itself, for all the differences in culture you will find that much remains the same.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/matthew-arnold-why-i-switched-to-fedora/
作者:[Matthew Arnold][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/marnold512/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/fedora-switch-816x345.jpg
[2]: https://fedoraproject.org/wiki/Licensing:Main
[3]: https://fedoraproject.org/wiki/Building_a_custom_kernel
[4]: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
[5]: https://fedoraproject.org/wiki/Communicating_and_getting_help