How to Export Matplotlib Plot with Transparent Background in Python? Last Updated : 28 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss how to export a Matplotlib plot with Transparent background in Python. After plotting the data, if we want to export the plot, then we have to use savefig() function. Syntax: savefig('plot_name.png', transparent=True) where plot_name is the image name given to our plot which is plotted from the datatransparent is used to get the transparent background when it set to true Example 1: Python code to create the plot with 2 data points of the dataframe and export it Python3 #import matplotlib import matplotlib.pyplot as plt #import pandas import pandas as pd # create a dataframe with 2 columns data = pd.DataFrame({'data1': [1, 2, 3, 4, 21], 'data2': [6, 7, 8, 9, 10]}) # plot one by one plt.plot(data['data1']) plt.plot(data['data2']) # set y label plt.ylabel('Distance') # set x label plt.xlabel('Time') # set title plt.title('Travelling') # display plot plt.show() # export it plt.savefig('image.png', transparent=True) Output: Example 2 : Python code to create the plot with 3 data points of the dataframe and export it Python3 #import matplotlib import matplotlib.pyplot as plt #import pandas import pandas as pd # create a dataframe with 2 columns data = pd.DataFrame({'data1': [1, 2, 3, 4, 21], 'data2': [6, 7, 8, 9, 10], 'data3': [56, 7, 8, 41, 10]}) # plot one by one plt.plot(data['data1']) plt.plot(data['data2']) plt.plot(data['data3']) # set y label plt.ylabel('Distance') # set x label plt.xlabel('Time') # set title plt.title('Travelling') # display plot plt.show() # export it plt.savefig('image.png', transparent=True) Output: Comment More infoAdvertise with us Next Article How to Export Matplotlib Plot with Transparent Background in Python? O ojaswilavu8128 Follow Improve Article Tags : Python Python-matplotlib Practice Tags : python Similar Reads How to Change the Transparency of a Graph Plot in Matplotlib with Python? Changing transparency in Matplotlib plots enhances visual clarity, especially when data overlaps. Transparency is controlled using a value between 0 (fully transparent) and 1 (fully opaque). This setting can be applied to elements like lines, bars, scatter points and filled areas either during plot 3 min read How to Set Plot Background Color in Matplotlib? Prerequisites:Â MatplotlibNumpyFrom the below figure one can infer that a plot consists of X-axis, Y-axis, plot title and the axes. By default, the color of the plot is white. If we have to set the background color of the plot so that our plot looks beautiful, we have to make the axes object, by usin 3 min read How to make background image transparent using Python? In this article, the task is to create a background transparent of the image in Python Library Required : First Install pillow library on your Python Application before going ahead. Python Imaging Library is a free and open-source additional library for the Python programming language that adds supp 1 min read How to Set Plotly Chart to Have a Transparent Background in R? Plotly is a powerful and versatile graphing library that allows for interactive and dynamic visualizations. Customizations like changing the chart's background, including setting it to be transparent, can significantly enhance its visual appeal and utility. This article will focus on guiding you thr 5 min read How to Create an Empty Figure with Matplotlib in Python? Creating a figure explicitly is an object-oriented style of interfacing with matplotlib. The figure is a basic building block of creating a plot as Matplotlib graphs our data on figures. This figure keeps track of all other components such as child axes, legends, title, axis, etc. Steps to create an 2 min read Like