When we create a new figure:
当我们创建一个新的数字时:
import matplotlib.pyplot as plt
fig = plt.figure()
we can see in the console an output like:
我们可以在控制台中看到如下输出:
<Figure size 432x288 with 0 Axes>
so when we use add_axes:
所以当我们使用add_axes时:
add_axes(rect, projection=None, polar=False, **kwargs)
are we actually defining the x,y axes that encompass the "box" that will bound the figure (the axes in a more mathematical sense) and nothing more? or in fact this line of code is creating an empty figure with the desired dimensions in which any data we add later will be fitted in? (or None of the above maybe?)
我们实际上是否定义了包含“盒子”的x,y轴,这个“盒子”将绑定图形(更具数学意义的轴)并且仅此而已?或者实际上这行代码是创建一个具有所需尺寸的空图形,其中我们稍后添加的任何数据都将被装入? (或以上都没有?)
That questioning left me wondering how can I physically understand what the axes are for matplotlib.
那个问题让我想知道如何才能在物理上理解matplotlib的轴是什么。
Thanks for helping.
谢谢你的帮助。
1 个解决方案
#1
3
From the point of view of the viewer, the axes is the box which will contain the data and which (usually) has an x-axis and y-axis.
从观察者的角度来看,轴是包含数据的盒子,并且(通常)具有x轴和y轴。
From the programmatical point of view, the axes is an object, which stores several other objects like XAxis
, YAxis
and provides methods to create plots. Importantly, it has a transformation stored, which allows to draw the data points in pixel space.
从程序化的角度来看,轴是一个对象,它存储了几个其他对象,如XAxis,YAxis,并提供了创建绘图的方法。重要的是,它存储了转换,允许在像素空间中绘制数据点。
#1
3
From the point of view of the viewer, the axes is the box which will contain the data and which (usually) has an x-axis and y-axis.
从观察者的角度来看,轴是包含数据的盒子,并且(通常)具有x轴和y轴。
From the programmatical point of view, the axes is an object, which stores several other objects like XAxis
, YAxis
and provides methods to create plots. Importantly, it has a transformation stored, which allows to draw the data points in pixel space.
从程序化的角度来看,轴是一个对象,它存储了几个其他对象,如XAxis,YAxis,并提供了创建绘图的方法。重要的是,它存储了转换,允许在像素空间中绘制数据点。