import matplotlib.pyplot as plt from matplotlib.collections import LineCollection import numpy as np b = 0.7 c0 = 0.2 m = 0.85 d_curve = np.linspace(0.3, 0.9, 500) C_curve = np.piecewise( d_curve, [d_curve <= b, d_curve > b], [lambda x: m * x + c0, lambda x: m * b + c0] ) fig, ax = plt.subplots(figsize=(15, 12)) ax.set_xlabel('Distance to Bounding-Box') ax.set_ylabel('Centrality Value') ex = [0.5, 0.7, 0.5, 0.5] ey = [m*b + c0, m*b + c0, m*0.5 + c0, m*b + c0] ch = LineCollection([np.column_stack([ex, ey])], colors=['r'], linewidths=0.5) ax.add_collection(ch) ax.annotate("$𝛿$", xy=(0.48, 0.71), xytext=(0.48, 0.71), fontsize=18) ax.scatter([0.5, 0.8, 0.85], [0.5, 0.75, 0.9], color='w', s=1) ax.plot(d_curve, C_curve, color='k', linewidth=0.8) ax.annotate("$x$", xy=(0.5, m*0.5 + c0 - 0.01), xytext=(0.5, m*0.5 + c0 - 0.01), fontsize=10) ax.annotate("$b$", xy=(b, m*b + c0 + 0.005), xytext=(b, m*b + c0 + 0.005), fontsize=10) # ax.annotate("$f(x) = m*x + c_0$", xy=(0.32, 0.58), xytext=(0.32, 0.58), fontsize=10) # ax.annotate("$g(x) = m*b + c_0$", xy=(0.75, 0.8), xytext=(0.75, 0.8), fontsize=10) ax.axis('off') # ax.get_xaxis().set_visible(False) # ax.get_yaxis().set_visible(False) ax.set_aspect('equal') fig.savefig("model_correction_visualization.svg", format='svg', bbox_inches='tight', pad_inches=0)