Practical solutions

Python Matplotlib Howto's How-To Guides

Solve the problem. Keep building. Collection of Python Matplotlib how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Create Colorplot of 2D Array MatplotlibThis tutorial explains how we can generate colorplot of 2D arrays using the matplotlib.pyplot.imshow() and matplotlib.pyplot.pcolormesh() methods in Python. How to Display Greek Letters in Python MatplotlibDisplay Greek letters in Matplotlib with Mathtext, Unicode code points, or direct Unicode characters. How to Manually Set the Size of the Bins in Matplotlib HistogramSet Matplotlib histogram bin widths by passing explicit or generated boundaries to the bins argument of plt.hist(). How to Set Tick Labels Font Size in MatplotlibThis tutorial introduces how to set tick labels font size in Matplotlib. How to Use Error Bar in Python MatplotlibOne can plot data with error bars using the errorbar() function of Matplotlib in Python. How to Overlay Plots in MatplotlibThis article describes how to overlay plots in Matplotlib, providing practical examples and clear explanations. Learn the best methods to combine different types of visualizations, including line and bar plots, to enhance your data storytelling. Discover how to create layered graphics that effectively communicate insights and comparisons. How to Create Contour Plots in MatplotlibCreate line and filled contour plots in Matplotlib with a NumPy grid, a scalar field, and a colorbar. How to Plot Data in Real Time Using MatplotlibPlot changing data in a Matplotlib window with FuncAnimation(), manual canvas redraws, or an updating scatter artist. How to Display Multiple Images in One Figure Correctly in MatplotlibDisplay multiple images in one Matplotlib figure with a grid of axes, then customize individual panels. How to Change Space Between Subplots in MatplotlibUse tight_layout(), subplots_adjust(), subplot_tool(), or constrained_layout=True to improve spacing in Matplotlib figures with many subplots. How to Set X Axis Values in MatplotlibThis tutorial shows how to set X axis values using matplotlib.pyplot.xticks() in Matplotlib. Learn to customize tick frequency, rotate labels, and improve the clarity of your data visualizations. Discover techniques to enhance your plots and make them more informative. How to Custom Colormap Using Python MatplotlibCreate discrete and continuous custom colormaps with Matplotlib in Python, inspect built-in colors, and apply each map to plotted data. How to Set the Figure Title and Axes Labels Font Size in MatplotlibSet Matplotlib title and axis-label sizes with fontsize, rcParams defaults, or each text object's set_size() method. How to Specify the Legend Position in Graph Coordinates in MatplotlibThis article shows you how to specify the legend's position in a graph in Matplotlib. How to Place Legend Outside the Plot in MatplotlibLearn how to place a Matplotlib legend outside the axes and keep it visible in saved figures. How to Save Plots as an Image File Without Displaying in MatplotlibSave a Matplotlib figure without opening a window by using a non-interactive backend, savefig(), and the correct save-then-close order. Set Marker Size in a Matplotlib Scatter PlotSet one marker size or a size for each point with Matplotlib scatter, scale marker areas correctly, and fix a mismatched size array. How to Save Plot as SVG File in MatplotlibThis tutorial covers how to save plots as SVG files in Matplotlib. Discover simple methods to create and store high-quality visualizations that maintain clarity at any scale. Learn to customize your plots for better presentation and publication-ready graphics. How to Plot List of X,y Coordinates in MatplotlibThis tutorial introduces how to plot a list of x, y coordinates in Matplotlib. Learn the basics of creating line and scatter plots, and discover how to customize your visualizations for better data representation. Perfect for beginners and experienced users alike, this guide covers essential techniques to enhance your data analysis skills. How to Fill Between Multiple Lines in MatplotlibLearn how to fill between multiple lines in Matplotlib with this comprehensive guide. Explore the use of the fill_between() function, see clear examples, and discover how to customize your plots for better data visualization. Enhance your skills in creating engaging and informative graphics with these techniques. How to Plot NumPy Linear Fit in Matplotlib PythonThis tutorial explains how to fit a curve to the given data using numpy.polyfit() method and display the curve using the Matplotlib package. Learn to visualize data effectively with step-by-step instructions and code examples. Discover how to create scatter plots and best-fit lines to uncover trends and insights in your data. How to Set Matplotlib Grid IntervalLearn how to set grid intervals in Matplotlib to enhance your data visualizations. This tutorial covers methods for customizing major and minor grids, providing code examples and detailed explanations. Improve your plots' readability and style with these essential techniques for effective data representation. How to Create Boxplot in MatplotlibThis tutorial explains how to create a boxplot using the matplotlib.pyplot.boxplot() function in Matplotlib. Learn to generate basic and customized boxplots, compare multiple datasets, and enhance your data visualization skills. Perfect for data analysts and scientists looking to interpret complex datasets effectively. How to Set Legend Title in MatplotlibThis tutorial demonstrates how to add a title to the legend of Matplotlib figures in Python. Learn various methods to customize your legend titles, including font size, background color, and positioning. Enhance your data visualizations with clear and informative legends to improve viewer understanding.