Hay un similar question - pero no puedo hacer que la solución propuesta funcione.¿Cómo calzo el título largo?
He aquí un diagrama ejemplo con un título largo:
#!/usr/bin/env python
import matplotlib
import matplotlib.pyplot
import textwrap
x = [1,2,3]
y = [4,5,6]
# initialization:
fig = matplotlib.pyplot.figure(figsize=(8.0, 5.0))
# lines:
fig.add_subplot(111).plot(x, y)
# title:
myTitle = "Some really really long long long title I really really need - and just can't - just can't - make it any - simply any - shorter - at all."
fig.add_subplot(111).set_title("\n".join(textwrap.wrap(myTitle, 80)))
# tight:
(matplotlib.pyplot).tight_layout()
# saving:
fig.savefig("fig.png")
da una
AttributeError: 'module' object has no attribute 'tight_layout'
y si reemplazo (matplotlib.pyplot).tight_layout()
con fig.tight_layout()
da:
AttributeError: 'Figure' object has no attribute 'tight_layout'
Así que mi pregunta es - ¿Cómo encajo el título de la trama?
'tight_layout' es sólo en el último par de lanzamientos de matplotlib. Qué versión estás usando? Creo que 'tight_layout' se agregó en 1.1, aunque podría haber sido 1.0. –
La mina es '1.0.1'. – Adobe
@Joe Kington: Probablemente tengas razón: al reproducir Tu [respuesta] (http://stackoverflow.com/a/9604442/788700) aparece el mismo error. Estoy descargando la última fuente. – Adobe