matplotlib第2部分中的高级图

This article comes as a second part in the Advanced Plots in Matplotlib series. In Part 1, we learnt how to use plots like Span selector, Broken Horizontal Bar plot and the table function in our visualisation work. We also learnt how to watermark images and add a twist to the plots in Matplotlib by using the XKCD theme. In part 2, we shall go over some of the other interesting capabilities of Matplotlib in action and use it to jazz up our existing plots.

本文是Matplotlib系列中“ 高级图解”的第二部分。 在第1部分中 ,我们学习了如何在可视化工作中使用诸如跨度选择器,水平横断条图和表格功能之类的图。 我们还学习了如何使用XKCD主题为图像加水印并在Matplotlib中为绘图添加扭曲。 在第2部分中,我们将介绍Matplotlib在运行中的其他一些有趣功能,并使用它来完善我们现有的情节。

1.事件图 (1. Event Plots)

Event plots come in handy when one wants to plot identical parallel lines at pre-defined positions. Such plots are commonly used in neuroscience to display the spiking activity of the neurons over time, where it is frequently referred to as a spike raster or simply a raster plot. However, there are other uses for such kind of plots too. Here is an excerpt from the event plot documentation :

当需要在预定位置绘制相同的平行线时,事件图会派上用场。 此类图通常用于神经科学中,显示随时间变化的神经元的尖峰活动,在这里通常将其称为尖峰栅格或简单地称为栅格图。 但是,这种绘图也有其他用途。 这是事件图解文档的摘录:

It is useful in any situation where you wish to show the timing or position of multiple sets of discrete events, such as the arrival times of people to a business on each day of the month or the date of hurricanes each year of the last century.

在您希望显示多组离散事件的时间或位置的情况下,例如当人们在一个月的每一天到达公司的时间或上世纪每年的飓风发生的时间时,它都非常有用。

Let’s look at an eventplot showing sequences of events with various line properties. The plot is shown in both horizontal and vertical orientations. The plot has been adapted from official Matplotlib's Eventplot documentation.

让我们看一个事件图,该eventplot显示具有各种线属性的事件序列。 该图以水平和垂直方向显示。 该图已从Matplotlib的Eventplot官方文档改编而来。

Image for post
Event/Spike Raster plot in Matplotlib | Image by Author
Matplotlib中的事件/峰值栅格图 图片作者

2.时间表 (2. Timelines)

Did you know that it is possible to create a simple timeline using Matplotlib alone? Well yes. This is because technically, timelines are simply collections of dates and text which can be obtained with simple variations in a stem plot. You can read more about it here.

您是否知道可以单独使用Matplotlib创建简单的时间表? 嗯,是。 这是因为从技术上讲,时间轴只是日期和文本的集合,可以通过在

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值