logo
  • Plot types
  • Examples
  • Tutorials
  • Reference
  • User guide
  • Develop
  • Release notes
  • Bar Label Demo
  • Stacked bar chart
  • Grouped bar chart with labels
  • Horizontal bar chart
  • Broken Barh
  • CapStyle
  • Plotting categorical variables
  • Plotting the coherence of two signals
  • CSD Demo
  • Curve with error band
  • Errorbar limit selection
  • Errorbar subsampling
  • EventCollection Demo
  • Eventplot Demo
  • Filled polygon
  • Fill Between and Alpha
  • Filling the area between lines
  • Fill Betweenx Demo
  • Hatch-filled histograms
  • Bar chart with gradients
  • Hat graph
  • Discrete distribution as horizontal bar chart
  • JoinStyle
  • Customizing dashed line styles
  • Lines with a ticked patheffect
  • Linestyles
  • Marker reference
  • Markevery Demo
  • prop_cycle property markevery in rcParams
  • Plotting masked and NaN values
  • Multicolored lines
  • Psd Demo
  • Scatter Custom Symbol
  • Scatter Demo2
  • Scatter plot with histograms
  • Scatter Masked
  • Scatter plot with pie chart markers
  • Marker examples
  • Scatter Symbol
  • Scatter plots with a legend
  • Simple Plot
  • Using span_where
  • Spectrum Representations
  • Stackplots and streamgraphs
  • Stairs Demo
  • Stem Plot
  • Step Demo
  • Creating a timeline with lines, dates, and text
  • hlines and vlines
  • Cross- and Auto-Correlation Demo
  • Affine transform of an image
  • Wind Barbs
  • Barcode
  • Contour Corner Mask
  • Contour Demo
  • Contour Image
  • Contour Label Demo
  • Contourf Demo
  • Contourf Hatching
  • Contourf and log color scale
  • Contouring the solution space of optimizations
  • BboxImage Demo
  • Figimage Demo
  • Creating annotated heatmaps
  • Image antialiasing
  • Clipping images with patches
  • Image Demo
  • Image Masked
  • Image Nonuniform
  • Blend transparency with color in 2D images
  • Modifying the coordinate formatter
  • Interpolations for imshow
  • Contour plot of irregularly spaced data
  • Layer Images
  • Matshow
  • Multi Image
  • Pcolor Demo
  • pcolormesh grids and shading
  • pcolormesh
  • Streamplot
  • QuadMesh Demo
  • Advanced quiver and quiverkey functions
  • Quiver Simple Demo
  • Shading example
  • Spectrogram Demo
  • Spy Demos
  • Tricontour Demo
  • Tricontour Smooth Delaunay
  • Tricontour Smooth User
  • Trigradient Demo
  • Triinterp Demo
  • Tripcolor Demo
  • Triplot Demo
  • Watermark image
  • Aligning Labels
  • Axes box aspect
  • Axes Demo
  • Controlling view limits using margins and sticky_edges
  • Axes Props
  • Axes Zoom Effect
  • axhspan Demo
  • Equal axis aspect ratio
  • Axis Label Position
  • Broken Axis
  • Placing Colorbars
  • Custom Figure subclasses
  • Resizing axes with constrained layout
  • Resizing axes with tight layout
  • Different scales on the same axes
  • Figure size in different units
  • Figure labels: suptitle, supxlabel, supylabel
  • Creating adjacent subplots
  • Geographic Projections
  • Combining two subplots using subplots and GridSpec
  • Using Gridspec to make multi-column/row subplot layouts
  • Nested Gridspecs
  • Invert Axes
  • Managing multiple figures in pyplot
  • Secondary Axis
  • Sharing axis limits and views
  • Shared Axis
  • Figure subfigures
  • Multiple subplots
  • Subplots spacings and margins
  • Creating multiple subplots using plt.subplots
  • Plots with different scales
  • Zoom region inset axes
  • Percentiles as horizontal bar chart
  • Artist customization in box plots
  • Box plots with custom fill colors
  • Boxplots
  • Box plot vs. violin plot comparison
  • Boxplot drawer function
  • Plot a confidence ellipse of a two-dimensional dataset
  • Violin plot customization
  • Errorbar function
  • Different ways of specifying error bars
  • Including upper and lower limits in error bars
  • Creating boxes from error bars using PatchCollection
  • Hexagonal binned plot
  • Histograms
  • Using histograms to plot a cumulative distribution
  • Some features of the histogram (hist) function
  • Demo of the histogram function's different histtype settings
  • The histogram (hist) function with multiple data sets
  • Producing multiple histograms side by side
  • Time Series Histogram
  • Violin plot basics
  • Basic pie chart
  • Pie Demo2
  • Bar of pie
  • Nested pie charts
  • Labeling a pie and a donut
  • Bar chart on polar axis
  • Polar plot
  • Polar Legend
  • Scatter plot on polar axis
  • Using accented text in matplotlib
  • Scale invariant angle label
  • Annotating Plots
  • Arrow Demo
  • Auto-wrapping text
  • Composing Custom Legends
  • Date tick labels
  • Custom tick formatter for time series
  • AnnotationBbox demo
  • Using a text as a Path
  • Text Rotation Mode
  • The difference between \dfrac and \frac
  • Labeling ticks using engineering notation
  • Annotation arrow style reference
  • Styling text boxes
  • Figure legend demo
  • Configuring the font family
  • Using a ttf font file in Matplotlib
  • Font table
  • Fonts demo (object-oriented style)
  • Fonts demo (keyword arguments)
  • Labelling subplots
  • Legend using pre-defined labels
  • Legend Demo
  • Artist within an artist
  • Convert texts to images
  • Mathtext
  • Mathtext Examples
  • Math fontfamily
  • Multiline
  • Placing text boxes
  • Rainbow text
  • STIX Fonts
  • Rendering math equations using TeX
  • Precise text layout
  • Controlling style of text and labels using a dictionary
  • Default text rotation demonstration
  • Text Rotation Relative To Line
  • Title positioning
  • Unicode minus
  • Usetex Baseline Test
  • Usetex Fonteffects
  • Text watermark
  • Align y-labels
  • Annotate Transform
  • Annotating a plot
  • Annotation Polar
  • Programmatically controlling subplot adjustment
  • Infinite lines
  • Boxplot Demo
  • Dollar Ticks
  • Fig Axes Customize Simple
  • Simple axes labels
  • Adding lines to figures
  • plot() format string
  • Pyplot Mathtext
  • Pyplot Simple
  • Pyplot Text
  • Pyplot Three
  • Pyplot Two Subplots
  • Text Commands
  • Text Layout
  • Color Demo
  • Color by y-value
  • Colors in the default property cycle
  • Colorbar
  • Colormap reference
  • Creating a colormap from a list of colors
  • List of named colors
  • Arrow guide
  • Reference for Matplotlib artists
  • Line, Poly and RegularPoly Collection with autoscaling
  • Compound path
  • Dolphins
  • Mmh Donuts!!!
  • Ellipse Collection
  • Ellipse Demo
  • Drawing fancy boxes
  • Hatch demo
  • Hatch style reference
  • Line Collection
  • Circles, Wedges and Polygons
  • PathPatch object
  • Bezier Curve
  • Scatter plot
  • Bayesian Methods for Hackers style sheet
  • Dark background style sheet
  • FiveThirtyEight style sheet
  • ggplot style sheet
  • Grayscale style sheet
  • Solarized Light stylesheet
  • Style sheets reference
  • Anchored Direction Arrow
  • Axes Divider
  • Demo Axes Grid
  • Axes Grid2
  • HBoxDivider demo
  • Showing RGB channels using RGBAxes
  • Adding a colorbar to inset axes
  • Colorbar with AxesDivider
  • Controlling the position and size of colorbars with Inset Axes
  • Per-row or per-column colorbars
  • Axes with a fixed physical size
  • Setting a fixed aspect on ImageGrid cells
  • Inset Locator Demo
  • Inset Locator Demo2
  • Make Room For Ylabel Using Axesgrid
  • Parasite Simple
  • Parasite Simple2
  • Scatter Histogram (Locatable Axes)
  • Simple Anchored Artists
  • Simple Axes Divider 1
  • Simple Axes Divider 3
  • Simple ImageGrid
  • Simple ImageGrid 2
  • Simple Axisline4
  • Simple Colorbar
  • Axis Direction
  • axis_direction demo
  • Axis line styles
  • Curvilinear grid demo
  • Demo CurveLinear Grid2
  • mpl_toolkits.axisartist.floating_axes features
  • floating_axis demo
  • Parasite Axes demo
  • Parasite axis demo
  • Ticklabel alignment
  • Ticklabel direction
  • Simple Axis Direction01
  • Simple Axis Direction03
  • Simple Axis Pad
  • Custom spines with axisartist
  • Simple Axisline
  • Simple Axisline3
  • Anatomy of a figure
  • Bachelor's degrees by gender
  • Firefox
  • Integral as the area under a curve
  • Shaded & power normalized rendering
  • XKCD
  • Decay
  • Animated histogram
  • pyplot animation
  • The Bayes update
  • The double pendulum problem
  • Animated image using a precomputed list of images
  • Frame grabbing
  • Pausing and Resuming an Animation
  • Rain simulation
  • Animated 3D random walk
  • Animated line plot
  • Oscilloscope
  • MATPLOTLIB UNCHAINED
  • Close Event
  • Mouse move and click events
  • Data Browser
  • Figure/Axes enter and leave events
  • Interactive functions
  • Image Slices Viewer
  • Keypress event
  • Lasso Demo
  • Legend Picking
  • Looking Glass
  • Path Editor
  • Pick Event Demo
  • Pick Event Demo2
  • Pipong
  • Poly Editor
  • Pong
  • Resampling Data
  • Timers
  • Trifinder Event Demo
  • Viewlims
  • Zoom Window
  • Frontpage 3D example
  • Frontpage contour example
  • Frontpage histogram example
  • Frontpage plot example
  • Anchored Artists
  • Changing colors of lines intersecting a box
  • Manual Contour
  • Coords Report
  • Cross hair cursor
  • Custom projection
  • Customize Rc
  • AGG filter
  • Ribbon Box
  • Fill Spiral
  • Findobj Demo
  • Font indexing
  • Font properties
  • Building histograms using Rectangles and PolyCollections
  • Hyperlinks
  • Image Thumbnail
  • Plotting with keywords
  • Matplotlib logo
  • Multipage PDF
  • Multiprocess
  • Packed-bubble chart
  • Patheffect Demo
  • Print Stdout
  • Pythonic Matplotlib
  • Rasterization for vector graphics
  • Set and get properties
  • SVG Filter Line
  • SVG Filter Pie
  • Table Demo
  • TickedStroke patheffect
  • transforms.offset_copy
  • Zorder Demo
  • Plot 2D data on 3D plot
  • Demo of 3D bar charts
  • Create 2D bar graphs in different planes
  • 3D box surface plot
  • Demonstrates plotting contour (level) curves in 3D
  • Demonstrates plotting contour (level) curves in 3D using the extend3d option
  • Projecting contour profiles onto a graph
  • Filled contours
  • Projecting filled contour onto a graph
  • Custom hillshading in a 3D surface plot
  • 3D errorbars
  • Create 3D histogram of 2D data
  • Parametric Curve
  • Lorenz Attractor
  • 2D and 3D Axes in same Figure
  • Automatic Text Offsetting
  • Draw flat objects in 3D plot
  • Generate polygons to fill under 3D line graph
  • 3D quiver plot
  • Rotating a 3D plot
  • 3D scatterplot
  • 3D stem
  • 3D plots as subplots
  • 3D surface (colormap)
  • 3D surface (solid color)
  • 3D surface (checkerboard)
  • 3D surface with polar coordinates
  • Text annotations in 3D
  • Triangular 3D contour plot
  • Triangular 3D filled contour plot
  • Triangular 3D surfaces
  • More triangular 3D surfaces
  • 3D voxel / volumetric plot
  • 3D voxel plot of the numpy logo
  • 3D voxel / volumetric plot with rgb colors
  • 3D voxel / volumetric plot with cylindrical coordinates
  • 3D wireframe plot
  • Rotating 3D wireframe plot
  • 3D wireframe plots in one direction
  • Loglog Aspect
  • Custom scale
  • Log Bar
  • Log Demo
  • Log Axis
  • Logit Demo
  • Exploring normalizations
  • Scales
  • Symlog Demo
  • Hillshading
  • Anscombe's quartet
  • Hinton diagrams
  • Left ventricle bullseye
  • MRI
  • MRI With EEG
  • Radar chart (aka spider or star chart)
  • The Sankey class
  • Long chain of connections using Sankey
  • Rankine power cycle
  • SkewT-logP diagram: using transforms and custom projections
  • Topographic hillshading
  • Centered spines with arrows
  • Multiple Yaxis With Spines
  • Spine Placement
  • Spines
  • Custom spine bounds
  • Dropped spines
  • Automatically setting tick positions
  • Centering labels between ticks
  • Colorbar Tick Labelling
  • Custom Ticker1
  • Formatting date ticks using ConciseDateFormatter
  • Date Demo Convert
  • Placing date ticks using recurrence rules
  • Date Index Formatter
  • Date Precision and Epochs
  • Major and minor ticks
  • The default tick formatter
  • Tick formatters
  • Tick locators
  • Set default y-axis tick labels on the right
  • Setting tick labels from a list of values
  • Move x-axis tick labels to the top
  • Rotating custom tick labels
  • Fixing too many ticks
  • Annotation with units
  • Artist tests
  • Bar demo with units
  • Group barchart with units
  • Basic Units
  • Ellipse With Units
  • Evans test
  • Radian ticks
  • Inches and Centimeters
  • Unit handling
  • CanvasAgg demo
  • Embedding in GTK3 with a navigation toolbar
  • Embedding in GTK3
  • Embedding in GTK4 with a navigation toolbar
  • Embedding in GTK4
  • Embedding in Qt
  • Embedding in Tk
  • Embedding in wx #2
  • Embedding in wx #3
  • Embedding in wx #4
  • Embedding in wx #5
  • Embedding WebAgg
  • Fourier Demo WX
  • GTK3 Spreadsheet
  • GTK4 Spreadsheet
  • MathText WX
  • Matplotlib With Glade 3
  • pyplot with GTK3
  • pyplot with GTK4
  • SVG Histogram
  • SVG Tooltip
  • Tool Manager
  • Embedding in a web application server (Flask)
  • Adding a cursor in WX
  • Anchored Box04
  • Annotate Explain
  • Annotate Simple01
  • Annotate Simple02
  • Annotate Simple03
  • Annotate Simple04
  • Annotate Simple Coord01
  • Annotate Simple Coord02
  • Annotate Simple Coord03
  • Annotate Text Arrow
  • Interactive Adjustment of Colormap Range
  • Colormap Normalizations
  • Colormap Normalizations Symlognorm
  • Connect Simple01
  • Connection styles for annotations
  • Custom box styles
  • subplot2grid demo
  • GridSpec demo
  • Nested GridSpecs
  • Pgf Fonts
  • Pgf Preamble
  • Pgf Texsystem
  • Simple Annotate01
  • Simple Legend01
  • Simple Legend02
  • Annotated Cursor
  • Buttons
  • Check Buttons
  • Cursor
  • Lasso Selector
  • Menu
  • Mouse Cursor
  • Multicursor
  • Polygon Selector
  • Radio Buttons
  • Thresholding an Image with RangeSlider
  • Rectangle and ellipse selectors
  • Slider
  • Snapping Sliders to Discrete Values
  • Span Selector
  • Textbox

Note

Click here to download the full example code

Matplotlib logo#

This example generates the current matplotlib logo.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.font_manager
from matplotlib.patches import Rectangle, PathPatch
from matplotlib.textpath import TextPath
import matplotlib.transforms as mtrans

MPL_BLUE = '#11557c'


def get_font_properties():
    # The original font is Calibri, if that is not installed, we fall back
    # to Carlito, which is metrically equivalent.
    if 'Calibri' in matplotlib.font_manager.findfont('Calibri:bold'):
        return matplotlib.font_manager.FontProperties(family='Calibri',
                                                      weight='bold')
    if 'Carlito' in matplotlib.font_manager.findfont('Carlito:bold'):
        print('Original font not found. Falling back to Carlito. '
              'The logo text will not be in the correct font.')
        return matplotlib.font_manager.FontProperties(family='Carlito',
                                                      weight='bold')
    print('Original font not found. '
          'The logo text will not be in the correct font.')
    return None


def create_icon_axes(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid):
    """
    Create a polar axes containing the matplotlib radar plot.

    Parameters
    ----------
    fig : matplotlib.figure.Figure
        The figure to draw into.
    ax_position : (float, float, float, float)
        The position of the created Axes in figure coordinates as
        (x, y, width, height).
    lw_bars : float
        The linewidth of the bars.
    lw_grid : float
        The linewidth of the grid.
    lw_border : float
        The linewidth of the Axes border.
    rgrid : array-like
        Positions of the radial grid.

    Returns
    -------
    ax : matplotlib.axes.Axes
        The created Axes.
    """
    with plt.rc_context({'axes.edgecolor': MPL_BLUE,
                         'axes.linewidth': lw_border}):
        ax = fig.add_axes(ax_position, projection='polar')
        ax.set_axisbelow(True)

        N = 7
        arc = 2. * np.pi
        theta = np.arange(0.0, arc, arc / N)
        radii = np.array([2, 6, 8, 7, 4, 5, 8])
        width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
        bars = ax.bar(theta, radii, width=width, bottom=0.0, align='edge',
                      edgecolor='0.3', lw=lw_bars)
        for r, bar in zip(radii, bars):
            color = *cm.jet(r / 10.)[:3], 0.6  # color from jet with alpha=0.6
            bar.set_facecolor(color)

        ax.tick_params(labelbottom=False, labeltop=False,
                       labelleft=False, labelright=False)

        ax.grid(lw=lw_grid, color='0.9')
        ax.set_rmax(9)
        ax.set_yticks(rgrid)

        # the actual visible background - extends a bit beyond the axis
        ax.add_patch(Rectangle((0, 0), arc, 9.58,
                               facecolor='white', zorder=0,
                               clip_on=False, in_layout=False))
        return ax


def create_text_axes(fig, height_px):
    """Create an axes in *fig* that contains 'matplotlib' as Text."""
    ax = fig.add_axes((0, 0, 1, 1))
    ax.set_aspect("equal")
    ax.set_axis_off()

    path = TextPath((0, 0), "matplotlib", size=height_px * 0.8,
                    prop=get_font_properties())

    angle = 4.25  # degrees
    trans = mtrans.Affine2D().skew_deg(angle, 0)

    patch = PathPatch(path, transform=trans + ax.transData, color=MPL_BLUE,
                      lw=0)
    ax.add_patch(patch)
    ax.autoscale()


def make_logo(height_px, lw_bars, lw_grid, lw_border, rgrid, with_text=False):
    """
    Create a full figure with the Matplotlib logo.

    Parameters
    ----------
    height_px : int
        Height of the figure in pixel.
    lw_bars : float
        The linewidth of the bar border.
    lw_grid : float
        The linewidth of the grid.
    lw_border : float
        The linewidth of icon border.
    rgrid : sequence of float
        The radial grid positions.
    with_text : bool
        Whether to draw only the icon or to include 'matplotlib' as text.
    """
    dpi = 100
    height = height_px / dpi
    figsize = (5 * height, height) if with_text else (height, height)
    fig = plt.figure(figsize=figsize, dpi=dpi)
    fig.patch.set_alpha(0)

    if with_text:
        create_text_axes(fig, height_px)
    ax_pos = (0.535, 0.12, .17, 0.75) if with_text else (0.03, 0.03, .94, .94)
    ax = create_icon_axes(fig, ax_pos, lw_bars, lw_grid, lw_border, rgrid)

    return fig, ax

A large logo:

make_logo(height_px=110, lw_bars=0.7, lw_grid=0.5, lw_border=1,
          rgrid=[1, 3, 5, 7])
logos2

Out:

(<Figure size 110x110 with 1 Axes>, <PolarAxes:>)

A small 32px logo:

make_logo(height_px=32, lw_bars=0.3, lw_grid=0.3, lw_border=0.3, rgrid=[5])
logos2

Out:

(<Figure size 32x32 with 1 Axes>, <PolarAxes:>)

A large logo including text, as used on the matplotlib website.

make_logo(height_px=110, lw_bars=0.7, lw_grid=0.5, lw_border=1,
          rgrid=[1, 3, 5, 7], with_text=True)
plt.show()
logos2

Download Python source code: logos2.py

Download Jupyter notebook: logos2.ipynb

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery

You are reading an old version of the documentation (v3.5.2). For the latest version see https://matplotlib.org/stable/gallery/misc/logos2.html

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2022 The Matplotlib development team.

Created using Sphinx 4.5.0.