import matplotlib.pyplot as plt import matplotlib.patheffects as path_effects fig = plt.figure(figsize=(7, 1)) text = fig.text(0.5, 0.5, 'This text stands out because of\n' 'its black border.', color='white', ha='center', va='center', size=30) text.set_path_effects([path_effects.Stroke(linewidth=3, foreground='black'), path_effects.Normal()]) plt.show()