About 433,000 results
Open links in new tab
  1. How to completely remove the white space around a plot

    By switching to the mpl object-oriented style, you can plot both the image and the scatter plot on the same axes, and hence only have to set the whitespace once, by using ax.imshow and ax.scatter. In the example below, I've used subplots_adjust to remove the whitespace around the axes, and ax.axis('tight') to set the axis limits to the data range.

  2. python - Matplotlib tight_layout -- remove extra white/empty …

    Dec 19, 2017 · You can remove the x and y axis and then use savefig with bbox_inches='tight' and pad_inches = 0 to remove the white space. See code below:

  3. python - Removing white space around a saved image - Stack Overflow

    If you are using pdflatex, the included pdfcrop executable proved very useful to remove whitespace from exported figures. Hence, after exporting the PDF, pdfcrop removes remaining whitespace. Here is a Python snippet to automatically crop your saved figure using pdfcrop.

  4. Hide Axis, Borders and White Spaces in Matplotlib

    Mar 15, 2025 · Removing borders and white spaces. When we use plt.axis(‘off’), the axes are hidden, but white spaces and figure borders might still remain. To completely remove these, we can use the savefig() method with bbox_inches=’tight’ and pad_inches=0. Example: Python

  5. How can I get rid of the white space in matplotlib?

    Mar 7, 2021 · You can use either plt.margins(x=0) or ax.margins(x=0) to remove all margins on the x-axis.

  6. Top 4 Ways to Eliminate White Space Between X-Axis Limits in

    Dec 6, 2024 · Learn effective methods to remove white space from the x-axis in Matplotlib plots with practical examples and solutions.

  7. How to Reduce White Space Around Figure? - matplotlib-users

    Oct 25, 2010 · You can always use subplots_adjust. I haven't looked into the details of your code, but it appears as though the actual plot (the actual graphics) is well within the margins of your subplot (extending the boundaries of the subplot would still leave a lot of white space).

  8. python - How to remove the space between subplots - Stack Overflow

    If you are using matplotlib.pyplot.subplots you can display as many images as you want using Axes arrays. You can remove the spaces between images by making some adjustments to the matplotlib.pyplot.subplots configuration.

  9. How to Hide Axis, Borders and White Spaces in Matplotlib

    Mar 11, 2025 · This tutorial explains how to hide the axis in Matplotlib plots using the axis('off') command and how to remove all white spaces and borders when saving figures. Learn to create cleaner visualizations that focus on your data without distractions.

  10. Matplotlib Crop Plot: Removing White Space from Plots

    The bbox_inches='tight' argument in savefig ensures that the saved image is cropped to the exact dimensions of the plot, removing any remaining white space. The pad_inches=0 further refines this, eliminating any additional padding that might still be present.

  11. Some results have been removed
Refresh