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

Skip to content

Commit 3cd9c2d

Browse 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

16 files changed

Lines changed: 47 additions & 22 deletions

examples/shapes_and_collections/artist_reference.py

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

0 commit comments

Comments
 (0)