如何让我的matplotlib图超出坐标轴? [英] How do I let my matplotlib plot go beyond the axes?

查看:578
本文介绍了如何让我的matplotlib图超出坐标轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将图像绘图脚本从matlab转换为matplotlib/pylab,并且我试图实现与以下matlab图像相同的效果:

I have to translate an image plotting script from matlab to matplotlib/pylab, and I'm trying to achieve the same effect as the matlab image below:

如您所见,图的z顺序似乎高于网格的z顺序,因此标记不会被轴隐藏.但是,我想不出一种方法来对我的matplotlib映像进行同样的操作:

As you can see, the z order of the plots seem to be higher than the z order of the grid, so the markers are not hidden by the axes. However, I can't figure out a way to do the same with my matplotlib image:

我想知道是否可以在不增加y轴限制的情况下获得相同的显示.

I'm wondering if it is possible to get the same display without having to increase the limits of the y axis.

推荐答案

要使标记显示在轴之外,可以关闭剪切.可以使用plot命令clip_on=False中的关键字参数来完成.

To get the marker to show beyond the axes you can turn the clipping off. This can be done using the keyword argument in the plot command clip_on=False.

例如:

import matplotlib.pyplot as plt
plt.plot(range(5), range(5), 'ro', markersize=20, clip_on=False, zorder=100)
plt.show()

这篇关于如何让我的matplotlib图超出坐标轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆