8000 Merge remote-tracking branch 'origin/v1.1.x' · matplotlib/matplotlib@1c33830 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c33830

Browse files
committed
Merge remote-tracking branch 'origin/v1.1.x'
2 parents a9391e7 + b0d153e commit 1c33830

File tree

7 files changed

+60
-41
lines changed

7 files changed

+60
-41
lines changed

doc/users/usetex.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ matplotlibrc use::
4747
from matplotlib import rc
4848
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
4949
## for Palatino and other serif fonts use:
50-
#rc('font',**{'family':'serif','serif':['Palatino']))
50+
#rc('font',**{'family':'serif','serif':['Palatino']})
5151
rc('text', usetex=True)
5252

5353
Here is the standard example, `tex_demo.py`:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import matplotlib.pyplot as plt
2+
import matplotlib.path as mpath
3+
import numpy as np
4+
5+
6+
star = mpath.Path.unit_regular_star(6)
7+
circle = mpath.Path.unit_circle()
8+
# concatenate the star with an internal cutout of the circle
9+
verts = np.concatenate([star.vertices, circle.vertices[::-1, ...]])
10+
codes = np.concatenate([star.codes, circle.codes])
11+
cut_star = mpath.Path(verts, codes)
12+
13+
14+
plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15)
15+
16+
plt.show()

lib/matplotlib/backends/backend_agg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class RendererAgg(RendererBase):
7171
# draw at at time and so the font cache is used by only one
7272
# renderer at a time
7373

74-
lock = threading.Lock()
74+
lock = threading.RLock()
7575
_fontd = maxdict(50)
7676
def __init__(self, width, height, dpi):
7777
if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')

lib/matplotlib/gridspec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, nrows, ncols,
3333
height_ratios=None, width_ratios=None):
3434
"""
3535
The number of rows and number of columns of the grid need to
36-
be set. Optionally, the ratio of heights and widths of ros and
36+
be set. Optionally, the ratio of heights and widths of rows and
3737
columns can be specified.
3838
"""
3939
#self.figure = figure
@@ -360,7 +360,7 @@ def __init__(self, nrows, ncols,
360360
"""
361361
The number of rows and number of columns of the grid need to
362362
be set. An instance of SubplotSpec is also needed to be set
363-
from which the layout parameters will be inheirted. The wspace
363+
from which the layout pa 341A rameters will be inherited. The wspace
364364
and hspace of the layout can be optionally specified or the
365365
default values (from the figure or rcParams) will be used.
366366
"""

lib/matplotlib/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def get_legend_handler(legend_handler_map, orig_handle):
540540
541541
It first checks if the *orig_handle* itself is a key in the
542542
*legend_hanler_map* and return the associated value.
543-
Otherwised, it checks for each of the classes in its
543+
Otherwise, it checks for each of the classes in its
544544
method-resolution-order. If no matching key is found, it
545545
returns None.
546546
"""
@@ -561,7 +561,7 @@ def get_legend_handler(legend_handler_map, orig_handle):
561561

562562
def _init_legend_box(self, handles, labels):
563563
"""
564-
Initiallize the legend_box. The legend_box is an instance of
564+
Initialize the legend_box. The legend_box is an instance of
565565
the OffsetBox, which is packed with legend handles and
566566
texts. Once packed, their location is calculated during the
567567
drawing time.

lib/matplotlib/markers.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ class MarkerStyle:
2424
marker description
2525
============================== ===============================================
2626
%s
27-
``'$...$'`` render the string using mathtext
28-
*verts* a list of (x, y) pairs in range (0, 1)
27+
``'$...$'`` render the string using mathtext.
28+
*verts* a list of (x, y) pairs used for Path vertices.
29+
path a :class:`~matplotlib.path.Path` instance.
2930
(*numsides*, *style*, *angle*) see below
3031
============================== ===============================================
3132
@@ -151,6 +152,8 @@ def set_marker(self, marker):
151152
if (iterable(marker) and len(marker) in (2, 3) and
152153
marker[1] in (0, 1, 2, 3)):
153154
self._marker_function = self._set_tuple_marker
155+
elif isinstance(marker, np.ndarray):
156+
self._marker_function = self._set_vertices
154157
elif marker in self.markers:
155158
self._marker_function = getattr(
156159
self, '_set_' + self.markers[marker])
@@ -160,10 +163,10 @@ def set_marker(self, marker):
160163
self._marker_function = self._set_path_marker
161164
else:
162165
try:
163-
path = Path(marker)
166+
_ = Path(marker)
164167
self._marker_function = self._set_vertices
165-
except:
166-
raise ValueError('Unrecognized marker style %s' % marker)
168+
except ValueError:
169+
raise ValueError('Unrecognized marker style {}'.format(marker))
167170

168171
self._marker = marker
169172
self._recache()
@@ -196,8 +199,9 @@ def _set_path_marker(self):
196199
self._set_custom_marker(self._marker)
197200

198201
def _set_vertices(self):
199-
path = Path(verts)
200-
self._set_custom_marker(path)
202+
verts = self._marker
203+
marker = Path(verts)
204+
self._set_custom_marker(marker)
201205

202206
def _set_tuple_marker(self):
203207
marker = self._marker
@@ -231,7 +235,6 @@ def _set_mathtext_path(self):
231235
232236
Submitted by tcb
233237
"""
234-
from matplotlib.patches import PathPatch
235238
from matplotlib.text import TextPath
236239
from matplotlib.font_manager import FontProperties
237240

@@ -443,10 +446,10 @@ def _set_star(self):
443446
else:
444447
verts = polypath.vertices
445448

446-
top = Path(np.vstack((verts[0:4,:], verts[7:10,:], verts[0])))
447-
bottom = Path(np.vstack((verts[3:8,:], verts[3])))
448-
left = Path(np.vstack((verts[0:6,:], verts[0])))
449-
right = Path(np.vstack((verts[0], verts[5:10,:], verts[0])))
449+
top = Path(np.vstack((verts[0:4, :], verts[7:10, :], verts[0])))
450+
bottom = Path(np.vstack((verts[3:8, :], verts[3])))
451+
left = Path(np.vstack((verts[0:6, :], verts[0])))
452+
right = Path(np.vstack((verts[0], verts[5:10, :], verts[0])))
450453

451454
if fs == 'top':
452455
mpath, mpath_alt = top, bottom
@@ -476,10 +479,10 @@ def _set_hexagon1(self):
476479

477480
# not drawing inside lines
478481
x = np.abs(np.cos(5*np.pi/6.))
479-
top = Path(np.vstack(([-x,0],verts[(1,0,5),:],[x,0])))
480-
bottom = Path(np.vstack(([-x,0],verts[2:5,:],[x,0])))
481-
left = Path(verts[(0,1,2,3),:])
482-
right = Path(verts[(0,5,4,3),:])
482+
top = Path(np.vstack(([-x, 0], verts[(1, 0, 5), :], [x, 0])))
483+
bottom = Path(np.vstack(([-x, 0], verts[2:5, :], [x, 0])))
484+
left = Path(verts[(0, 1, 2, 3), :])
485+
right = Path(verts[(0, 5, 4, 3), :])
483486

484487
if fs == 'top':
485488
mpath, mpath_alt = top, bottom
@@ -510,10 +513,10 @@ def _set_hexagon2(self):
510513

511514
# not drawing inside lines
512515
x, y = np.sqrt(3)/4, 3/4.
513-
top = Path(verts[(1,0,5,4,1),:])
514-
bottom = Path(verts[(1,2,3,4),:])
515-
left = Path(np.vstack(([x,y],verts[(0,1,2),:],[-x,-y],[x,y])))
516-
right = Path(np.vstack(([x,y],verts[(5,4,3),:],[-x,-y])))
516+
top = Path(verts[(1, 0, 5, 4, 1), :])
517+
bottom = Path(verts[(1, 2, 3, 4), :])
518+
left = Path(np.vstack(([x, y], verts[(0, 1, 2), :], [-x, -y], [x, y])))
519+
right = Path(np.vstack(([x, y], verts[(5, 4, 3), :], [-x, -y])))
517520

518521
if fs == 'top':
519522
mpath, mpath_alt = top, bottom

lib/matplotlib/offsetbox.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
9696

9797
def _get_aligned_offsets(hd_list, height, align="baseline"):
9898
"""
99-
Geiven a list of (height, descent) of each boxes, align the boxes
99+
Given a list of (height, descent) of each boxes, align the boxes
100100
with *align* and calculate the y-offsets of each boxes.
101101
total width and the offset positions of each items according to
102-
*mode*. xdescent is analagous to the usual descent, but along the
102+
*mode*. xdescent is analogous to the usual descent, but along the
103103
x-direction. xdescent values are currently ignored.
104104
105105
*hd_list* : list of (width, xdescent) of boxes to be aligned.
@@ -258,7 +258,7 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
258258
259259
.. note::
260260
*pad* and *sep* need to given in points and will be
261-
scale with the renderer dpi, while *width* and *hight*
261+
scale with the renderer dpi, while *width* and *height*
262262
need to be in pixels.
263263
"""
264264
super(PackerBase, self).__init__()
@@ -276,7 +276,7 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
276276
class VPacker(PackerBase):
277277
"""
278278
The VPacker has its children packed vertically. It automatically
279-
adjust the relative postisions of children in the drawing time.
279+
adjust the relative positions of children in the drawing time.
280280
"""
281281
def __init__(self, pad=None, sep=None, width=None, height=None,
282282
align="baseline", mode="fixed",
@@ -291,7 +291,7 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
291291
292292
.. note::
293293
*pad* and *sep* need to given in points and will be
294-
scale with the renderer dpi, while *width* and *hight*
294+
scale with the renderer dpi, while *width* and *height*
295295
need to be in pixels.
296296
"""
297297
super(VPacker, self).__init__(pad, sep, width, height,
@@ -343,7 +343,7 @@ def get_extent_offsets(self, renderer):
343343
class HPacker(PackerBase):
344344
"""
345345
The HPacker has its children packed horizontally. It automatically
346-
adjust the relative postision F438 s of children in the drawing time.
346+
adjust the relative positions of children in the drawing time.
347347
"""
348348
def __init__(self, pad=None, sep=None, width=None, height=None,
349349
align="baseline", mode="fixed",
@@ -358,7 +358,7 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
358358
359359
.. note::
360360
*pad* and *sep* need to given in points and will be
361-
scale with the renderer dpi, while *width* and *hight*
361+
scale with the renderer dpi, while *width* and *height*
362362
need to be in pixels.
363363
"""
364364
super(HPacker, self).__init__(pad, sep, width, height,
@@ -367,7 +367,7 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
367367

368368
def get_extent_offsets(self, renderer):
369369
"""
370-
update offset of childrens and return the extents of the box
370+
update offset of children and return the extents of the box
371371
"""
372372

373373
dpicor = renderer.points_to_pixels(1.)
@@ -415,7 +415,7 @@ def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None):
415415
416416
.. note::
417417
*pad* need to given in points and will be
418-
scale with the renderer dpi, while *width* and *hight*
418+
scale with the renderer dpi, while *width* and *height*
419419
need to be in pixels.
420420
"""
421421

@@ -771,12 +771,12 @@ class AuxTransformBox(OffsetBox):
771771
Offset Box with the aux_transform . Its children will be
772772
transformed with the aux_transform first then will be
773773
offseted. The absolute coordinate of the aux_transform is meaning
774-
as it will be automaticcaly adjust so that the left-lower corner
774+
as it will be automatically adjust so that the left-lower corner
775775
of the bounding box of children will be set to (0,0) before the
776-
offset trnasform.
776+
offset transform.
777777
778778
It is similar to drawing area, except that the extent of the box
779-
is not predetemined but calculated from the window extent of its
779+
is not predetermined but calculated from the window extent of its
780780
children. Furthermore, the extent of the children will be
781781
calculated in the transformed coordinate.
782782
"""
@@ -821,7 +821,7 @@ def set_offset(self, xy):
821821
"""
822822
set offset of the container.
823823
824-
Accept : tuple of x,y cooridnate in disokay units.
824+
Accept : tuple of x,y coordinate in disokay units.
825825
"""
826826
self._offset = xy
827827

@@ -883,7 +883,7 @@ class AnchoredOffsetbox(OffsetBox):
883883
"""
884884
An offset box placed according to the legend location
885885
loc. AnchoredOffsetbox has a single child. When multiple children
886-
is needed, use other OffsetBox class to enlose them. By default,
886+
is needed, use other OffsetBox class to enclose them. By default,
887887
the offset box is anchored against its parent axes. You may
888888
explicitly specify the bbox_to_anchor.
889889
"""
@@ -1198,7 +1198,7 @@ def get_zoom(self):
11981198
# """
11991199
# set offset of the container.
12001200

1201-
# Accept : tuple of x,y cooridnate in disokay units.
1201+
# Accept : tuple of x,y coordinate in disokay units.
12021202
# """
12031203
# self._offset = xy
12041204

0 commit comments

Comments
 (0)
0