2024-09-27 00:16:23 发布
网友
我做了一些研究,但我发现的每个解决方案都不适用于“Anaconda-2.2.0-Linux-x86_.sh”。。。有人能告诉我如何摆脱框架和轴标签吗?你知道吗
boros = GeoDataFrame.from_file('nybb/nybb.shp') boros.plot()
以下是移除脊椎和勾号标签的方法:
import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots() x = np.linspace(-np.pi, np.pi, 100) y = 2*np.sin(x) ax.plot(x, y) ax.patch.set_visible(False) ax.grid('off') [ax.spines[spine].set_visible(False) for spine in ax.spines] ax.set_xticklabels([]); ax.set_yticklabels([]); plt.show()
请注意,调用.plot()时,需要将引用传递给将放置绘图的axes对象,如.plot(ax=ax)。你知道吗
.plot()
.plot(ax=ax)
如果没有引用axes对象的变量,则可以使用plt.gca()访问当前轴。你知道吗
plt.gca()
以下是移除脊椎和勾号标签的方法:
请注意,调用
.plot()
时,需要将引用传递给将放置绘图的axes对象,如.plot(ax=ax)
。你知道吗如果没有引用axes对象的变量,则可以使用
plt.gca()
访问当前轴。你知道吗相关问题 更多 >
编程相关推荐