-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathMEP22.html
More file actions
819 lines (750 loc) · 35.9 KB
/
MEP22.html
File metadata and controls
819 lines (750 loc) · 35.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>MEP22: Toolbar rewrite — Matplotlib 3.5.2 documentation</title>
<!-- Loaded before other Sphinx assets -->
<link href="../../_static/styles/theme.css?digest=1999514e3f237ded88cf" rel="stylesheet">
<link href="../../_static/styles/pydata-sphinx-theme.css?digest=1999514e3f237ded88cf" rel="stylesheet">
<link rel="stylesheet"
href="../../_static/vendor/fontawesome/5.13.0/css/all.min.css">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/css/style.css" />
<link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
<link rel="stylesheet" type="text/css" href="../../_static/copybutton.css" />
<link rel="stylesheet" type="text/css" href="../../_static/sg_gallery.css" />
<link rel="stylesheet" type="text/css" href="../../_static/sg_gallery-binder.css" />
<link rel="stylesheet" type="text/css" href="../../_static/sg_gallery-dataframe.css" />
<link rel="stylesheet" type="text/css" href="../../_static/sg_gallery-rendered-html.css" />
<link rel="stylesheet" type="text/css" href="../../_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css" />
<link rel="stylesheet" type="text/css" href="../../_static/panels-variables.06eb56fa6e07937060861dad626602ad.css" />
<link rel="stylesheet" type="text/css" href="../../_static/mpl.css?v3.5.2-3-g2e7af710d5" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../../_static/scripts/pydata-sphinx-theme.js?digest=1999514e3f237ded88cf">
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/clipboard.min.js"></script>
<script src="../../_static/copybutton.js"></script>
<link rel="canonical" href="https://matplotlib.org/stable/devel/MEP/MEP22.html" />
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 3.5.2 documentation"
href="../../_static/opensearch.xml"/>
<link rel="shortcut icon" href="../../_static/favicon.ico"/>
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="MEP23: Multiple Figures per GUI window" href="MEP23.html" />
<link rel="prev" title="MEP21: color and cm refactor" href="MEP21.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="None">
<script data-domain="matplotlib.org" defer="defer" src="https://views.scientific-python.org/js/script.js"></script>
</head>
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="60">
<div class="container-fluid" id="banner"></div>
<nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top bd-navbar" id="navbar-main"><div class="container-xl">
<div id="navbar-start">
<a class="navbar-brand" href="../../index.html">
<img src="../../_static/logo2.svg" class="logo" alt="logo">
</a>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar-collapsible" class="col-lg-9 collapse navbar-collapse">
<div id="navbar-center" class="mr-auto">
<div class="navbar-center-item">
<ul id="navbar-main-elements" class="navbar-nav">
<li class="nav-item">
<a class="reference internal nav-link" href="../../plot_types/index.html">Plot types</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../../gallery/index.html">Examples</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../../tutorials/index.html">Tutorials</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../../api/index.html">Reference</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../../users/index.html">User guide</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../index.html">Develop</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../../users/release_notes.html">Release notes</a>
</li>
</ul>
</div>
</div>
<div id="navbar-end">
<div class="navbar-end-item">
<ul id="navbar-icon-links" class="navbar-nav" aria-label="Icon Links">
<li class="nav-item">
<a class="nav-link" href="https://gitter.im/matplotlib/matplotlib" rel="noopener" target="_blank" title="gitter">
<span><i class="fab fa-gitter"></i></span>
<label class="sr-only">gitter</label>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://discourse.matplotlib.org" rel="noopener" target="_blank" title="discourse">
<span><i class="fab fa-discourse"></i></span>
<label class="sr-only">discourse</label>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/matplotlib/matplotlib" rel="noopener" target="_blank" title="GitHub">
<span><i class="fab fa-github-square"></i></span>
<label class="sr-only">GitHub</label>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://twitter.com/matplotlib/" rel="noopener" target="_blank" title="twitter">
<span><i class="fab fa-twitter-square"></i></span>
<label class="sr-only">twitter</label>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<div class="container-xl">
<div class="row">
<!-- Only show if we have sidebars configured, else just a small margin -->
<div class="col-12 col-md-3 bd-sidebar">
<div class="sidebar-start-items"><form class="bd-search d-flex align-items-center" action="../../search.html" method="get">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" >
</form><nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<div class="bd-toc-item active">
<ul class="current nav bd-sidenav">
<li class="toctree-l1">
<a class="reference internal" href="../contributing.html">
Contributing
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../triage.html">
Bug triaging and issue curation
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../development_setup.html">
Setting up Matplotlib for development
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../testing.html">
Testing
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../documenting_mpl.html">
Writing documentation
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../style_guide.html">
Documentation style guide
</a>
</li>
<li class="toctree-l1 has-children">
<a class="reference internal" href="../gitwash/index.html">
Working with
<em>
Matplotlib
</em>
source code
</a>
<input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/>
<label for="toctree-checkbox-1">
<i class="fas fa-chevron-down">
</i>
</label>
<ul>
<li class="toctree-l2">
<a class="reference internal" href="../gitwash/git_intro.html">
Introduction
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="../gitwash/git_install.html">
Install git
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="../gitwash/following_latest.html">
Following the latest source
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="../gitwash/patching.html">
Making a patch
</a>
</li>
<li class="toctree-l2 has-children">
<a class="reference internal" href="../gitwash/git_development.html">
Git for development
</a>
<input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/>
<label for="toctree-checkbox-2">
<i class="fas fa-chevron-down">
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../gitwash/forking_hell.html">
Making your own copy (fork) of Matplotlib
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../gitwash/set_up_fork.html">
Set up your fork
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../gitwash/configure_git.html">
Configure git
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../gitwash/development_workflow.html">
Development workflow
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../gitwash/maintainer_workflow.html">
Maintainer workflow
</a>
</li>
</ul>
</li>
<li class="toctree-l2">
<a class="reference internal" href="../gitwash/git_resources.html">
git resources
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="../gitwash/dot2_dot3.html">
Two and three dots in difference specs
</a>
</li>
</ul>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../coding_guide.html">
Pull request guidelines
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../release_guide.html">
Release guide
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../dependencies.html">
Dependencies
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../min_dep_policy.html">
Minimum version of dependencies policy
</a>
</li>
<li class="toctree-l1 current active has-children">
<a class="reference internal" href="index.html">
Matplotlib Enhancement Proposals
</a>
<input checked="" class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/>
<label for="toctree-checkbox-3">
<i class="fas fa-chevron-down">
</i>
</label>
<ul class="current">
<li class="toctree-l2">
<a class="reference internal" href="template.html">
MEP Template
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP08.html">
MEP8: PEP8
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP09.html">
MEP9: Global interaction manager
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP10.html">
MEP10: Docstring consistency
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP11.html">
MEP11: Third-party dependencies
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP12.html">
MEP12: Improve Gallery and Examples
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP13.html">
MEP13: Use properties for Artists
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP14.html">
MEP14: Text handling
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP15.html">
MEP15: Fix axis autoscaling when limits are specified for one axis only
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP19.html">
MEP19: Continuous Integration
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP21.html">
MEP21: color and cm refactor
</a>
</li>
<li class="toctree-l2 current active">
<a class="current reference internal" href="#">
MEP22: Toolbar rewrite
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP23.html">
MEP23: Multiple Figures per GUI window
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP24.html">
MEP24: Negative radius in polar plots
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP25.html">
MEP25: Serialization
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP26.html">
MEP26: Artist styling
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP27.html">
MEP27: Decouple pyplot from backends
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP28.html">
MEP28: Remove Complexity from Axes.boxplot
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="MEP29.html">
MEP29: Text light markup
</a>
</li>
</ul>
</li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1">
<a class="reference internal" href="../license.html">
Licenses
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../color_changes.html">
Default color changes
</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="sidebar-end-items">
</div>
</div>
<div class="d-none d-xl-block col-xl-2 bd-toc">
<div class="toc-item">
<div class="tocsection onthispage mt-5 pt-1 pb-3">
<i class="fas fa-list"></i> On this page
</div>
<nav id="bd-toc-nav">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#status">
Status
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#branches-and-pull-requests">
Branches and Pull requests
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#abstract">
Abstract
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#detailed-description">
Detailed description
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#implementation">
Implementation
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#toolbase-object">
ToolBase(object)
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry">
<a class="reference internal nav-link" href="#methods">
Methods
</a>
</li>
<li class="toc-h4 nav-item toc-entry">
<a class="reference internal nav-link" href="#available-tools">
Available Tools
</a>
</li>
</ul>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#tooltogglebase-toolbase">
ToolToggleBase(ToolBase)
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry">
<a class="reference internal nav-link" href="#id1">
Methods
</a>
</li>
<li class="toc-h4 nav-item toc-entry">
<a class="reference internal nav-link" href="#id2">
Available Tools
</a>
</li>
</ul>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#navigationbase">
NavigationBase
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry">
<a class="reference internal nav-link" href="#methods-intended-for-the-end-user">
Methods (intended for the end user)
</a>
</li>
</ul>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#toolbarbase">
ToolbarBase
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry">
<a class="reference internal nav-link" href="#methods-for-backend-implementation">
Methods (for backend implementation)
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#backward-compatibility">
Backward compatibility
</a>
</li>
</ul>
</nav>
</div>
<div class="toc-item">
</div>
</div>
<main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
<div>
<section id="mep22-toolbar-rewrite">
<h1>MEP22: Toolbar rewrite<a class="headerlink" href="#mep22-toolbar-rewrite" title="Permalink to this headline">#</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#status" id="id3">Status</a></p></li>
<li><p><a class="reference internal" href="#branches-and-pull-requests" id="id4">Branches and Pull requests</a></p></li>
<li><p><a class="reference internal" href="#abstract" id="id5">Abstract</a></p></li>
<li><p><a class="reference internal" href="#detailed-description" id="id6">Detailed description</a></p></li>
<li><p><a class="reference internal" href="#implementation" id="id7">Implementation</a></p>
<ul>
<li><p><a class="reference internal" href="#toolbase-object" id="id8">ToolBase(object)</a></p>
<ul>
<li><p><a class="reference internal" href="#methods" id="id9">Methods</a></p></li>
<li><p><a class="reference internal" href="#available-tools" id="id10">Available Tools</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#tooltogglebase-toolbase" id="id11">ToolToggleBase(ToolBase)</a></p>
<ul>
<li><p><a class="reference internal" href="#id1" id="id12">Methods</a></p></li>
<li><p><a class="reference internal" href="#id2" id="id13">Available Tools</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#navigationbase" id="id14">NavigationBase</a></p>
<ul>
<li><p><a class="reference internal" href="#methods-intended-for-the-end-user" id="id15">Methods (intended for the end user)</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#toolbarbase" id="id16">ToolbarBase</a></p>
<ul>
<li><p><a class="reference internal" href="#methods-for-backend-implementation" id="id17">Methods (for backend implementation)</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="#backward-compatibility" id="id18">Backward compatibility</a></p></li>
</ul>
</div>
<section id="status">
<h2><a class="toc-backref" href="#id3">Status</a><a class="headerlink" href="#status" title="Permalink to this headline">#</a></h2>
<p><strong>Progress</strong></p>
</section>
<section id="branches-and-pull-requests">
<h2><a class="toc-backref" href="#id4">Branches and Pull requests</a><a class="headerlink" href="#branches-and-pull-requests" title="Permalink to this headline">#</a></h2>
<p>Previous work:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/1849">https://github.com/matplotlib/matplotlib/pull/1849</a></p></li>
<li><p><a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/2557">https://github.com/matplotlib/matplotlib/pull/2557</a></p></li>
<li><p><a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/2465">https://github.com/matplotlib/matplotlib/pull/2465</a></p></li>
</ul>
<p>Pull Requests:</p>
<ul class="simple">
<li><p>Removing the NavigationToolbar classes
<a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/2740">https://github.com/matplotlib/matplotlib/pull/2740</a> <strong>CLOSED</strong></p></li>
<li><p>Keeping the NavigationToolbar classes <a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/2759">https://github.com/matplotlib/matplotlib/pull/2759</a> <strong>CLOSED</strong></p></li>
<li><p>Navigation by events: <a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/3652">https://github.com/matplotlib/matplotlib/pull/3652</a></p></li>
</ul>
</section>
<section id="abstract">
<h2><a class="toc-backref" href="#id5">Abstract</a><a class="headerlink" href="#abstract" title="Permalink to this headline">#</a></h2>
<p>The main goal of this MEP is to make it easier to modify (add, change,
remove) the way the user interacts with the figures.</p>
<p>The user interaction with the figure is deeply integrated within the
Canvas and Toolbar. Making extremely difficult to do any modification.</p>
<p>This MEP proposes the separation of this interaction into Toolbar,
Navigation and Tools to provide independent access and
reconfiguration.</p>
<p>This approach will make easier to create and share tools among
users. In the far future, we can even foresee a kind of Marketplace
for <code class="docutils literal notranslate"><span class="pre">Tool</span></code>s where the most popular can be added into the main
distribution.</p>
</section>
<section id="detailed-description">
<h2><a class="toc-backref" href="#id6">Detailed description</a><a class="headerlink" href="#detailed-description" title="Permalink to this headline">#</a></h2>
<p>The reconfiguration of the Toolbar is complex, most of the time it
requires a custom backend.</p>
<p>The creation of custom Tools sometimes interferes with the Toolbar, as
example see <a class="reference external" href="https://github.com/matplotlib/matplotlib/issues/2694">https://github.com/matplotlib/matplotlib/issues/2694</a> also
the shortcuts are hardcoded and again not easily modifiable
<a class="reference external" href="https://github.com/matplotlib/matplotlib/issues/2699">https://github.com/matplotlib/matplotlib/issues/2699</a></p>
<p>The proposed solution is to take the actions out of the <code class="docutils literal notranslate"><span class="pre">Toolbar</span></code> and the
shortcuts out of the <code class="docutils literal notranslate"><span class="pre">Canvas</span></code>. The actions and shortcuts will be in the form
of <code class="docutils literal notranslate"><span class="pre">Tool</span></code>s.</p>
<p>A new class <code class="docutils literal notranslate"><span class="pre">Navigation</span></code> will be the bridge between the events from the
<code class="docutils literal notranslate"><span class="pre">Canvas</span></code> and <code class="docutils literal notranslate"><span class="pre">Toolbar</span></code> and redirect them to the appropriate <code class="docutils literal notranslate"><span class="pre">Tool</span></code>.</p>
<p>At the end the user interaction will be divided into three classes:</p>
<ul class="simple">
<li><p>NavigationBase: This class is instantiated for each FigureManager
and connect the all user interactions with the Tools</p></li>
<li><p>ToolbarBase: This existing class is relegated only as a GUI access
to Tools.</p></li>
<li><p>ToolBase: Is the basic definition of Tools.</p></li>
</ul>
</section>
<section id="implementation">
<h2><a class="toc-backref" href="#id7">Implementation</a><a class="headerlink" href="#implementation" title="Permalink to this headline">#</a></h2>
<section id="toolbase-object">
<h3><a class="toc-backref" href="#id8">ToolBase(object)</a><a class="headerlink" href="#toolbase-object" title="Permalink to this headline">#</a></h3>
<p>Tools can have a graphical representation as the <code class="docutils literal notranslate"><span class="pre">SubplotTool</span></code> or not even be
present in the Toolbar as <code class="docutils literal notranslate"><span class="pre">Quit</span></code>.</p>
<p>The <a class="reference internal" href="../../api/backend_tools_api.html#matplotlib.backend_tools.ToolBase" title="matplotlib.backend_tools.ToolBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToolBase</span></code></a> has the following class attributes for configuration at definition time</p>
<ul class="simple">
<li><p>keymap = None: Key(s) to be used to trigger the tool</p></li>
<li><p>description = '': Small description of the tool</p></li>
<li><p>image = None: Image that is used in the toolbar</p></li>
</ul>
<p>The following instance attributes are set at instantiation:</p>
<ul class="simple">
<li><p>name</p></li>
<li><p>navigation</p></li>
</ul>
<section id="methods">
<h4><a class="toc-backref" href="#id9">Methods</a><a class="headerlink" href="#methods" title="Permalink to this headline">#</a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">trigger(self,</span> <span class="pre">event)</span></code>: This is the main method of the Tool, it is called
when the Tool is triggered by:</p>
<ul>
<li><p>Toolbar button click</p></li>
<li><p>keypress associated with the Tool Keymap</p></li>
<li><p>Call to navigation.trigger_tool(name)</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">set_figure(self,</span> <span class="pre">figure)</span></code>: Set the figure and navigation attributes</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">destroy(self,</span> <span class="pre">*args)</span></code>: Destroy the <code class="docutils literal notranslate"><span class="pre">Tool</span></code> graphical interface (if
exists)</p></li>
</ul>
</section>
<section id="available-tools">
<h4><a class="toc-backref" href="#id10">Available Tools</a><a class="headerlink" href="#available-tools" title="Permalink to this headline">#</a></h4>
<ul class="simple">
<li><p>ToolQuit</p></li>
<li><p>ToolEnableAllNavigation</p></li>
<li><p>ToolEnableNavigation</p></li>
<li><p>ToolToggleGrid</p></li>
<li><p>ToolToggleFullScreen</p></li>
<li><p>ToolToggleYScale</p></li>
<li><p>ToolToggleXScale</p></li>
<li><p>ToolHome</p></li>
<li><p>ToolBack</p></li>
<li><p>ToolForward</p></li>
<li><p>SaveFigureBase</p></li>
<li><p>ConfigureSubplotsBase</p></li>
</ul>
</section>
</section>
<section id="tooltogglebase-toolbase">
<h3><a class="toc-backref" href="#id11">ToolToggleBase(ToolBase)</a><a class="headerlink" href="#tooltogglebase-toolbase" title="Permalink to this headline">#</a></h3>
<p>The <a class="reference internal" href="../../api/backend_tools_api.html#matplotlib.backend_tools.ToolToggleBase" title="matplotlib.backend_tools.ToolToggleBase"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToolToggleBase</span></code></a> has the following class attributes for
configuration at definition time</p>
<ul class="simple">
<li><p>radio_group = None: Attribute to group 'radio' like tools (mutually
exclusive)</p></li>
<li><p>cursor = None: Cursor to use when the tool is active</p></li>
</ul>
<p>The <strong>Toggleable</strong> Tools, can capture keypress, mouse moves, and mouse
button press</p>
<section id="id1">
<h4><a class="toc-backref" href="#id12">Methods</a><a class="headerlink" href="#id1" title="Permalink to this headline">#</a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">enable(self,</span> <span class="pre">event)</span></code>: Called by <a class="reference internal" href="../../api/backend_tools_api.html#matplotlib.backend_tools.ToolToggleBase.trigger" title="matplotlib.backend_tools.ToolToggleBase.trigger"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToolToggleBase.trigger</span></code></a> method</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">disable(self,</span> <span class="pre">event)</span></code>: Called when the tool is untoggled</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">toggled</span></code>: <strong>Property</strong> True or False</p></li>
</ul>
</section>
<section id="id2">
<h4><a class="toc-backref" href="#id13">Available Tools</a><a class="headerlink" href="#id2" title="Permalink to this headline">#</a></h4>
<ul class="simple">
<li><p>ToolZoom</p></li>
<li><p>ToolPan</p></li>
</ul>
</section>
</section>
<section id="navigationbase">
<h3><a class="toc-backref" href="#id14">NavigationBase</a><a class="headerlink" href="#navigationbase" title="Permalink to this headline">#</a></h3>
<p>Defines the following attributes:</p>
<ul class="simple">
<li><p>canvas:</p></li>
<li><p>keypresslock: Lock to know if the <code class="docutils literal notranslate"><span class="pre">canvas</span></code> <code class="docutils literal notranslate"><span class="pre">key_press_event</span></code> is
available and process it</p></li>
<li><p>messagelock: Lock to know if the message is available to write</p></li>
</ul>
<section id="methods-intended-for-the-end-user">
<h4><a class="toc-backref" href="#id15">Methods (intended for the end user)</a><a class="headerlink" href="#methods-intended-for-the-end-user" title="Permalink to this headline">#</a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">nav_connect(self,</span> <span class="pre">s,</span> <span class="pre">func)</span></code>: Connect to navigation for events</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">nav_disconnect(self,</span> <span class="pre">cid)</span></code>: Disconnect from navigation event</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">message_event(self,</span> <span class="pre">message,</span> <span class="pre">sender=None)</span></code>: Emit a
tool_message_event event</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">active_toggle(self)</span></code>: <strong>Property</strong> The currently toggled tools or
None</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">get_tool_keymap(self,</span> <span class="pre">name)</span></code>: Return a list of keys that are
associated with the tool</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">set_tool_keymap(self,</span> <span class="pre">name,</span> <span class="pre">``*keys</span></code>)``: Set the keys for the given tool</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">remove_tool(self,</span> <span class="pre">name)</span></code>: Removes tool from the navigation control.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">add_tools(self,</span> <span class="pre">tools)</span></code>: Add multiple tools to <code class="docutils literal notranslate"><span class="pre">Navigation</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">add_tool(self,</span> <span class="pre">name,</span> <span class="pre">tool,</span> <span class="pre">group=None,</span> <span class="pre">position=None)</span></code>: Add a tool
to the <code class="docutils literal notranslate"><span class="pre">Navigation</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">tool_trigger_event(self,</span> <span class="pre">name,</span> <span class="pre">sender=None,</span> <span class="pre">canvasevent=None,</span>
<span class="pre">data=None)</span></code>: Trigger a tool and fire the event</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">tools</span></code>: <strong>Property</strong> A dict with available tools with
corresponding keymaps, descriptions and objects</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">get_tool(self,</span> <span class="pre">name)</span></code>: Return the tool object</p></li>
</ul>
</section>
</section>
<section id="toolbarbase">
<h3><a class="toc-backref" href="#id16">ToolbarBase</a><a class="headerlink" href="#toolbarbase" title="Permalink to this headline">#</a></h3>
<section id="methods-for-backend-implementation">
<h4><a class="toc-backref" href="#id17">Methods (for backend implementation)</a><a class="headerlink" href="#methods-for-backend-implementation" title="Permalink to this headline">#</a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">add_toolitem(self,</span> <span class="pre">name,</span> <span class="pre">group,</span> <span class="pre">position,</span> <span class="pre">image,</span> <span class="pre">description,</span> <span class="pre">toggle)</span></code>:
Add a toolitem to the toolbar. This method is a callback from
<code class="docutils literal notranslate"><span class="pre">tool_added_event</span></code> (emitted by navigation)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">set_message(self,</span> <span class="pre">s)</span></code>: Display a message on toolbar or in status bar</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">toggle_toolitem(self,</span> <span class="pre">name)</span></code>: Toggle the toolitem without firing event.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">remove_toolitem(self,</span> <span class="pre">name)</span></code>: Remove a toolitem from the <code class="docutils literal notranslate"><span class="pre">Toolbar</span></code></p></li>
</ul>
</section>
</section>
</section>
<section id="backward-compatibility">
<h2><a class="toc-backref" href="#id18">Backward compatibility</a><a class="headerlink" href="#backward-compatibility" title="Permalink to this headline">#</a></h2>
<p>For backward compatibility added 'navigation' to the list of values
supported by <code class="docutils literal notranslate"><a class="reference external" href="../../tutorials/introductory/customizing.html?highlight=toolbar#a-sample-matplotlibrc-file"><span class="pre">rcParams["toolbar"]</span></a></code> (default: <code class="docutils literal notranslate"><span class="pre">'toolbar2'</span></code>), that is used for <code class="docutils literal notranslate"><span class="pre">Navigation</span></code> classes
instantiation instead of the NavigationToolbar classes</p>
<p>With this parameter, it makes it transparent to anyone using the
existing backends.</p>
<p>[@pelson comment: This also gives us an opportunity to avoid needing
to implement all of this in the same PR - some backends can
potentially exist without the new functionality for a short while (but
it must be done at some point).]</p>
</section>
</section>
</div>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<div id="unreleased-message"> You are reading an old version of the documentation (v3.5.2). For the latest version see <a href="https://matplotlib.org/stable/devel/MEP/MEP22.html">https://matplotlib.org/stable/devel/MEP/MEP22.html</a></div>
<script src="../../_static/scripts/pydata-sphinx-theme.js?digest=1999514e3f237ded88cf"></script>
<footer class="footer mt-5 mt-md-0">
<div class="container">
<div class="footer-item">
<p class="copyright">
© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2022 The Matplotlib development team.<br>
</p>
</div>
<div class="footer-item">
<p class="sphinx-version">
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.5.0.<br>
</p>
</div>
</div>
</footer>
</body>
</html>