我想问一下如何制作一个类似下图的图?基本上就是如何在图的顶部有x轴。谢谢
图片来源:http://oceanographyclay1987.blogspot.com/2010/10/light-attenuation-in-ocean.html
jgzswidk1#
用途
ax.xaxis.set_ticks_position("top")
例如,
import numpy as np import matplotlib.pyplot as plt numdata = 100 t = np.linspace(0, 100, numdata) y = 1/t**(1/2.0) fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.xaxis.set_ticks_position('top') ax.yaxis.grid(linestyle = '-', color = 'gray') ax.invert_yaxis() ax.plot(t, y, 'g-', linewidth = 1.5) plt.show()
1条答案
按热度按时间jgzswidk1#
用途
例如,