小编nbr*_*n12的帖子

使用matplotlib中的axis对象设置活动子图?

面向对象的matplotlib子图接口很不错,但在调用包含类似行的函数时,我很难使用它plt.plot(x, y.这些函数可以plt.subplot()轻松使用,但是可以使用给定的轴对象设置活动子图吗?具体来说,我想要以下内容绘制成两个单独的子图:

import matplotlib.pyplot as plt

x = [0 ,1, 2]
y= [0 ,1 2]

fig, axs = plt.subplots(2,1)

plt.some_function_to_set_active_subplot(axs[0])
plt.plot(x, y)

plt.some_function_to_set_active_subplot(axs[1])
plt.plot(x, y)
Run Code Online (Sandbox Code Playgroud)

有这样的功能some_function_to_set_active_subplot吗?

编辑:我特意不能使用ax.plot,或类似的东西.我基本上是在询问如何将面向对象的界面与matlab风格的界面混合在一起.

编辑2:我也不想使用它们plt.subplot.我想使用OO接口来设置子图,并使用matlab风格进行实际绘图.

python matplotlib

11
推荐指数
2
解决办法
1万
查看次数

如何包含原始 html 文件?

首先,我可以使用raw指令轻松包含原始 html 文件,如下所示:

.. raw:: html
    :file: some_file.html
Run Code Online (Sandbox Code Playgroud)

有没有一种简单的方法可以用 asciidoctor 来做到这一点?我明白,如果我将 的内容包装some_file.html起来++++,我就可以include::在 asciidoc 中使用,但我想避免手动编辑some_file.html.

asciidoctor

8
推荐指数
1
解决办法
4269
查看次数

标签 统计

asciidoctor ×1

matplotlib ×1

python ×1