10000 Merge remote-tracking branch 'upstream/v1.5.x' into v2.0.x · matplotlib/matplotlib@c5ce72a · GitHub
[go: up one dir, main page]

Skip to content

Commit c5ce72a

Browse files
committed
Merge remote-tracking branch 'upstream/v1.5.x' into v2.0.x
2 parents 9d61a67 + e6c6c00 commit c5ce72a

File tree

5 files changed

+45
-38
lines changed

5 files changed

+45
-38
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3008,7 +3008,7 @@ def xywhere(xs, ys, mask):
30083008
caplines.extend(self.plot(xup, yup, 'k_', **plot_kw))
30093009

30103010
if not barsabove and plot_line:
3011-
l0, = self.plot(x, y, fmt, **kwargs)
3011+
l0, = self.plot(x, y, fmt, label='_nolegend_', **kwargs)
30123012

30133013
if ecolor is None:
30143014
if l0 is None and 'color' in self._get_lines._prop_keys:

lib/matplotlib/backends/backend_nbagg.py

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
from matplotlib import is_interactive
2727
from matplotlib.backends.backend_webagg_core import (FigureManagerWebAgg,
2828
FigureCanvasWebAggCore,
29-
NavigationToolbar2WebAgg)
29+
NavigationToolbar2WebAgg,
30+
TimerTornado)
3031
from matplotlib.backend_bases import (ShowBase, NavigationToolbar2,
31-
TimerBase, FigureCanvasBase)
32+
FigureCanvasBase)
3233

3334

3435
class Show(ShowBase):
@@ -185,38 +186,6 @@ def remove_comm(self, comm_id):
185186
if not socket.comm.comm_id == comm_id])
186187

187188

188-
class TimerTornado(TimerBase):
189-
def _timer_start(self):
190-
self._timer_stop()
191-
if self._single:
192-
ioloop = tornado.ioloop.IOLoop.instance()
193-
self._timer = ioloop.add_timeout(
194-
datetime.timedelta(milliseconds=self.interval),
195-
self._on_timer)
196-
else:
197-
self._timer = tornado.ioloop.PeriodicCallback(
198-
self._on_timer,
199-
self.interval)
200-
self._timer.start()
201-
202-
def _timer_stop(self):
203-
if self._timer is None:
204-
return
205-
elif self._single:
206-
ioloop = tornado.ioloop.IOLoop.instance()
207-
ioloop.remove_timeout(self._timer)
208-
else:
209-
self._timer.stop()
210-
211-
self._timer = None
212-
213-
def _timer_set_interval(self):
214-
# Only stop and restart it if the timer has already been started
215-
if self._timer is not None:
216-
self._timer_stop()
217-
self._timer_start()
218-
219-
220189
class FigureCanvasNbAgg(FigureCanvasWebAggCore):
221190
def new_timer(self, *args, **kwargs):
222191
return TimerTornado(*args, **kwargs)

lib/matplotlib/backends/backend_webagg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from matplotlib.figure import Figure
4040
from matplotlib._pylab_helpers import Gcf
4141
from . import backend_webagg_core as core
42-
from .backend_nbagg import TimerTornado
42+
from .backend_webagg_core import TimerTornado
4343

4444

4545
def new_figure_manager(num, *args, **kwargs):

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import warnings
2323

2424
import numpy as np
25+
import tornado
2526

2627
from matplotlib.backends import backend_agg
2728
from matplotlib.figure import Figure
@@ -519,3 +520,35 @@ def _send_event(self, event_type, **kwargs):
519520
payload.update(kwargs)
520521
for s in self.web_sockets:
521522
s.send_json(payload)
523+
524+
525+
class TimerTornado(backend_bases.TimerBase):
526+
def _timer_start(self):
527+
self._timer_stop()
528+
if self._single:
529+
ioloop = tornado.ioloop.IOLoop.instance()
530+
self._timer = ioloop.add_timeout(
531+
datetime.timedelta(milliseconds=self.interval),
532+
self._on_timer)
533+
else:
534+
self._timer = tornado.ioloop.PeriodicCallback(
535+
self._on_timer,
536+
self.interval)
537+
self._timer.start()
538+
539+
def _timer_stop(self):
540+
if self._timer is None:
541+
return
542+
elif self._single:
543+
ioloop = tornado.ioloop.IOLoop.instance()
544+
ioloop.remove_timeout(self._timer)
545+
else:
546+
self._timer.stop()
547+
548+
self._timer = None
549+
550+
def _timer_set_interval(self):
551+
# Only stop and restart it if the timer has already been started
552+
if self._timer is not None:
553+
self._timer_stop()
554+
self._timer_start()

lib/matplotlib/testing/decorators.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,13 @@ def _image_directories(func):
328328
subdir = os.path.splitext(os.path.split(script_name)[1])[0]
329329
else:
330330
mods = module_name.split('.')
331-
mods.pop(0) # <- will be the name of the package being tested (in
332-
# most cases "matplotlib")
331+
if len(mods) >= 3:
332+
mods.pop(0)
333+
# mods[0] will be the name of the package being tested (in
334+
# most case 5916 s "matplotlib") However if this is a
335+
# namespace package pip installed and run via the nose
336+
# multiprocess plugin or as a specific test this may be
337+
# missing. See https://github.com/matplotlib/matplotlib/issues/3314
333338
assert mods.pop(0) == 'tests'
334339
subdir = os.path.join(*mods)
335340

0 commit comments

Comments
 (0)
0