See The matplotlibrc file for details about how to
persistently and selectively revert many of these changes.
Colors, color cycles, and colormaps
Colors in default property cycle
The colors in the default property cycle have been changed from
['b','g','r','c','m','y','k'] to the category10
color palette used by Vega and
d3
originally developed at Tableau.
In addition to changing the colors, an additional method to specify
colors was added. Previously, the default colors were the single
character short-hand notations for red, green, blue, cyan, magenta,
yellow, and black. This made them easy to type and usable in the
abbreviated style string in plot, however the new default colors
are only specified via hex values. To access these colors outside of
the property cycling the notation for colors 'CN', where N
takes values 0-9, was added to
denote the first 10 colors in rcParams["axes.prop_cycle"] (default: cycler('color',[(0.12156862745098039,0.4666666666666667,0.7058823529411765),(1.0,0.4980392156862745,0.054901960784313725),(0.17254901960784313,0.6274509803921569,0.17254901960784313),(0.8392156862745098,0.15294117647058825,0.1568627450980392),(0.5803921568627451,0.403921568627451,0.7411764705882353),(0.5490196078431373,0.33725490196078434,0.29411764705882354),(0.8901960784313725,0.4666666666666667,). See
for more details.
For an introduction to color theory and how 'viridis' was generated
watch Nathaniel Smith and Stéfan van der Walt's talk from SciPy2015.
See
about the other alternatives and the tools used to create the color
map. For details on all of the colormaps available in matplotlib see
.
Interactive figures
The default interactive figure background color has changed from grey
to white, which matches the default background color used when saving.
The previous defaults can be restored by
mpl.rcParams['figure.facecolor']='0.75'
or by setting
figure.facecolor:'0.75'
in your matplotlibrc file.
Grid lines
The default style of grid lines was changed from black dashed lines to thicker
solid light grey lines.
The default dpi used for on-screen display was changed from 80 dpi to
100 dpi, the same as the default dpi for saving files. Due to this
change, the on-screen display is now more what-you-see-is-what-you-get
for saved files. To keep the figure the same size in terms of pixels, in
order to maintain approximately the same size on the screen, the
default figure size was reduced from 8x6 inches to 6.4x4.8 inches. As
a consequence of this the default font sizes used for the title, tick
labels, and axes labels were reduced to maintain their size relative
to the overall size of the figure. By default the dpi of the saved
image is now the dpi of the Figure instance being
saved.
This will have consequences if you are trying to match text in a
figure directly with external text.
In addition, the forward kwarg to
set_size_inches now defaults to True to improve
the interactive experience. Backend canvases that adjust the size of
their bound matplotlib.figure.Figure must pass forward=False to
avoid circular behavior. This default is not configurable.
Plotting functions
scatter
The following changes were made to the default behavior of
scatter
The default size of the elements in a scatter plot is now based on
rcParams["lines.markersize"] (default: 6.0) so it is consistent with plot(X,Y,'o'). The old value was 20, and the new value is 36 (6^2).
Scatter markers no longer have a black edge.
If the color of the markers is not specified it will follow the
property cycle, pulling from the 'patches' cycle on the Axes.
This also changes the return value of
errorbar() as the list of 'caplines' will
be empty by default.
boxplot
Previously, boxplots were composed of a mish-mash of styles that were, for
better for worse, inherited from Matlab. Most of the elements were blue,
but the medians were red. The fliers (outliers) were black plus-symbols
('+') and the whiskers were dashed lines, which created ambiguity if
the (solid and black) caps were not drawn.
For the new defaults, everything is black except for the median and mean
lines (if drawn), which are set to the first two elements of the current
color cycle. Also, the default flier markers are now hollow circles,
which maintain the ability of the plus-symbols to overlap without
obscuring data too much.
Most artists drawn with a patch (~matplotlib.axes.Axes.bar,
~matplotlib.axes.Axes.pie, etc) no longer have a black edge by
default. The default face color is now 'C0' instead of 'b'.
The default value of the linecolor keyword argument for hexbin has
changed from 'none' to 'face'. If 'none' is now supplied, no line edges
are drawn around the hexagons.
bar and barh
The default value of the align kwarg for both
bar and barh is changed from
'edge' to 'center'.
The color of the lines in the hatch is now determined by
If an edge color is explicitly set, use that for the hatch color
If the edge color is not explicitly set, use rcParams["hatch.color"] (default: 'edge') which
is looked up at artist creation time.
The width of the lines in a hatch pattern is now configurable by the
rcParams rcParams["hatch.linewidth"] (default: 1.0), which defaults to 1 point. The old
behavior for the line width was different depending on backend:
PDF: 0.1 pt
SVG: 1.0 pt
PS: 1 px
Agg: 1 px
The old line width behavior cannot be restored across all backends
simultaneously, but can be restored for a single backend by setting:
mpl.rcParams['hatch.linewidth']=0.1# previous pdf hatch linewidthmpl.rcParams['hatch.linewidth']=1.0# previous svg hatch linewidth
The behavior of the PS and Agg backends was DPI dependent, thus:
mpl.rcParams['figure.dpi']=dpimpl.rcParams['savefig.dpi']=dpi# or leave as default 'figure'mpl.rcParams['hatch.linewidth']=1.0/dpi# previous ps and Agg hatch linewidth
There is no direct API level control of the hatch color or linewidth.
Hatching patterns are now rendered at a consistent density, regardless of DPI.
Formerly, high DPI figures would be more dense than the default, and low DPI
figures would be less dense. This old behavior cannot be directly restored,
but the density may be increased by repeating the hatch specifier.
Fonts
Normal text
The default font has changed from "Bitstream Vera Sans" to "DejaVu
Sans". DejaVu Sans has additional international and math characters,
but otherwise has the same appearance as Bitstream Vera Sans.
Latin, Greek, Cyrillic, Armenian, Georgian, Hebrew, and Arabic are
all supported
(but right-to-left rendering is still not handled by matplotlib).
In addition, DejaVu contains a sub-set of emoji symbols.
The default math font when using the built-in math rendering engine
(mathtext) has changed from "Computer Modern" (i.e. LaTeX-like) to
"DejaVu Sans". This change has no effect if the
TeX backend is used (i.e. text.usetex is True).
legend.fancybox:Falselegend.loc:upperrightlegend.numpoints:2# the number of points in the legend linelegend.fontsize:largelegend.framealpha:None# opacity of legend framelegend.scatterpoints:3# number of scatter pointslegend.
in your matplotlibrc file.
Image
Interpolation
The default interpolation method for imshow is
now 'nearest' and by default it resamples the data (both up and down
sampling) before colormapping.
image.interpolation:bilinear# see help(imshow) for optionsimage.resample:False
in your matplotlibrc file.
Colormapping pipeline
Previously, the input data was normalized, then colormapped, and then
resampled to the resolution required for the screen. This meant that
the final resampling was being done in color space. Because the color
maps are not generally linear in RGB space, colors not in the colormap
may appear in the final image. This bug was addressed by an almost
complete overhaul of the image handling code.
The input data is now normalized, then resampled to the correct
resolution (in normalized dataspace), and then colormapped to
RGB space. This ensures that only colors from the colormap appear
in the final image. (If your viewer subsequently resamples the image,
the artifact may reappear.)
The previous behavior cannot be restored.
Shading
The default shading mode for light source shading, in
matplotlib.colors.LightSource.shade, is now overlay.
Formerly, it was hsv.
Plot layout
Auto limits
The previous auto-scaling behavior was to find 'nice' round numbers
as view limits that enclosed the data limits, but this could produce
bad plots if the data happened to fall on a vertical or
horizontal line near the chosen 'round number' limit. The new default
sets the view limits to 5% wider than the data range.
The size of the padding in the x and y directions is controlled by the
'axes.xmargin' and 'axes.ymargin' rcParams respectively. Whether
the view limits should be 'round numbers' is controlled by
rcParams["axes.autolimit_mode"] (default: 'data'). In the original 'round_number' mode,
the view limits coincide with ticks.
Ticks and grids are now plotted above solid elements such as
filled contours, but below lines. To return to the previous
behavior of plotting ticks and grids above lines, set
rcParams['axes.axisbelow']=False.
Ticks
Direction
To reduce the collision of tick marks with data, the default ticks now
point outward by default. In addition, ticks are now drawn only on
the bottom and left spines to prevent a porcupine appearance, and for
a cleaner separation between subplots.
Minor ticks on a log axis are now labeled when the axis view limits
span a range less than or equal to the interval between two major
ticks. See LogFormatter for details. The
minor tick labeling is turned off when using mpl.style.use('classic'),
but cannot be controlled independently via rcParams.
The default Locator used for the x and y axis is
AutoLocator which tries to find, up to some
maximum number, 'nicely' spaced ticks. The locator now includes
an algorithm to estimate the maximum number of ticks that will leave
room for the tick labels. By default it also ensures that there are at least
two ticks visible.
There is no way, other than using mpl.style.use('classic'), to restore the
previous behavior as the default. On an axis-by-axis basis you may either
control the existing locator via:
The algorithm used by MaxNLocator has been
improved, and this may change the choice of tick locations in some
cases. This also affects AutoLocator, which
uses MaxNLocator internally.
For a log-scaled axis the default locator is the
LogLocator. Previously the maximum number
of ticks was set to 15, and could not be changed. Now there is a
numticks kwarg for setting the maximum to any integer value,
to the string 'auto', or to its default value of None which is
equivalent to 'auto'. With the 'auto' setting the maximum number
will be no larger than 9, and will be reduced depending on the
length of the axis in units of the tick font size. As in the
case of the AutoLocator, the heuristic algorithm reduces the
incidence of overlapping tick labels but does not prevent it.
ScalarFormatter tick label formatting with offsets
With the default rcParams["axes.formatter.useoffset"] (default: True),
an offset will be used when it will save 4 or more digits. This can
be controlled with the new rcParams["axes.formatter.offset_threshold"] (default: 4).
To restore the previous behavior of using an offset to save 2 or more
digits, use rcParams['axes.formatter.offset_threshold']=2.
The default date formats are now all based on ISO format, i.e., with
the slowest-moving value first. The date formatters are
configurable through the date.autoformatter.* rcParams.
Threshold (tick interval >= than)
rcParam
classic
v2.0
365 days
'date.autoformatter.year'
'%Y'
'%Y'
30 days
'date.autoformatter.month'
'%b%Y'
'%Y-%m'
1 day
'date.autoformatter.day'
'%b%d%Y'
'%Y-%m-%d'
1 hour
'date.autoformatter.hour'
'%H:%M:%S'
'%H:%M'
1 minute
'date.autoformatter.minute'
'%H:%M:%S.%f'
'%H:%M:%S'
1 second
'date.autoformatter.second'
'%H:%M:%S.%f'
'%H:%M:%S'
1 microsecond
'date.autoformatter.microsecond'
'%H:%M:%S.%f'
'%H:%M:%S.%f'
Python's %x and %X date formats may be of particular interest
to format dates based on the current locale.