`matplotlib` speichert als PDF, aber nicht die gesamte Seite [Duplikat]Python

Python-Programme
Guest
 `matplotlib` speichert als PDF, aber nicht die gesamte Seite [Duplikat]

Post by Guest »

Ich habe eine Matplotlib-Figur generiert, die mir gefällt und die ich als PDF speichern möchte. Bisher ist das unkompliziert.

Code: Select all

import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [3, 5, 4, 7]
plt.scatter(x, y)
plt.savefig(
"example.pdf",
bbox_inches = "tight"
)
plt.close()
Ich möchte jedoch, dass die Abbildung in der Mitte einer Standardseite erscheint und etwas Leerraum um die Abbildung hat, anstatt die gesamte Seite auszufüllen. Wie würde ich das Obige optimieren, um dies zu erreichen?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post