savefig
specifies the DPI for the saved figure (The default is 100 if it’s not specified in your .matplotlibrc, have a look at the dpi
kwarg to savefig
). It doesn’t inheret it from the DPI of the original figure.
The DPI affects the relative size of the text and width of the stroke on lines, etc. If you want things to look identical, then pass fig.dpi
to fig.savefig
.
E.g.
import matplotlib.pyplot as plt fig = plt.figure() plt.plot(range(10)) fig.savefig('temp.png', dpi=fig.dpi)
Related Posts:
- How do you change the size of figures drawn with Matplotlib?
- How do you change the size of figures drawn with Matplotlib?
- Save plot to image file instead of displaying it using Matplotlib
- Matplotlib automatic legend outside plot
- Matplotlib automatic legend outside plot
- Changing the “tick frequency” on x or y axis in matplotlib?
- Python equivalent to ‘hold on’ in Matlab
- How to add title to subplots in Matplotlib
- Create own colormap using matplotlib and plot color scale
- How to increase plt.title font size?
- How to make a 3D scatter plot in matplotlib
- Modify the legend of pandas bar plot
- Changing the “tick frequency” on x or y axis in matplotlib
- Remove xticks in a matplotlib plot?
- Scatter plot colorbar – Matplotlib
- Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python
- How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?
- ImportError: DLL load failed: The specified module could not be found
- ImportError: DLL load failed: The specified module could not be found
- What is the difference between importing matplotlib and matplotlib.pyplot?
- Purpose of “%matplotlib inline”
- Purpose of “%matplotlib inline”
- TypeError: only size-1 arrays can be converted to Python scalars (matplotlib)
- Showing an image with pylab.imshow()
- Is “from matplotlib import pyplot as plt” == “import matplotlib.pyplot as plt”?
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ValueError: operands could not be broadcast together with shapes (5,) (30,)
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ImportError: No module named matplotlib.pyplot
- Plotting a 2D heatmap with Matplotlib
- How to plot ROC curve in Python
- No handles with labels found to put in legend
- How to plot a histogram using Matplotlib in Python with a list of data?
- In Matplotlib, what does the argument mean in fig.add_subplot(111)?
- How can I plot a confusion matrix? [duplicate]
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- matplotlib error – no module named tkinter
- pandas DataFrame “no numeric data to plot” error
- How to change the font size on a matplotlib plot
- Permission denied error by installing matplotlib
- Updating matplotlib in virtualenv with pip
- How do I set the figure title and axes labels font size in Matplotlib?
- How to customize a scatter matrix to see all titles?
- Add Legend to Seaborn point plot
- matplotlib error – no module named tkinter
- Plot pie chart and table of pandas dataframe
- ModuleNotFoundError: No module named ‘matplotlib’
- Change figure size and figure format in matplotlib
- Add Legend to Seaborn point plot
- TypeError: ‘DataFrame’ object is not callable
- Improve subplot size/spacing with many subplots in matplotlib
- How do I plot only a table in Matplotlib?
- How to change a ‘LinearSegmentedColormap’ to a different distribution of color?
- Why matplotlib does not plot?
- How to plot time series in python
- reducing number of plot ticks
- How to draw vertical lines on a given plot in matplotlib
- Plot a horizontal line using matplotlib
- How can I set the aspect ratio in matplotlib?
- python SyntaxError: invalid syntax %matplotlib inline
- How to make a histogram from a list of data
- How do I change the figure size with subplots?
- ValueError: x and y must be the same size
- ValueError: Unknown projection ‘3d’ (once again)
- How to change plot background color?
- raise LinAlgError(“SVD did not converge”) LinAlgError: SVD did not converge in matplotlib pca determination
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- matplotlib does not show my drawings although I call pyplot.show()
- Linear regression with matplotlib / numpy
- How to save a Seaborn plot into a file
- matplotlib: how to draw a rectangle on image
- bbox_to_anchor and loc in matplotlib
- Python, Matplotlib, subplot: How to set the axis range?
- Install Plotly in Anaconda
- How to put the legend out of the plot
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- RuntimeError: Invalid DISPLAY variable
- Plotting multiple lines, in different colors, with pandas dataframe
- How to plot an array in python?
- When I use matplotlib in jupyter notebook,it always raise ” matplotlib is currently using a non-GUI backend” error?
- IndexError: index 2 is out of bounds for axis 0 with size 2
- Label axes on Seaborn Barplot
- Plot a histogram such that the total area of the histogram equals 1
- matplotlib: plot multiple columns of pandas data frame on the bar chart
- How to change legend size with matplotlib.pyplot
- An equivalent function to matplotlib.mlab.bivariate_normal
- plot a circle with pyplot
- IPython, “name ‘plt’ not defined”
- Plotting a python dict in order of key values
- Pandas dataframe groupby plot
- MovieWriter ffmpeg unavailable; trying to use class ‘matplotlib.animation.PillowWriter’ instead
- How to plot normal distribution
- How to create Gephi network graphs from Python?
- Plotting graphs in C++
- Equivalent to matlab’s imagesc in matplotlib? [duplicate]
- KeyError: ‘plotly_domain’
- Installing Pylab/Matplotlib
- TypeError: zip argument #2 must support iteration
- numpy/scipy/ipython:Failed to interpret file as a pickle
- alueError: ordinal must be >= 1