Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 重塑pyplot子图_Python_Matplotlib_Jupyter Notebook - Fatal编程技术网

Python 重塑pyplot子图

Python 重塑pyplot子图,python,matplotlib,jupyter-notebook,Python,Matplotlib,Jupyter Notebook,我有以下代码: def plot_yz_over_x_elementwise(zarray): for i in range(zarray.shape[1]): for j in range(zarray.shape[2]): plt.subplot2grid((zarray.shape[1],zarray.shape[2]),(i,j)) plt.plot(zarray[:,i,j]) frame

我有以下代码:

def plot_yz_over_x_elementwise(zarray):
    for i in range(zarray.shape[1]):
        for j in range(zarray.shape[2]):
            plt.subplot2grid((zarray.shape[1],zarray.shape[2]),(i,j))
            plt.plot(zarray[:,i,j])
            frame = plt.gca()
            frame.axes.get_xaxis().set_ticks([])
            frame.axes.get_yaxis().set_ticks([1,0.5,0])
它采用一个3D np阵列,并将其绘制成如下图形:

它被嵌入到ipython笔记本中。我需要的是某种方式来格式化这个图形,这样轴标签就不会彼此重叠。我想这意味着要么把它分散在笔记本上……要么在python的每个单元格中缩小它。我该如何做一个或另一个才能让这个绘图看起来正确?

可能就是您想要的

def plot_yz_over_x_elementwise(zarray):
    for i in range(zarray.shape[1]):
        for j in range(zarray.shape[2]):
            plt.subplot2grid((zarray.shape[1],zarray.shape[2]),(i,j))
            plt.plot(zarray[:,i,j])
            frame = plt.gca()
            frame.axes.get_xaxis().set_ticks([])
            frame.axes.get_yaxis().set_ticks([1,0.5,0])
    plt.tight_layout()
可能就是你要找的

def plot_yz_over_x_elementwise(zarray):
    for i in range(zarray.shape[1]):
        for j in range(zarray.shape[2]):
            plt.subplot2grid((zarray.shape[1],zarray.shape[2]),(i,j))
            plt.plot(zarray[:,i,j])
            frame = plt.gca()
            frame.axes.get_xaxis().set_ticks([])
            frame.axes.get_yaxis().set_ticks([1,0.5,0])
    plt.tight_layout()

很确定这是这个的复制品


底线答案是使用

非常确定这是它的复制品


底线答案是使用

嘿,有其他搜索标题是有好处的。我肯定在找这个,但什么也没找到。大概,如果我是专家,我会找到这些链接……但如果我是专家,我不会有问题。换句话说,谢谢你指出这一点……但我永远也找不到那些搜索行。嘿,有其他搜索标题是有好处的。我肯定在找这个,但什么也没找到。大概,如果我是专家,我会找到这些链接……但如果我是专家,我不会有问题。换句话说,谢谢你指出这一点……但我永远也找不到那些搜索行。