Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92b5c95

Browse files
authored
Merge pull request #7284 from QuLogic/backports-2.0
Backports for 2.0
2 parents a869cc0 + 734b702 commit 92b5c95

File tree

142 files changed

+4413
-4250
lines changed

Some content is hidden

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

142 files changed

+4413
-4250
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ env:
4141
- PANDAS=
4242
- NPROC=2
4343
- TEST_ARGS=--no-pep8
44+
- DELETE_FONT_CACHE=
4445

4546
language: python
4647

@@ -50,7 +51,7 @@ matrix:
5051
env: MOCK=mock NUMPY=numpy==1.6
5152
- python: 3.4
5253
- python: 3.5
53-
env: PANDAS=pandas
54+
env: PANDAS=pandas DELETE_FONT_CACHE=1
5455
- python: 2.7
5556
env: TEST_ARGS=--pep8
5657
- python: 2.7
@@ -123,6 +124,9 @@ script:
123124
echo Testing using $NPROC processes
124125
echo The following args are passed to nose $NOSE_ARGS
125126
if [[ $BUILD_DOCS == false ]]; then
127+
if [[ $DELETE_FONT_CACHE == 1 ]]; then
128+
rm -rf ~/.cache/matplotlib
129+
fi
126130
export MPL_REPO_DIR=$PWD # needed for pep8-conformance test of the examples
127131
gdb -return-child-result -batch -ex r -ex bt --args python tests.py -s --processes=$NPROC --process-timeout=300 $TEST_ARGS
128132
else

doc/faq/howto_faq.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@ How-To
1414
Plotting: howto
1515
===============
1616

17+
.. _howto-datetime64:
18+
19+
Plot `numpy.datetime64` values
20+
------------------------------
21+
22+
For matplotlib to plot dates (or any scalar with units) a converter
23+
to float needs to be registered with the `matplolib.units` module. The
24+
current best converters for `datetime64` values are in `pandas`. Simply
25+
importing `pandas` ::
26+
27+
import pandas as pd
28+
29+
should be sufficient as `pandas` will try to install the converters
30+
on import. If that does not work, or you need to reset `munits.registry`
31+
you can explicitly install the `pandas` converters by ::
32+
33+
from pandas.tseries import converter as pdtc
34+
pdtc.register()
35+
36+
If you only want to use the `pandas` converter for `datetime64` values ::
37+
38+
from pandas.tseries import converter as pdtc
39+
import matplotlib.units as munits
40+
import numpy as np
41+
42+
munits.registry[np.datetime64] = pdtc.DatetimeConverter()
43+
44+
45+
1746
.. _howto-findobj:
1847

1948
Find all objects in a figure of a certain type
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:mod:`mpl_toolkits.axes_grid1.anchored_artists`
2+
===============================================
3+
4+
.. automodule:: mpl_toolkits.axes_grid1.anchored_artists
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

doc/mpl_toolkits/axes_grid/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424

2525
.. toctree::
2626

27+
anchored_artists_api.rst
2728
inset_locator_api.rst

doc/users/customizing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Using style sheets
88
==================
99

1010
The ``style`` package adds support for easy-to-switch plotting "styles" with
11-
the same parameters as a matplotlibrc_ file.
11+
the same parameters as a matplotlibrc_ file (which is read at startup to
12+
configure matplotlib).
1213

1314
There are a number of pre-defined styles provided by matplotlib. For
1415
example, there's a pre-defined style called "ggplot", which emulates the

doc/users/navigation_toolbar.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ the buttons at the bottom of the toolbar
1515

1616
.. image:: ../../lib/matplotlib/mpl-data/images/forward_large.png
1717

18-
The ``Forward`` and ``Back`` buttons
19-
These are akin to the web browser forward and back buttons. They
20-
are used to navigate back and forth between previously defined
21-
views. They have no meaning unless you have already navigated
22-
somewhere else using the pan and zoom buttons. This is analogous
18+
The ``Home``, ``Forward`` and ``Back`` buttons
19+
These are akin to a web browser's home, forward and back controls.
20+
``Forward`` and ``Back`` are used to navigate back and forth between
21+
previously defined views. They have no meaning unless you have already
22+
navigated somewhere else using the pan and zoom buttons. This is analogous
2323
to trying to click ``Back`` on your web browser before visiting a
24-
new page --nothing happens. ``Home`` always takes you to the
25-
first, default view of your data. For ``Home``, ``Forward`` and
26-
``Back``, think web browser where data views are web pages. Use
27-
the pan and zoom to rectangle to define new views.
24+
new page or ``Forward`` before you have gone back to a page --
25+
nothing happens. ``Home`` always takes you to the
26+
first, default view of your data. Again, all of these buttons should
27+
feel very familiar to any user of a web browser.
2828

2929
.. image:: ../../lib/matplotlib/mpl-data/images/move_large.png
3030

@@ -37,11 +37,11 @@ The ``Pan/Zoom`` button
3737
where you released. If you press 'x' or 'y' while panning the
3838
motion will be constrained to the x or y axis, respectively. Press
3939
the right mouse button to zoom, dragging it to a new position.
40-
The x axis will be zoomed in proportionate to the rightward
41-
movement and zoomed out proportionate to the leftward movement.
42-
Ditto for the y axis and up/down motions. The point under your
40+
The x axis will be zoomed in proportionately to the rightward
41+
movement and zoomed out proportionately to the leftward movement.
42+
The same is true for the y axis and up/down motions. The point under your
4343
mouse when you begin the zoom remains stationary, allowing you to
44-
zoom to an arbitrary point in the figure. You can use the
44+
zoom in or out around that point as much as you wish. You can use the
4545
modifier keys 'x', 'y' or 'CONTROL' to constrain the zoom to the x
4646
axis, the y axis, or aspect ratio preserve, respectively.
4747

@@ -54,7 +54,7 @@ The ``Pan/Zoom`` button
5454

5555
The ``Zoom-to-rectangle`` button
5656
Click this toolbar button to activate this mode. Put your mouse
57-
somewhere over and axes and press the left mouse button. Drag the
57+
somewhere over an axes and press the left mouse button. Drag the
5858
mouse while holding the button to a new location and release. The
5959
axes view limits will be zoomed to the rectangle you have defined.
6060
There is also an experimental 'zoom out to rectangle' in this mode

doc/users/text_intro.rst

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33
Text introduction
44
=================
55

6-
matplotlib has excellent text support, including mathematical
7-
expressions, truetype support for raster and vector outputs, newline
8-
separated text with arbitrary rotations, and unicode support. Because
9-
we embed the fonts directly in the output documents, e.g., for postscript
6+
matplotlib has extensive text support, including support for
7+
mathematical expressions, truetype support for raster and
8+
vector outputs, newline separated text with arbitrary
9+
rotations, and unicode support. Because it embeds
10+
fonts directly in output documents, e.g., for postscript
1011
or PDF, what you see on the screen is what you get in the hardcopy.
1112
`FreeType <http://www.freetype.org/>`_ support
1213
produces very nice, antialiased fonts, that look good even at small
1314
raster sizes. matplotlib includes its own
14-
:mod:`matplotlib.font_manager`, thanks to Paul Barrett, which
15-
implements a cross platform, W3C compliant font finding algorithm.
16-
17-
You have total control over every text property (font size, font
18-
weight, text location and color, etc) with sensible defaults set in
19-
the rc file. And significantly for those interested in mathematical
15+
:mod:`matplotlib.font_manager` (thanks to Paul Barrett), which
16+
implements a cross platform, `W3C <http://www.w3.org/>`
17+
compliant font finding algorithm.
18+
19+
The user has a great deal of control over text properties (font size, font
20+
weight, text location and color, etc.) with sensible defaults set in
21+
the `rc file <http://matplotlib.org/users/customizing.html>`.
22+
And significantly, for those interested in mathematical
2023
or scientific figures, matplotlib implements a large number of TeX
21-
math symbols and commands, to support :ref:`mathematical expressions
24+
math symbols and commands, supporting :ref:`mathematical expressions
2225
<mathtext-tutorial>` anywhere in your figure.
2326

2427

@@ -31,10 +34,10 @@ interface
3134
* :func:`~matplotlib.pyplot.text` - add text at an arbitrary location to the ``Axes``;
3235
:meth:`matplotlib.axes.Axes.text` in the API.
3336

34-
* :func:`~matplotlib.pyplot.xlabel` - add an axis label to the x-axis;
37+
* :func:`~matplotlib.pyplot.xlabel` - add a label to the x-axis;
3538
:meth:`matplotlib.axes.Axes.set_xlabel` in the API.
3639

37-
* :func:`~matplotlib.pyplot.ylabel` - add an axis label to the y-axis;
40+
* :func:`~matplotlib.pyplot.ylabel` - add a label to the y-axis;
3841
:meth:`matplotlib.axes.Axes.set_ylabel` in the API.
3942

4043
* :func:`~matplotlib.pyplot.title` - add a title to the ``Axes``;

doc/users/whats_new/2015-11-05_hidpi.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/axes_grid/simple_anchored_artists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def draw_text(ax):
5-
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredText
5+
from matplotlib.offsetbox import AnchoredText
66
at = AnchoredText("Figure 1a",
77
loc=2, prop=dict(size=8), frameon=True,
88
)

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,9 @@ def destroy(*args):
609609
self.window.update()
610610
else:
611611
self.canvas.draw_idle()
612+
# Raise the new window.
613+
self.canvas.manager.window.attributes('-topmost', 1)
614+
self.canvas.manager.window.attributes('-topmost', 0)
612615
self._shown = True
613616

614617
def destroy(self, *args):

lib/matplotlib/mathtext.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@ def __init__(self, *args, **kwargs):
896896
self.fontmap = {}
897897
# Include Stix sized alternatives for glyphs
898898
self._fontmap.update({
899-
0 : 'STIXGeneral',
900899
1 : 'STIXSizeOneSym',
901900
2 : 'STIXSizeTwoSym',
902901
3 : 'STIXSizeThreeSym',
@@ -938,6 +937,7 @@ class DejaVuSerifFonts(DejaVuFonts):
938937
'sf' : 'DejaVu Sans',
939938
'tt' : 'DejaVu Sans Mono',
940939
'ex' : 'DejaVu Serif Display',
940+
0 : 'DejaVu Serif',
941941
}
942942

943943
class DejaVuSansFonts(DejaVuFonts):
@@ -952,6 +952,7 @@ class DejaVuSansFonts(DejaVuFonts):
952952
'sf' : 'DejaVu Sans',
953953
'tt' : 'DejaVu Sans Mono',
954954
'ex' : 'DejaVu Sans Display',
955+
0 : 'DejaVu Sans',
955956
}
956957

957958
class StixFonts(UnicodeFonts):
@@ -2003,20 +2004,28 @@ def __init__(self, c, height, depth, state, always=False, factor=None):
20032004
alternatives = state.font_output.get_sized_alternatives_for_symbol(
20042005
state.font, c)
20052006

2007+
xHeight = state.font_output.get_xheight(
2008+
state.font, state.fontsize, state.dpi)
2009+
20062010
state = state.copy()
20072011
target_total = height + depth
20082012
for fontname, sym in alternatives:
20092013
state.font = fontname
20102014
char = Char(sym, state)
2011-
if char.height + char.depth >= target_total:
2015+
# Ensure that size 0 is chosen when the text is regular sized but
2016+
# with descender glyphs by subtracting 0.2 * xHeight
2017+
if char.height + char.depth >= target_total - 0.2 * xHeight:
20122018
break
20132019

2014-
if factor is None:
2015-
factor = target_total / (char.height + char.depth)
2016-
state.fontsize *= factor
2017-
char = Char(sym, state)
2020+
shift = 0
2021+
if state.font != 0:
2022+
if factor is None:
2023+
factor = (target_total) / (char.height + char.depth)
2024+
state.fontsize *= factor
2025+
char = Char(sym, state)
2026+
2027+
shift = (depth - char.depth)
20182028

2019-
shift = (depth - char.depth)
20202029
Hlist.__init__(self, [char])
20212030
self.shift_amount = shift
20222031

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
11951195
11961196
"""
11971197
if head_width is None:
1198-
head_width = 20 * width
1198+
head_width = 3 * width
11991199
if head_length is None:
12001200
head_length = 1.5 * head_width
12011201

Binary file not shown.

0 commit comments

Comments
 (0)