2024-09-28 18:56:47 发布
网友
我想用python/pandas/matplotlib创建一个类似下面的图。上面的剪辑没问题,但我还没能像下面的剪辑那样得到一个情节。我可以在gnuplot中这样做,在gnuplot中等效的打印样式是“with pulses”。使用matplotlib可以吗?如果不能使用matplotlib,是否还有其他python图形包可以工作?在
下面是一个使用vlines的示例,正如@importanceofbeingrenes建议的那样,这引发了另一个问题。一种解决方案比另一种更好吗?在某种程度上更有效还是更好?在
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 6*np.pi, 50) plt.vlines(x, 0, np.cos(x)+1, color='g') plt.vlines(x, 0, -np.sin(x)-1, color='r') plt.show()
创建这种绘图最简单的方法是使用^{}。 可以找到一个例子here。在
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 6*np.pi, 50) plt.stem(x, np.cos(x)+1, linefmt='g-', markerfmt=' ') plt.stem(x, -np.sin(x)-1, linefmt='r-', markerfmt=' ', basefmt="gray") plt.show()
另一个选择是使用^{}。在
下面是一个使用vlines的示例,正如@importanceofbeingrenes建议的那样,这引发了另一个问题。一种解决方案比另一种更好吗?在某种程度上更有效还是更好?在
创建这种绘图最简单的方法是使用^{} 。
可以找到一个例子here。在
另一个选择是使用^{} 。在
相关问题 更多 >
编程相关推荐