Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3cd9c2d

Browse filesBrowse files
committed
Merge remote-tracking branch 'matplotlib/v2.x'
Conflicts: lib/matplotlib/backends/backend_macosx.py Resolve in favor of head (which lead to no net change) lib/matplotlib/tests/test_axes.py Keep warning import
2 parents ff2aadf + d399f25 commit 3cd9c2d
Copy full SHA for 3cd9c2d

File tree

Expand file treeCollapse file tree

16 files changed

+47
-22
lines changed
Filter options
Expand file treeCollapse file tree

16 files changed

+47
-22
lines changed

‎examples/shapes_and_collections/artist_reference.py

Copy file name to clipboardExpand all lines: examples/shapes_and_collections/artist_reference.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def label(xy, text):
8484
grid[7] - [0.025, 0.05], 0.05, 0.1,
8585
boxstyle=mpatches.BoxStyle("Round", pad=0.02))
8686
patches.append(fancybox)
87-
label(grid[7], "FancyBoxPatch")
87+
label(grid[7], "FancyBboxPatch")
8888

8989
# add a line
9090
x, y = np.array([[-0.06, 0.0, 0.1], [0.05, -0.05, 0.05]])

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+17-4Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,21 @@
137137

138138
__version__numpy__ = str('1.6') # minimum required numpy version
139139

140+
__bibtex__ = """@Article{Hunter:2007,
141+
Author = {Hunter, J. D.},
142+
Title = {Matplotlib: A 2D graphics environment},
143+
Journal = {Computing In Science \& Engineering},
144+
Volume = {9},
145+
Number = {3},
146+
Pages = {90--95},
147+
abstract = {Matplotlib is a 2D graphics package used for Python
148+
for application development, interactive scripting, and
149+
publication-quality image generation across user
150+
interfaces and operating systems.},
151+
publisher = {IEEE COMPUTER SOC},
152+
year = 2007
153+
}"""
154+
140155
try:
141156
import dateutil
142157
except ImportError:
@@ -554,16 +569,14 @@ def _create_tmp_config_dir():
554569
# Some restricted platforms (such as Google App Engine) do not provide
555570
# gettempdir.
556571
return None
557-
558572
try:
559573
username = getpass.getuser()
560574
except KeyError:
561575
username = str(os.getuid())
562-
tempdir = os.path.join(tempdir, 'matplotlib-%s' % username)
563576

564-
os.environ['MPLCONFIGDIR'] = tempdir
577+
tempdir = tempfile.mkdtemp(prefix='matplotlib-%s-' % username, dir=tempdir)
565578

566-
mkdirs(tempdir)
579+
os.environ['MPLCONFIGDIR'] = tempdir
567580

568581
return tempdir
569582

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,7 @@ def _get_output_canvas(self, format):
20782078
'Supported formats: '
20792079
'%s.' % (format, ', '.join(formats)))
20802080

2081-
def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
2081+
def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
20822082
orientation='portrait', format=None, **kwargs):
20832083
"""
20842084
Render the figure to hardcopy. Set the figure patch face and edge
@@ -2098,10 +2098,10 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
20982098
the dots per inch to save the figure in; if None, use savefig.dpi
20992099
21002100
*facecolor*
2101-
the facecolor of the figure
2101+
the facecolor of the figure; if None, defaults to savefig.facecolor
21022102
21032103
*edgecolor*
2104-
the edgecolor of the figure
2104+
the edgecolor of the figure; if None, defaults to savefig.edgecolor
21052105
21062106
*orientation*
21072107
landscape' | 'portrait' (not supported on all backends)
@@ -2141,9 +2141,15 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
21412141

21422142
if dpi is None:
21432143
dpi = rcParams['savefig.dpi']
2144+
21442145
if dpi == 'figure':
21452146
dpi = self.figure.dpi
21462147

2148+
if facecolor is None:
2149+
facecolor = rcParams['savefig.facecolor']
2150+
if edgecolor is None:
2151+
edgecolor = rcParams['savefig.edgecolor']
2152+
21472153
origDPI = self.figure.dpi
21482154
origfacecolor = self.figure.get_facecolor()
21492155
origedgecolor = self.figure.get_edgecolor()

‎lib/matplotlib/backends/backend_cocoaagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_cocoaagg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def updatePlot(self):
178178
def windowDidResize_(self, sender):
179179
w,h = self.bounds().size
180180
dpi = self.canvas.figure.dpi
181-
self.canvas.figure.set_size_inches(w / dpi, h / dpi)
181+
self.canvas.figure.set_size_inches(w / dpi, h / dpi, forward=False)
182182
self.canvas.draw()
183183
self.updatePlot()
184184

‎lib/matplotlib/backends/backend_gtk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def configure_event(self, widget, event):
355355

356356
# resize the figure (in inches)
357357
dpi = self.figure.dpi
358-
self.figure.set_size_inches (w/dpi, h/dpi)
358+
self.figure.set_size_inches(w/dpi, h/dpi, forward=False)
359359
self._need_redraw = True
360360

361361
return False # finish event propagation?

‎lib/matplotlib/backends/backend_gtk3.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def size_allocate(self, widget, allocation):
285285
dpival = self.figure.dpi
286286
winch = allocation.width / dpival
287287
hinch = allocation.height / dpival
288-
self.figure.set_size_inches(winch, hinch)
288+
self.figure.set_size_inches(winch, hinch, forward=False)
289289
FigureCanvasBase.resize_event(self)
290290
self.draw_idle()
291291

@@ -318,7 +318,7 @@ def configure_event(self, widget, event):
318318

319319
# resize the figure (in inches)
320320
dpi = self.figure.dpi
321-
self.figure.set_size_inches (w/dpi, h/dpi)
321+
self.figure.set_size_inches(w/dpi, h/dpi, forward=False)
322322
self._need_redraw = True
323323

324324
return False # finish event propagation?

‎lib/matplotlib/backends/backend_gtkagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtkagg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def configure_event(self, widget, event=None):
7676
dpival = self.figure.dpi
7777
winch = w/dpival
7878
hinch = h/dpival
79-
self.figure.set_size_inches(winch, hinch)
79+
self.figure.set_size_inches(winch, hinch, forward=False)
8080
self._need_redraw = True
8181
self.resize_event()
8282
if DEBUG: print('FigureCanvasGTKAgg.configure_event end')

‎lib/matplotlib/backends/backend_qt5.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt5.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def resizeEvent(self, event):
331331
dpival = self.figure.dpi
332332
winch = w / dpival
333333
hinch = h / dpival
334-
self.figure.set_size_inches(winch, hinch)
334+
self.figure.set_size_inches(winch, hinch, forward=False)
335335
FigureCanvasBase.resize_event(self)
336336
self.draw_idle()
337337
QtWidgets.QWidget.resizeEvent(self, event)

‎lib/matplotlib/backends/backend_tkagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_tkagg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def resize(self, event):
272272
dpival = self.figure.dpi
273273
winch = width/dpival
274274
hinch = height/dpival
275-
self.figure.set_size_inches(winch, hinch)
275+
self.figure.set_size_inches(winch, hinch, forward=False)
276276

277277

278278
self._tkcanvas.delete(self._tkphoto)

‎lib/matplotlib/backends/backend_webagg_core.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_webagg_core.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def handle_resize(self, event):
350350
x, y = int(x) * self._dpi_ratio, int(y) * self._dpi_ratio
351351
fig = self.figure
352352
# An attempt at approximating the figure size in pixels.
353-
fig.set_size_inches(x / fig.dpi, y / fig.dpi)
353+
fig.set_size_inches(x / fig.dpi, y / fig.dpi, forward=False)
354354

355355
_, _, w, h = self.figure.bbox.bounds
356356
# Acknowledge the resize, and force the viewer to update the

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ def _onSize(self, evt):
983983
dpival = self.figure.dpi
984984
winch = self._width / dpival
985985
hinch = self._height / dpival
986-
self.figure.set_size_inches(winch, hinch)
986+
self.figure.set_size_inches(winch, hinch, forward=False)
987987

988988
# Rendering will happen on the associated paint event
989989
# so no need to do anything here except to make sure

‎lib/matplotlib/dates.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dates.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ def tick_values(self, vmin, vmax):
831831
# The magic number!
832832
stop = _from_ordinalf(3652059.9999999)
833833

834-
self.rule.set(dtstart=start, until=stop, count=self.MAXTICKS + 1)
834+
self.rule.set(dtstart=start, until=stop)
835835

836836
# estimate the number of ticks very approximately so we don't
837837
# have to do a very expensive (and potentially near infinite)

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def figimage(self, X,
668668
self.stale = True
669669
return im
670670

671-
def set_size_inches(self, w, h=None, forward=False):
671+
def set_size_inches(self, w, h=None, forward=True):
672672
"""
673673
set_size_inches(w,h, forward=False)
674674

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ def register(klass, name, style):
18791879
class BoxStyle(_Style):
18801880
"""
18811881
:class:`BoxStyle` is a container class which defines several
1882-
boxstyle classes, which are used for :class:`FancyBoxPatch`.
1882+
boxstyle classes, which are used for :class:`FancyBboxPatch`.
18831883
18841884
A style object can be created as::
18851885

‎lib/matplotlib/testing/compare.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/compare.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ def crop_to_same(actual_path, actual_image, expected_path, expected_image):
242242

243243
def calculate_rms(expectedImage, actualImage):
244244
"Calculate the per-pixel errors, then compute the root mean square error."
245+
if expectedImage.shape != actualImage.shape:
246+
raise ImageComparisonFailure(
247+
"image sizes do not match expected size: {0} "
248+
"actual size {1}".format(expectedImage.shape, actualImage.shape))
249+
245250
num_values = np.prod(expectedImage.shape)
246251
abs_diff_image = abs(expectedImage - actualImage)
247252

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import matplotlib.pyplot as plt
2626
import matplotlib.markers as mmarkers
2727
from numpy.testing import assert_allclose, assert_array_equal
28+
import warnings
2829
from matplotlib.cbook import IgnoredKeywordWarning
2930

3031
import sys
@@ -1794,11 +1795,11 @@ def test_boxplot_sym():
17941795
def test_boxplot_autorange_whiskers():
17951796
x = np.ones(140)
17961797
x = np.hstack([0, x, 2])
1797-
1798+
17981799
fig1, ax1 = plt.subplots()
17991800
ax1.boxplot([x, x], bootstrap=10000, notch=1)
18001801
ax1.set_ylim((-5, 5))
1801-
1802+
18021803
fig2, ax2 = plt.subplots()
18031804
ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True)
18041805
ax2.set_ylim((-5, 5))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.