
I've made a number of assumptions, that are based on the OP's description of the problem but maybe their real problem is more complex and the question describes a simplification of it.
My assumptions in the code below are the following: the lines are described by two positive integer numbers, the graph is limited to the first quadrant, and the graph limits are strict, no additional blank space around the lines.
This is the code that produces the graph above:
import matplotlib.pyplot as plt
import numpy as np
from itertools import combinations
from fractions import Fraction
# print fraction
pf = lambda num, den: str(Fraction(num, den)).rjust(7)
lines = ((4,3), (5,5), (3,5), (7,6), (8, 6), (4,7), (6,4))
#lines = sorted(lines)
xmx, ymx = 0,0
for y, x in lines:
xmx = x if x>xmx else xmx
ymx = y if y>ymx else ymx
plt.plot((0, x), (y,0), label=repr((y,x)))
for (y1, x1), (y2, x2) in combinations(lines, r=2):
if x1*y2 == x2*y1:
print((y1,x1), (y2, x2), ' '*34, '(parallel lines)')
continue # parallel lines
x0n, x0d = x1*x2*(y2-y1), x1*y2-x2*y1
y0n, y0d = y1*y2*(x2-x1), y1*x2-y2*x1
inside = 0 <= x0n/x0d <= xmx and 0 <= y0n/y0d <=ymx
print((y1,x1), (y2, x2),
' Xo =', pf(x0n, x0d),
' Yo =', pf(y0n, y0d),
' (inside)' if inside else ' (outside)'
)
if inside:
plt.scatter(x0n/x0d, y0n/y0d, color='w', ec='k')
# fill area below lines
N = 201
x = np.linspace(0, xmx, N)
y = np.ones(N)*ymx
z = np.zeros(N)
for y0, x0 in lines:
y = np.min((y, np.max((y0-y0*x/x0, z), axis=0)), axis=0)
plt.fill_between(x, y, color='yellow')
# Axes' minutiae
plt.xlim((0, xmx))
plt.ylim((0, ymx))
plt.legend()
plt.grid(1)
plt.show()
and this is the output produced on the console
(4, 3) (5, 5) Xo = -3 Yo = 8 (outside)
(4, 3) (3, 5) Xo = 15/11 Yo = 24/11 (inside)
(4, 3) (7, 6) Xo = -18 Yo = 28 (outside)
(4, 3) (8, 6) (parallel lines)
(4, 3) (4, 7) Xo = 0 Yo = 4 (inside)
(4, 3) (6, 4) Xo = 12 Yo = -12 (outside)
(5, 5) (3, 5) Xo = 5 Yo = 0 (inside)
(5, 5) (7, 6) Xo = 12 Yo = -7 (outside)
(5, 5) (8, 6) Xo = 9 Yo = -4 (outside)
(5, 5) (4, 7) Xo = 7/3 Yo = 8/3 (inside)
(5, 5) (6, 4) Xo = 2 Yo = 3 (inside)
(3, 5) (7, 6) Xo = 120/17 Yo = -21/17 (outside)
(3, 5) (8, 6) Xo = 75/11 Yo = -12/11 (outside)
(3, 5) (4, 7) Xo = -35 Yo = 24 (outside)
(3, 5) (6, 4) Xo = 10/3 Yo = 1 (inside)
(7, 6) (8, 6) Xo = 6 Yo = 0 (inside)
(7, 6) (4, 7) Xo = 126/25 Yo = 28/25 (inside)
(7, 6) (6, 4) Xo = -3 Yo = 21/2 (outside)
(8, 6) (4, 7) Xo = 21/4 Yo = 1 (inside)
(8, 6) (6, 4) Xo = -12 Yo = 24 (outside)
(4, 7) (6, 4) Xo = 28/13 Yo = 36/13 (inside)