开发者

draw matplotlib rectangle patch with infinite length

开发者 https://www.devze.com 2023-02-15 13:22 出处:网络
I can\'t seem to find a way to draw a rectangle patch with infinite side length in matplotlib, nor can I find any documentation or conversati开发者_开发问答ons as to whether there is a way to do this.

I can't seem to find a way to draw a rectangle patch with infinite side length in matplotlib, nor can I find any documentation or conversati开发者_开发问答ons as to whether there is a way to do this.

basically:

from matplotlib.patches import Rectangle
import numpy as np
x_min = 0
x_range = 1
y_min = -np.inf
y_range = np.inf
Rectangle((x_min, y_min), x_range, y_range)

I realize that inf - inf in numpy returns nan, and that this is probably computed at some point.

Anyway, looking at the code for Rectangle didn't get me any closer to a solution, so I thought I'd check and see if anyone on here can think of a way around it.


It sounds like you would rather have an axhspan or axvspan. Example here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号