Answers for "matplotlib wrap title"

1

matplotlib wrap title

from textwrap import wrap
import matplotlib.pyplot as plt

x=[1,2,3]
y=[4,5,6]
plt.figure(figsize=(10,10))
plt.plot(x, y, color='red')
title='my extremely long title. I mean, really really long. Unbelievably long.'
plt.title('\n'.join(wrap(title,60)))
Posted by: Guest on April-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language