python - 在 matplotlib 中覆盖透明路径?

标签 python matplotlib plot

from pylab import *
plot(randn(1000), randn(1000), alpha=0.1)
[<matplotlib.lines.Line2D at 0x7f756e65a450>]
savefig('test.png')

给出这个:

enter image description here

路径合并的地方,然后应用透明度。我想要这样的东西:

enter image description here

这是在 inkscape 中后期编辑的,以分解路径然后覆盖它们。这对于我正在使用的数据集来说并不实用,因为它太大了,当我尝试在 inkscape 中打开它时,我的电脑基本上会崩溃。有没有办法在 matplotlib 本身中做到这一点?

编辑:实际数据我正在使用地球物理数据的单个长向量,并且我正在尝试使用 plot(vec[:-1], vec[1:]).

最佳答案

您可以只使用循环来创建情节:

for i in range(100):
    plot(randn(10), randn(10), alpha=0.5, c='b')

会给你类似的东西(透明度是为循环的每次迭代“添加”的):

enter image description here

但是,根据您的数据集,我不知道这种方法的实用性如何。

关于python - 在 matplotlib 中覆盖透明路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19353854/

相关文章:

python - 如何在轴标签和图例中用下标编写文本?

Matplotlib Axis 具有两个比例共享原点

python - numpy.dot 的倒数

python - Pytorch 批量矩阵向量外积

python - 每当单元测试失败时执行操作

python - 仅显示选定的或特定的 matplotlib 图形

python - 根据月份绘制 pandas DataFrame

matlab - 如何修改 MATLAB 颜色栏上的颜色

matlab - 更改 ylabel 在 MATLAB 子图中的位置

Python - 读取表情符号 Unicode 字符