8000 Merge branch 'master' into latex_15796 · matplotlib/matplotlib@e01fe33 · GitHub
[go: up one dir, main page]

Skip to content

Commit e01fe33

Browse files
committed
Merge branch 'master' into latex_15796
2 parents 1959cdb + 6d3f283 commit e01fe33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1182
-1012
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ matrix:
9898
- $HOME/.ccache # https://github.com/travis-ci/travis-ci/issues/5853
9999
- $HOME/.cache/matplotlib
100100
allow_failures:
101+
- python: "nightly"
101102

102103
before_install: |
103104
case "$TRAVIS_OS_NAME" in

doc/conf.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ def _check_dependencies():
298298

299299
latex_documents = [
300300
('contents', 'Matplotlib.tex', 'Matplotlib',
301-
'John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the '
302-
'matplotlib development team', 'manual'),
301+
'John Hunter\\and Darren Dale\\and Eric Firing\\and Michael Droettboom'
302+
'\\and and the matplotlib development team', 'manual'),
303303
]
304304

305305

@@ -363,6 +363,12 @@ def _check_dependencies():
363363

364364
# Additional stuff for the LaTeX preamble.
365365
latex_elements['preamble'] = r"""
366+
% One line per author on title page
367+
\DeclareRobustCommand{\and}%
368+
{\end{tabular}\kern-\tabcolsep\\\begin{tabular}[t]{c}}%
369+
% In the parameters section, place a newline after the Parameters
370+
% header. (This is stolen directly from Numpy's conf.py, since it
371+
% affects Numpy-style docstrings).
366372
\usepackage{expdlist}
367373
\let\latexdescription=\description
368374
\def\description{\latexdescription{}{} \breaklabel}

doc/faq/howto_faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ off on a per-axis basis::
103103

104104
ax.get_xaxis().get_major_formatter().set_useOffset(False)
105105

106-
set the rcParam ``axes.formatter.useoffset``, or use a different
106+
set :rc:`axes.formatter.useoffset`, or use a different
107107
formatter. See :mod:`~matplotlib.ticker` for details.
108108

109109
.. _howto-transparent:

doc/users/dflt_style_changes.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ The following changes were made to the default behavior of
276276
`~matplotlib.axes.Axes.scatter`
277277

278278
- The default size of the elements in a scatter plot is now based on
279-
the rcParam ``lines.markersize`` so it is consistent with ``plot(X,
279+
:rc:`lines.markersize` so it is consistent with ``plot(X,
280280
Y, 'o')``. The old value was 20, and the new value is 36 (6^2).
281281
- Scatter markers no longer have a black edge.
282282
- If the color of the markers is not specified it will follow the
@@ -643,7 +643,7 @@ Hatching
643643
The color of the lines in the hatch is now determined by
644644

645645
- If an edge color is explicitly set, use that for the hatch color
646-
- If the edge color is not explicitly set, use ``rcParam['hatch.color']`` which
646+
- If the edge color is not explicitly set, use :rc:`hatch.color` which
647647
is looked up at artist creation time.
648648

649649
The width of the lines in a hatch pattern is now configurable by the
@@ -948,8 +948,8 @@ sets the view limits to 5% wider than the data range.
948948

949949
The size of the padding in the x and y directions is controlled by the
950950
``'axes.xmargin'`` and ``'axes.ymargin'`` rcParams respectively. Whether
951-
the view limits should be 'round numbers' is controlled by the
952-
``'axes.autolimit_mode'`` rcParam. In the original ``'round_number'`` mode,
951+
the view limits should be 'round numbers' is controlled by
952+
:rc:`axes.autolimit_mode`. In the original ``'round_number'`` mode,
953953
the view limits coincide with ticks.
954954

955955
The previous default can be restored by using::
@@ -1132,7 +1132,7 @@ but cannot be controlled independently via ``rcParams``.
11321132

11331133
With the default of ``rcParams['axes.formatter.useoffset'] = True``,
11341134
an offset will be used when it will save 4 or more digits. This can
1135-
be controlled with the new rcParam, ``axes.formatter.offset_threshold``.
1135+
be controlled with the new :rc:`axes.formatter.offset_threshold`.
11361136
To restore the previous behavior of using an offset to save 2 or more
11371137
digits, use ``rcParams['axes.formatter.offset_threshold'] = 2``.
11381138

examples/axes_grid1/make_room_for_ylabel_using_axesgrid.py

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,59 @@
44
===================================
55
66
"""
7+
8+
import matplotlib.pyplot as plt
9+
710
from mpl_toolkits.axes_grid1 import make_axes_locatable
811
from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable
912

1013

11-
if __name__ == "__main__":
12-
13-
import matplotlib.pyplot as plt
14+
plt.figure()
15+
ax = plt.axes([0, 0, 1, 1])
1416

15-
def ex1():
16-
plt.figure(1)
17-
ax = plt.axes([0, 0, 1, 1])
18-
#ax = plt.subplot(111)
17+
ax.set_yticks([0.5])
18+
ax.set_yticklabels(["very long label"])
1919

20-
ax.set_yticks([0.5])
21-
ax.set_yticklabels(["very long label"])
20+
make_axes_area_auto_adjustable(ax)
2221

23-
make_axes_area_auto_adjustable(ax)
22+
###############################################################################
2423

25-
def ex2():
2624

27-
plt.figure(2)
28-
ax1 = plt.axes([0, 0, 1, 0.5])
29-
ax2 = plt.axes([0, 0.5, 1, 0.5])
25+
plt.figure()
26+
ax1 = plt.axes([0, 0, 1, 0.5])
27+
ax2 = plt.axes([0, 0.5, 1, 0.5])
3028

31-
ax1.set_yticks([0.5])
32-
ax1.set_yticklabels(["very long label"])
33-
ax1.set_ylabel("Y label")
29+
ax1.set_yticks([0.5])
30+
ax1.set_yticklabels(["very long label"])
31+
ax1.set_ylabel("Y label")
3432

35-
ax2.set_title("Title")
33+
ax2.set_title("Title")
3634

37-
make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2])
38-
make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2])
35+
make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2])
36+
make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2])
3937

40-
def ex3():
38+
###############################################################################
4139

42-
fig = plt.figure(3)
43-
ax1 = plt.axes([0, 0, 1, 1])
44-
divider = make_axes_locatable(ax1)
4540

46-
ax2 = divider.new_horizontal("100%", pad=0.3, sharey=ax1)
47-
ax2.tick_params(labelleft=False)
48-
fig.add_axes(ax2)
41+
fig = plt.figure()
42+
ax1 = plt.axes([0, 0, 1, 1])
43+
divider = make_axes_locatable(ax1)
4944

50-
divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1,
51-
adjust_dirs=["left"])
52-
divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1,
53-
adjust_dirs=["right"])
54-
divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1,
55-
adjust_dirs=["top", "bottom"])
45+
ax2 = divider.new_horizontal("100%", pad=0.3, sharey=ax1)
46+
ax2.tick_params(labelleft=False)
47+
fig.add_axes(ax2)
5648

57-
ax1.set_yticks([0.5])
58-
ax1.set_yticklabels(["very long label"])
49+
divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1,
50+
adjust_dirs=["left"])
51+
divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1,
52+
adjust_dirs=["right"])
53+
divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1,
54+
adjust_dirs=["top", "bottom"])
5955

60-
ax2.set_title("Title")
61-
ax2.set_xlabel("X - Label")
56+
ax1.set_yticks([0.5])
57+
ax1.set_yticklabels(["very long label"])
6258

63-
ex1()
64-
ex2()
65-
ex3()
59+
ax2.set_title("Title")
60+
ax2.set_xlabel("X - Label")
6661

67-
plt.show()
62+
plt.show()

examples/lines_bars_and_markers/filled_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
9292
sty_cycle : Cycler or operable of dict
9393
Style to apply to each set
9494
95-
bottoms : array, optional
96-
The initial positions of the bottoms, defaults to 0
95+
bottoms : array, optional, default: 0
96+
The initial positions of the bottoms.
9797
9898
hist_func : callable, optional
9999
Must have signature `bin_vals, bin_edges = f(data)`.

examples/misc/zorder_demo.py

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,69 @@
33
Zorder Demo
44
===========
55
6-
The default drawing order for axes is patches, lines, text. This
7-
order is determined by the zorder attribute. The following defaults
8-
are set
6+
The drawing order of artists is determined by their ``zorder`` attribute, which
7+
is a floating point number. Artists with higher ``zorder`` are drawn on top.
8+
You can change the order for individual artists by setting their ``zorder``.
9+
The default value depends on the type of the Artist:
910
10-
======================= =======
11-
Artist Z-order
12-
======================= =======
13-
Patch / PatchCollection 1
14-
Line2D / LineCollection 2
15-
Text 3
16-
======================= =======
11+
================================================================ =======
12+
Artist Z-order
13+
================================================================ =======
14+
Images (`.AxesImage`, `.FigureImage`, `.BboxImage`) 0
15+
`.Patch`, `.PatchCollection` 1
16+
`.Line2D`, `.LineCollection` (including minor ticks, grid lines) 2
17+
Major ticks 2.01
18+
`.Text` (including axes labels and titles) 3
19+
`.Legend` 5
20+
================================================================ =======
1721
18-
You can change the order for individual artists by setting the zorder. Any
19-
individual plot() call can set a value for the zorder of that particular item.
22+
Any call to a plotting method can set a value for the zorder of that particular
23+
item explicitly.
2024
21-
In the fist subplot below, the lines are drawn above the patch
22-
collection from the scatter, which is the default.
25+
.. note::
2326
24-
In the subplot below, the order is reversed.
25-
26-
The second figure shows how to control the zorder of individual lines.
27+
`~.axes.Axes.set_axisbelow` and :rc:`axes.axisbelow` can further modify the
28+
zorder of ticks and grid lines.
2729
"""
2830

2931
import matplotlib.pyplot as plt
3032
import numpy as np
3133

32-
# Fixing random state for reproducibility
33-
np.random.seed(19680801)
34+
r = np.linspace(0.3, 1, 30)
35+
theta = np.linspace(0, 4*np.pi, 30)
36+
x = r * np.sin(theta)
37+
y = r * np.cos(theta)
3438

39+
###############################################################################
40+
# The following example contains a `.Line2D` created by `~.axes.Axes.plot()`
41+
# and the dots (a `.PatchCollection`) created by `~.axes.Axes.scatter()`.
42+
# Hence, by default the dots are below the line (first subplot).
43+
# In the second subplot, the ``zorder`` is set explicitly to move the dots
44+
# on top of the line.
3545

36-
x = np.random.random(20)
37-
y = np.random.random(20)
46+
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3.2))
3847

39-
###############################################################################
40-
# Lines on top of scatter
48+
ax1.plot(x, y, 'C3', lw=3)
49+
ax1.scatter(x, y, s=120)
50+
ax1.set_title('Lines on top of dots')
4151

42-
plt.figure()
43-
plt.subplot(211)
44-
plt.plot(x, y, 'C3', lw=3)
45-
plt.scatter(x, y, s=120)
46-
plt.title('Lines on top of dots')
52+
ax2.plot(x, y, 'C3', lw=3)
53+
ax2.scatter(x, y, s=120, zorder=2.5) # move dots on top of line
54+
ax2.set_title('D 48DA ots on top of lines')
4755

48-
# Scatter plot on top of lines
49-
plt.subplot(212)
50-
plt.plot(x, y, 'C3', zorder=1, lw=3)
51-
plt.scatter(x, y, s=120, zorder=2)
52-
plt.title('Dots on top of lines')
5356
plt.tight_layout()
5457

5558
###############################################################################
56-
# A new figure, with individually ordered items
59+
# Many functions that create a visible object accepts a ``zorder`` parameter.
60+
# Alternatively, you can call ``set_order()`` on the created object later.
5761

58-
x = np.linspace(0, 2*np.pi, 100)
59-
plt.rcParams['lines.linewidth'] = 10
62+
x = np.linspace(0, 7.5, 100)
63+
plt.rcParams['lines.linewidth'] = 5
6064
plt.figure()
61-
plt.plot(x, np.sin(x), label='zorder=10', zorder=10) # on top
62-
plt.plot(x, np.sin(1.1*x), label='zorder=1', zorder=1) # bottom
63-
plt.plot(x, np.sin(1.2*x), label='zorder=3', zorder=3)
64-
plt.axhline(0, label='zorder=2', color='grey', zorder=2)
65+
plt.plot(x, np.sin(x), label='zorder=2', zorder=2) # bottom
66+
plt.plot(x, np.sin(x+0.5), label='zorder=3', zorder=3)
67+
plt.axhline(0, label='zorder=2.5', color='lightgrey', zorder=2.5)
6568
plt.title('Custom order of elements')
6669
l = plt.legend(loc='upper right')
67-
l.set_zorder(20) # put the legend on top
70+
l.set_zorder(2.5) # legend between blue and orange line
6871
plt.show()

lib/matplotlib/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,11 +1224,11 @@ def use(backend, warn=False, force=True):
12241224
12251225
or a string of the form: ``module://my.module.name``.
12261226
1227-
warn : bool, optional, default: False
1227+
warn : bool, default: False
12281228
If True and not *force*, emit a warning if a failure-to-switch
12291229
`ImportError` has been suppressed. This parameter is deprecated.
12301230
1231-
force : bool, optional, default: True
1231+
force : bool, default: True
12321232
If True (the default), raise an `ImportError` if the backend cannot be
12331233
set up (either because it fails to import, or because an incompatible
12341234
GUI interactive framework is already running); if False, ignore the
@@ -1477,10 +1477,10 @@ def func(ax, *args, **kwargs): ...
14771477
14781478
Parameters
14791479
----------
1480-
replace_names : list of str or None, optional, default: None
1480+
replace_names : list of str or None, default: None
14811481
The list of parameter names for which lookup into *data* should be
14821482
attempted. If None, replacement is attempted for all arguments.
1483-
label_namer : str, optional, default: None
1483+
label_namer : str, default: None
14841484
If set e.g. to "namer" (which must be a kwarg in the function's
14851485
signature -- not as ``**kwargs``), if the *namer* argument passed in is
14861486
a (string) key of *data* and no *label* kwarg is passed, then use the

lib/matplotlib/_cm.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,20 @@ def cubehelix(gamma=1.0, s=0.5, r=-1.5, h=1.0):
8484
element. This color element is calculated in a plane of constant
8585
perceived intensity and controlled by the following parameters.
8686
87-
Optional keyword arguments:
88-
89-
========= =======================================================
90-
Keyword Description
91-
========= =======================================================
92-
gamma gamma factor to emphasise either low intensity values
93-
(gamma < 1), or high intensity values (gamma > 1);
94-
defaults to 1.0.
95-
s the start color; defaults to 0.5 (i.e. purple).
96-
r the number of r, g, b rotations in color that are made
97-
from the start to the end of the color scheme; defaults
98-
to -1.5 (i.e. -> B -> G -> R -> B).
99-
h the hue parameter which controls how saturated the
100-
colors are. If this parameter is zero then the color
101-
scheme is purely a greyscale; defaults to 1.0.
102-
========= =======================================================
87+
Parameters
88+
----------
89+
gamma : float, optional, default: 1
90+
Gamma factor emphasizing either low intensity values (gamma < 1), or
91+
high intensity values (gamma > 1).
92+
s : float, optional, default: 0.5 (purple)
93+
The starting color.
94+
r : float, optional, default: -1.5
95+
The number of r, g, b rotations in color that are made from the start
96+
to the end of the color scheme. The default of -1.5 corresponds to ->
97+
B -> G -> R -> B.
98+
h : float, optional, default: 1
99+
The hue, i.e. how saturated the colors are. If this parameter is zero
100+
then the color scheme is purely a greyscale.
103101
"""
104102
return {'red': partial(_ch_helper, gamma, s, r, h, -0.14861, 1.78277),
105103
'green': partial(_ch_helper, gamma, s, r, h, -0.29227, -0.90649),

lib/matplotlib/artist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def get_visible(self):
802802
return self._visible
803803

804804
def get_animated(self):
805-
"""Return the animated state."""
805+
"""Return whether the artist is animated."""
806806
return self._animated
807807

808808
def get_in_layout(self):
@@ -1072,7 +1072,7 @@ def sticky_edges(self):
10721072
return self._sticky_edges
10731073

10741074
def update_from(self, other):
1075-
'Copy properties from *other* to *self*.'
1075+
""""Copy properties from *other* to *self*."""
10761076
self._transform = other._transform
10771077
self._transformSet = other._transformSet
10781078
self._visible = other._visible

0 commit comments

Comments
 (0)
0