This tag is for questions related to saving figures in matplotlib with .savefig
Questions tagged [savefig]
80 questions
2
votes
1 answer
How can I save multiple figures after they have been created in a loop?
I'm relatively new to using Python and have been re-writing some of my MatLab scripts. I have a script that creates 7 figures within a loop. After they have been made I want to save each one.I am having two problems, illustrated by the following…

Alex Cushley
- 85
- 7
2
votes
3 answers
Plot n graphs and save them in n different files
First and foremost, I'd like to precise that I am no expert in Python and still learning how to use pandas. I dig through older posts but I don't find a suitable answer.
I've been trying to code a data analysis of 92 contracts. For each of them, I'd…

Aurore
- 31
- 5
2
votes
0 answers
Saving Matplotlib suface-plot with transparent background
I try to save my 3d-Plot with an transparent background but with the transparent=True-Parameter of savefig it doesnt work. is there an other way to do it?
Here is my actual attemp:
import matplotlib.pyplot as plt
from matplotlib import cm
from…

Samuel K.
- 180
- 1
- 1
- 11
2
votes
1 answer
plt.savefig saves a blank image
My code is the following:
def distplot_stripplot_buy_signal_3(y_train, y_dev, y_test, y, plot_data_stripplot_distplot, performance_metrics_3_test,
performance_metrics_3_plus_day_train):
fig, axs =…

user8270077
- 4,621
- 17
- 75
- 140
2
votes
1 answer
How can I save a Matplotlib figure after changing the background color?
Using the Spyder IDE, I have created a matplotlib plot and changed the face (background) color of both the figure object and the axes object to black. When I try to save the figure using plt.savefig(...) the axes, title, and axes label are not…

NolantheNerd
- 338
- 3
- 10
1
vote
0 answers
unable to change pie chart size in pie() in matplotllnb
import pandas as pd
import numpy as np
df = pd.read_csv("Medals.csv")
import matplotlib.pyplot as plt
fig=plt.figure()
plt.suptitle("Medals data")
x = sum(df.Gold)
y = sum(df.Silver)
z = sum(df.Bronze)
y = np.array([x,y,z])
mylabels = ["Gold",…

Vineet Pashine
- 11
- 1
1
vote
1 answer
Python - Insert 2 figures objects in one PDF page
I want to take 2 figures objects and save them together on one pdf page.
This is my code that currently saves them on 2 separate pages:
if (output_pdf_name is not None):
pdf = matplotlib.backends.backend_pdf.PdfPages(output_pdf_name)
…

Yuval Froman
- 91
- 1
- 9
1
vote
1 answer
julia savefig() saves wrong marker shape
The code is to using PyPlot to scatter and save in julia.
using PyPlot;pygui(true)
fig = figure()
for i = 1:400
scatter([i,i+1], [i+1, i+2], color = "blue", s = 0.1)
end
PyPlot.savefig("1.png", figsize = (16, 9),dpi = 1200,…

BenXylona
- 67
- 3
1
vote
1 answer
Saving Colorbar Plot as Image File
I am trying to save a matplotlib.colorbar plot as an image file, jpg or png. I have tried the two ways written in the code below.
Using clb.savefig results in the error:
AttributeError: 'Colorbar' object has no attribute 'savefig'
using…

XyloSedai
- 11
- 3
1
vote
1 answer
Save multiple plots on a single pdf-page using python
I want to save multiple (6) plots on one page of a pdf file using python.
Currently, I'm saving every plot on a new page.
pdf = matplotlib.backends.backend_pdf.PdfPages("output.pdf")
for fig in plots:
pdf.savefig(plots[fig])
pdf.close()
The…

luisa
- 72
- 8
1
vote
1 answer
Savefig not saving axes for png file
I'm having a trouble when trying to save plot to png file. When I tried with .jpg, everything was alright. So, the problem is that graph is not saved with axes and axes' titles, there is only the content. How to save it so everything is…

user16096708
- 11
- 1
1
vote
1 answer
Could not save whole figure of barplot with long yticklabel
I want to save a barplot, but found it was clipped when save it to a file.
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
sns.set_theme(font_scale=1.6)
fig,ax = plt.subplots(figsize=(8,6))
g =…

Jack Chen
- 59
- 1
- 4
1
vote
0 answers
Matplotlib performance problem: savefig too slow, any alternative?
I am generating a matplotlib figure which consists of 2 subplots: A 3D plot with updated data each time (Poly3dcollection) and an image file that I plug in with plt.imshow().
I am able to save the this figure by plt.savefig, however, savefig is…

moldersmut
- 11
- 1
1
vote
0 answers
Why `plt.savefig` is so slow ? Could I somehow speed it up?
Creation of 100 charts in less then second, but writing them on disk on converting to base64 representation without writing them on disk takes 10 second, so the overhead is in creation of png/jpg representation itself, is there way to speed…

Qbik
- 5,885
- 14
- 62
- 93
1
vote
1 answer
Ugly Outline When Rasterizing Errorbar
I'm plotting a large number of data points with errors using Matplotlib (version 2.2.5), and I'm rasterizing the data because there are a few thousand data points. I've found that when I rasterize the data and save as a PDF, however, the error bars…

mknote
- 157
- 1
- 3
- 12