我的目标是绘制一个有4个象限的图,并在同一个象限中绘制点。另外,如何将一个象限划分为几个扇区?我如何在matplotlib中做同样的事情:一个有4个象限的图/图。X轴(1-9)和y轴(1-9)?
发布于 2016-10-17 06:49:13
从问题中,听起来您想要一个具有多个具有特定xy范围的描绘区域的单个图形。这很简单。您可以随时在绘图上绘制线条来描绘感兴趣的区域。这里有一个基于你声明的目标的快速示例:
import matplotlib.pyplot as plt
plt.figure()
# Hold activation for multiple lines on same graph
plt.hold('on')
# Set x-axis range
plt.xlim((1,9))
# Set y-axis range
plt.ylim((1,9))
# Draw lines to split quadrants
plt.plot([5,5],[1,9], linewidth=4, color='red' )
plt.plot([1,9],[5,5], linewidth=4, color='red' )
plt.title('Quadrant plot')
# Draw some sub-regions in upper left quadrant
plt.plot([3,3],[5,9], linewidth=2, color='blue')
plt.plot([1,5],[7,7], linewidth=2, color='blue')
plt.show()发布于 2011-03-15 21:37:25
我将看一下AxesGrid工具包:
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/index.html
也许这一页顶部的中间图像就是你正在寻找的东西。API文档中的以下页面中的示例应该是一个很好的起点:
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html
如果没有一个确切的例子来说明你想做什么,就很难给你最好的建议。
发布于 2011-03-14 11:36:59
您需要子图,请参阅此示例:
http://matplotlib.sourceforge.net/examples/pylab_examples/subplot_toolbar.html
https://stackoverflow.com/questions/5294320
复制相似问题