Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit7ed17e3

Browse files
committed
Merge pull request#1426 from mdboom/browser_backend
WebAgg backend
2 parents1c3836d +1789f6c commit7ed17e3

File tree

34 files changed

+1206
-37
lines changed

34 files changed

+1206
-37
lines changed

‎examples/widgets/slider_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
importmatplotlib.pyplotasplt
33
frommatplotlib.widgetsimportSlider,Button,RadioButtons
44

5-
ax=plt.subplot(111)
5+
fig=plt.figure()
6+
ax=fig.add_subplot(111)
67
plt.subplots_adjust(left=0.25,bottom=0.25)
78
t=np.arange(0.0,1.0,0.001)
89
a0=5
@@ -22,7 +23,7 @@ def update(val):
2223
amp=samp.val
2324
freq=sfreq.val
2425
l.set_ydata(amp*np.sin(2*np.pi*freq*t))
25-
plt.draw()
26+
fig.canvas.draw_idle()
2627
sfreq.on_changed(update)
2728
samp.on_changed(update)
2829

@@ -37,8 +38,7 @@ def reset(event):
3738
radio=RadioButtons(rax, ('red','blue','green'),active=0)
3839
defcolorfunc(label):
3940
l.set_color(label)
40-
plt.draw()
41+
fig.canvas.draw_idle()
4142
radio.on_clicked(colorfunc)
4243

4344
plt.show()
44-

‎lib/matplotlib/animation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,10 @@ class Animation(object):
523523
'''
524524
def__init__(self,fig,event_source=None,blit=False):
525525
self._fig=fig
526-
self._blit=blit
526+
# Disables blitting for backends that don't support it. This
527+
# allows users to request it if available, but still have a
528+
# fallback that works if it is not.
529+
self._blit=blitandfig.canvas.supports_blit
527530

528531
# These are the basics of the animation. The frame sequence represents
529532
# information for each frame of the animation and depends on how the
@@ -543,7 +546,7 @@ def __init__(self, fig, event_source=None, blit=False):
543546
# fire events and try to draw to a deleted figure.
544547
self._close_id=self._fig.canvas.mpl_connect('close_event',
545548
self._stop)
546-
ifblit:
549+
ifself._blit:
547550
self._setup_blit()
548551

549552
def_start(self,*args):

‎lib/matplotlib/axes.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,17 +2116,6 @@ def redraw_in_frame(self):
21162116
defget_renderer_cache(self):
21172117
returnself._cachedRenderer
21182118

2119-
def__draw_animate(self):
2120-
# ignore for now; broken
2121-
ifself._lastRendererisNone:
2122-
raiseRuntimeError('You must first call ax.draw()')
2123-
dsu= [(a.zorder,a)forainself.animated.keys()]
2124-
dsu.sort(key=lambdax:x[0])
2125-
renderer=self._lastRenderer
2126-
renderer.blit()
2127-
fortmp,aindsu:
2128-
a.draw(renderer)
2129-
21302119
#### Axes rectangle characteristics
21312120

21322121
defget_frame_on(self):

‎lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,8 @@ class FigureCanvasBase(object):
14821482
'close_event'
14831483
]
14841484

1485+
supports_blit=True
1486+
14851487
def__init__(self,figure):
14861488
figure.set_canvas(self)
14871489
self.figure=figure

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp