X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ce92859
FIX: always decode bytes as utf-8 in AFM headers
tacaswell Feb 4, 2017
e4d0174
Correctly close glyph contours that use curves.
QuLogic Feb 6, 2017
86012ca
Add test for font stroking.
QuLogic Feb 6, 2017
2b3e043
Update path effect images that use font contours.
QuLogic Feb 6, 2017
4ee9ed8
Merge pull request #8101 from goldstarwebs/master
NelleV Feb 20, 2017
419da79
Qt5: Fix event positions on HiDPI screens.
QuLogic Feb 21, 2017
1d87fba
Merge pull request #8137 from aashil/regenerate-gitwash-docs
dstansby Feb 26, 2017
856764e
Merge pull request #8161 from aashil/fix-doc-syntax
tacaswell Feb 27, 2017
c49bb3a
Merge pull request #8167 from katzenbaer/fixes-artists-docs
dstansby Feb 28, 2017
e01596e
Merge pull request #8139 from madphysicist/patch-1
NelleV Feb 24, 2017
6e52c51
Merge pull request #8178 from epintozzi/readme_badges
dstansby Mar 2, 2017
343f5fc
TST afm._to_str is now tested against utf8-encoded bytes
NelleV Mar 11, 2017
9278668
Merge pull request #19 from NelleV/tacaswell_fix_nonascii_afm
tacaswell Mar 12, 2017
61758e3
TST: add future imports
tacaswell Mar 12, 2017
7cdab88
TST: tweak and whitelist test
tacaswell Mar 13, 2017
b16705d
DOC: missing API docs from #8032
tacaswell Mar 13, 2017
5f54543
FIX: do not skip isolated points in vector outputs
tacaswell Mar 14, 2017
371b8b1
Merge pull request #8297 from tacaswell/fix_missing_marker
NelleV Mar 15, 2017
5496805
Merge pull request #8028 from QuLogic/font-contour-close
NelleV Mar 15, 2017
415d39a
Merge pull request #8144 from QuLogic/qt5-hidpi-fixes
NelleV Mar 15, 2017
8892fb2
DOC small tweaks to API doc on scaling dashes
NelleV Mar 16, 2017
27030ed
Merge pull request #20 from NelleV/tacaswell_doc_lw_scale_api_changes
tacaswell Mar 17, 2017
9d1e456
Skip more deprecated colormaps in example.
QuLogic Mar 18, 2017
d2e813d
Merge pull request #8285 from tacaswell/doc_lw_scale_api_changes
QuLogic Mar 18, 2017
2b119b6
Merge pull request #8323 from QuLogic/cmap-deprecations
anntzer Mar 18, 2017
1667a0c
FIX reviewers's comment
NelleV Mar 19, 2017
b4a8191
FIX Added encoding comment in test_afm for py2.7
NelleV Mar 19, 2017
47eb989
Merge pull request #8021 from tacaswell/fix_nonascii_afm
tacaswell Mar 20, 2017
eb5950b
BUG: Remove mathtext default shim for ticker (Fixes #8017)
dopplershift Mar 20, 2017
5128cf2
Merge pull request #8354 from dopplershift/remove-shim
NelleV Mar 21, 2017
e5a7c08
Add missing whitespaces in gridspec tutorial
afvincent Mar 23, 2017
360da63
gridspec <- GridSpec when speakig of gridspec.GridSpec
afvincent Mar 23, 2017
855069d
Add a few cross-references (+ fix minor typos)
afvincent Mar 23, 2017
0d54023
Merge pull request #8364 from afvincent/fix_typos_in_gridspec_tutorial
NelleV Mar 23, 2017
5e3df66
Merge pull request #8371 from phobson/pie-docstring
QuLogic Mar 25, 2017
40fa9d3
Merge pull request #8328 from jli/patch-1
NelleV Mar 18, 2017
2e5a765
Merge pull request #8175 from anntzer/artist-class-intersphinx-entry
NelleV Mar 6, 2017
932d469
Merge pull request #8254 from yinleon/units
dstansby Mar 25, 2017
6750f68
Merge pull request #8212 from NelleV/MEP12_ticks_and_spines
anntzer Mar 7, 2017
f49fe39
Merge pull request #8215 from NelleV/MEP12_showcase
dstansby Mar 7, 2017
c8b4db8
Merge pull request #8221 from afvincent/doc_early_check_for_dot
NelleV Mar 8, 2017
36ec04f
Merge pull request #8343 from patniharshit/arrowStyleDocstring
QuLogic Mar 24, 2017
a003902
Merge pull request #8103 from afvincent/enh_use_xdg_config_path_on_fr…
NelleV Feb 20, 2017
26ffec5
Merge pull request #8149 from anntzer/DISPLAY-check-on-PyQt5
NelleV Mar 19, 2017
058f6b1
Merge pull request #8196 from kenmaca/pr-dash-verification-8141
NelleV Mar 8, 2017
3ff1153
Merge pull request #8244 from ResidentMario/8225
NelleV Mar 12, 2017
a538693
Merge pull request #8287 from tacaswell/fix_picks_rrulewrapper
QuLogic Mar 19, 2017
64b9ece
Merge pull request #8331 from anntzer/dont-use-__builtins__
NelleV Mar 20, 2017
6a6bcb3
Merge pull request #8367 from ColinDruery/master
NelleV Mar 23, 2017
a503de5
test_tightlayout is now pep8-clean.
QuLogic Mar 27, 2017
4d4f8d3
Merge branch 'v2.0.0-doc' into v2.0.x
QuLogic Mar 27, 2017
c44556f
Merge branch 'v2.0.x'
QuLogic Mar 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.. |PyPi| image:: https://badge.fury.io/py/matplotlib.svg
.. _PyPi: https://badge.fury.io/py/matplotlib

.. |Gitter| image:: https://img.shields.io/gitter/room/nwjs/nw.js.svg
.. |Gitter| image:: https://img.shields.io/gitter/room/nwjs/nw.js.svg
:target: https://gitter.im/matplotlib/matplotlib?utm_source=share-link&utm_medium=link&utm_campaign=share-link

.. |Depsy| image:: http://depsy.org/api/package/pypi/matplotlib/badge.svg
Expand Down
11 changes: 11 additions & 0 deletions doc/api/api_changes/2017-02-06_TAC.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Do not clip line width when scaling dashes
``````````````````````````````````````````

The algorithm to scale dashes was changed to no longer clip the
scaling factor: the dash patterns now continue to shrink at thin line widths.
If the line width is smaller than the effective pixel size, this may result in
dashed lines turning into solid gray-ish lines. This also required slightly
tweaking the default patterns for '--', ':', and '.-' so that with the default
line width the final patterns would not change.

There is no way to restore the old behavior.
71 changes: 37 additions & 34 deletions doc/users/gridspec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,47 @@
Customizing Location of Subplot Using GridSpec
**********************************************

``GridSpec``
:class:`~matplotlib.gridspec.GridSpec`
specifies the geometry of the grid that a subplot will be
placed. The number of rows and number of columns of the grid
need to be set. Optionally, the subplot layout parameters
(e.g., left, right, etc.) can be tuned.

``SubplotSpec``
:class:`~matplotlib.gridspec.SubplotSpec`
specifies the location of the subplot in the given *GridSpec*.

``subplot2grid``
a helper function that is similar to "pyplot.subplot" but uses
0-based indexing and let subplot to occupy multiple cells.
:func:`~matplotlib.pyplot.subplot2grid`
a helper function that is similar to :func:`~matplotlib.pyplot.subplot`
but uses 0-based indexing and let subplot to occupy multiple cells.


Basic Example of using subplot2grid
===================================

To use subplot2grid, you provide geometry of the grid and the location
of the subplot in the grid. For a simple single-cell subplot::
To use :func:`~matplotlib.pyplot.subplot2grid`, you provide geometry of
the grid and the location of the subplot in the grid. For a simple
single-cell subplot::

ax = plt.subplot2grid((2,2),(0, 0))
ax = plt.subplot2grid((2, 2), (0, 0))

is identical to ::

ax = plt.subplot(2,2,1)
ax = plt.subplot(2, 2, 1)

Note that, unlike matplotlib's subplot, the index starts from 0 in gridspec.
Note that, unlike Matplotlib's subplot, the index starts from 0 in GridSpec.

To create a subplot that spans multiple cells, ::

ax2 = plt.subplot2grid((3,3), (1, 0), colspan=2)
ax3 = plt.subplot2grid((3,3), (1, 2), rowspan=2)
ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)

For example, the following commands ::

ax1 = plt.subplot2grid((3,3), (0,0), colspan=3)
ax2 = plt.subplot2grid((3,3), (1,0), colspan=2)
ax3 = plt.subplot2grid((3,3), (1, 2), rowspan=2)
ax4 = plt.subplot2grid((3,3), (2, 0))
ax5 = plt.subplot2grid((3,3), (2, 1))
ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3)
ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
ax4 = plt.subplot2grid((3, 3), (2, 0))
ax5 = plt.subplot2grid((3, 3), (2, 1))

creates

Expand All @@ -54,47 +55,48 @@ creates
GridSpec and SubplotSpec
========================

You can create GridSpec explicitly and use them to create a Subplot.
You can create :class:`~matplotlib.gridspec.GridSpec` explicitly and use
them to create a subplot.

For example, ::

ax = plt.subplot2grid((2,2),(0, 0))
ax = plt.subplot2grid((2, 2), (0, 0))

is equal to ::

import matplotlib.gridspec as gridspec
gs = gridspec.GridSpec(2, 2)
ax = plt.subplot(gs[0, 0])

A gridspec instance provides array-like (2d or 1d) indexing that
returns the SubplotSpec instance. For, SubplotSpec that spans multiple
A GridSpec instance provides array-like (2d or 1d) indexing that
returns the SubplotSpec instance. For a SubplotSpec that spans multiple
cells, use slice. ::

ax2 = plt.subplot(gs[1,:-1])
ax2 = plt.subplot(gs[1, :-1])
ax3 = plt.subplot(gs[1:, -1])

The above example becomes ::

gs = gridspec.GridSpec(3, 3)
ax1 = plt.subplot(gs[0, :])
ax2 = plt.subplot(gs[1,:-1])
ax2 = plt.subplot(gs[1, :-1])
ax3 = plt.subplot(gs[1:, -1])
ax4 = plt.subplot(gs[-1,0])
ax5 = plt.subplot(gs[-1,-2])
ax4 = plt.subplot(gs[-1, 0])
ax5 = plt.subplot(gs[-1, -2])

.. plot:: users/plotting/examples/demo_gridspec02.py

Adjust GridSpec layout
======================

When a GridSpec is explicitly used, you can adjust the layout
parameters of subplots that are created from the gridspec. ::
parameters of subplots that are created from the GridSpec. ::

gs1 = gridspec.GridSpec(3, 3)
gs1.update(left=0.05, right=0.48, wspace=0.05)

This is similar to *subplots_adjust*, but it only affects the subplots
that are created from the given GridSpec.
This is similar to :func:`~matplotlib.pyplot.subplots_adjust`, but it only
affects the subplots that are created from the given GridSpec.

The code below ::

Expand All @@ -117,8 +119,9 @@ creates
GridSpec using SubplotSpec
==========================

You can create GridSpec from the SubplotSpec, in which case its layout
parameters are set to that of the location of the given SubplotSpec. ::
You can create GridSpec from the :class:`~matplotlib.gridspec.SubplotSpec`,
in which case its layout parameters are set to that of the location of
the given SubplotSpec. ::

gs0 = gridspec.GridSpec(1, 2)

Expand All @@ -132,8 +135,8 @@ parameters are set to that of the location of the given SubplotSpec. ::
A Complex Nested GridSpec using SubplotSpec
===========================================

Here's a more sophisticated example of nested gridspec where we put
a box around each cell of the outer 4x4 grid, by hiding appropriate
Here's a more sophisticated example of nested GridSpec where we put
a box around each cell of the outer 4x4 grid, by hiding appropriate
spines in each of the inner 3x3 grids.

.. plot:: users/plotting/examples/demo_gridspec06.py
Expand All @@ -147,8 +150,8 @@ relative heights and widths of rows and columns. Note that absolute
values are meaningless, only their relative ratios matter. ::

gs = gridspec.GridSpec(2, 2,
width_ratios=[1,2],
height_ratios=[4,1]
width_ratios=[1, 2],
height_ratios=[4, 1]
)

ax1 = plt.subplot(gs[0])
Expand Down
8 changes: 5 additions & 3 deletions examples/pylab_examples/demo_bboximage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
a = np.linspace(0, 1, 256).reshape(1, -1)
a = np.vstack((a, a))

maps = sorted(m for m in plt.cm.cmap_d if not m.endswith("_r"))
maps.remove('spectral') # Deprecated.
#nmaps = len(maps) + 1
maps = sorted(
m for m in plt.cm.cmap_d
if not m.endswith("_r") and # Skip reversed colormaps.
not m.startswith(('spectral', 'Vega')) # Skip deprecated colormaps.
)

#fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def _get_config_or_cache_dir(xdg_base):
h = get_home()
if h is not None:
p = os.path.join(h, '.matplotlib')
if sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
if sys.platform.startswith(('linux', 'freebsd')):
p = None
if xdg_base is not None:
p = os.path.join(xdg_base, 'matplotlib')
Expand Down
10 changes: 5 additions & 5 deletions lib/matplotlib/afm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
def _to_int(x):
return int(float(x))


_to_float = float
if six.PY3:
def _to_str(x):
return x.decode('utf8')
else:
_to_str = str


def _to_str(x):
return x.decode('utf8')


def _to_list_of_ints(s):
Expand Down
11 changes: 9 additions & 2 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,16 @@ def leaveEvent(self, event):
FigureCanvasBase.leave_notify_event(self, guiEvent=event)

def mouseEventCoords(self, pos):
x = pos.x() * self._dpi_ratio
"""
Calculate mouse coordinates in logical pixels.

Qt5 and Matplotlib use logical pixels, but the figure is scaled to
physical pixels for rendering. Also, the origin is different and needs
to be corrected.
"""
x = pos.x()
# flip y so y=0 is bottom of canvas
y = self.figure.bbox.height - pos.y() * self._dpi_ratio
y = self.figure.bbox.height / self._dpi_ratio - pos.y()
return x, y

def mousePressEvent(self, event):
Expand Down
Loading
X Tutup