-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapi_changes.html
1018 lines (801 loc) · 52.1 KB
/
api_changes.html
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
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" data-content_root="../" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>API guidelines — Matplotlib 3.11.0.dev711+g492a478bfe documentation</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="../_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="../_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="../_static/css/style.css?v=f16eb9d3" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css?v=4ae1632d" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery.css?v=d2d258e8" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery-binder.css?v=f4aeca0c" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery-dataframe.css?v=2082cf3c" />
<link rel="stylesheet" type="text/css" href="../_static/sg_gallery-rendered-html.css?v=1277b6f3" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />
<link rel="stylesheet" type="text/css" href="../_static/mpl.css?v=459c4223" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="../_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/documentation_options.js?v=bd5d8ceb"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=ccdb6887"></script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script data-domain="matplotlib.org" defer="defer" src="https://views.scientific-python.org/js/script.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'devel/api_changes';</script>
<script>
DOCUMENTATION_OPTIONS.theme_version = '0.15.4';
DOCUMENTATION_OPTIONS.theme_switcher_json_url = 'https://matplotlib.org/devdocs/_static/switcher.json?v3.10.1-711-g492a478bfe';
DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'dev';
DOCUMENTATION_OPTIONS.show_version_warning_banner = true;
</script>
<link rel="canonical" href="https://matplotlib.org/stable/devel/api_changes.html" />
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 3.11.0.dev711+g492a478bfe documentation"
href="../_static/opensearch.xml"/>
<link rel="icon" href="../_static/favicon.ico"/>
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Testing" href="testing.html" />
<link rel="prev" title="Licenses for contributed code" href="license.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
<meta name="docbuild:last-update" content="Feb 27, 2025"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search the docs ..."
aria-label="Search the docs ..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
<div class="bd-header__inner bd-page-width">
<button class="pst-navbar-icon sidebar-toggle primary-toggle" aria-label="Site navigation">
<span class="fa-solid fa-bars"></span>
</button>
<div class="col-lg-3 navbar-header-items__start">
<div class="navbar-item">
<a class="navbar-brand logo" href="https://matplotlib.org/stable/">
<img src="../_static/logo_light.svg" class="logo__image only-light" alt="Matplotlib 3.11.0.dev711+g492a478bfe documentation - Home"/>
<script>document.write(`<img src="../_static/logo_dark.svg" class="logo__image only-dark" alt="Matplotlib 3.11.0.dev711+g492a478bfe documentation - Home"/>`);</script>
</a></div>
</div>
<div class="col-lg-9 navbar-header-items">
<div class="me-auto navbar-header-items__center">
<div class="navbar-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="../users/index.html">User guide</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="../gallery/index.html">Examples</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="index.html">Contribute</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../users/release_notes.html">Releases</a>
</li>
</ul></div>
</div>
<div class="navbar-header-items__end">
<div class="navbar-item navbar-persistent--container">
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</script>
</div>
<div class="navbar-item">
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script></div>
<div class="navbar-item">
<script>
document.write(`
<div class="version-switcher__container dropdown">
<button id="pst-version-switcher-button-2"
type="button"
class="version-switcher__button btn btn-sm dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="pst-version-switcher-list-2"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="pst-version-switcher-list-2"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="pst-version-switcher-button-2">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div>
`);
</script></div>
<div class="navbar-item"><ul class="navbar-icon-links"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://gitter.im/matplotlib/matplotlib" title="Gitter" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-gitter fa-lg" aria-hidden="true"></i>
<span class="sr-only">Gitter</span></a>
</li>
<li class="nav-item">
<a href="https://discourse.matplotlib.org" title="Discourse" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-discourse fa-lg" aria-hidden="true"></i>
<span class="sr-only">Discourse</span></a>
</li>
<li class="nav-item">
<a href="https://github.com/matplotlib/matplotlib" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-github fa-lg" aria-hidden="true"></i>
<span class="sr-only">GitHub</span></a>
</li>
</ul></div>
</div>
</div>
<div class="navbar-persistent--mobile">
<script>
document.write(`
<button class="btn btn-sm pst-navbar-icon search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button>
`);
</script>
</div>
<button class="pst-navbar-icon sidebar-toggle secondary-toggle" aria-label="On this page">
<span class="fa-solid fa-outdent"></span>
</button>
</div>
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
<div class="sidebar-header-items__center">
<div class="navbar-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="../users/index.html">User guide</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="../gallery/index.html">Examples</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="index.html">Contribute</a>
</li>
<li class="nav-item">
<a class="reference internal nav-link" href="../users/release_notes.html">Releases</a>
</li>
</ul></div>
</div>
<div class="sidebar-header-items__end">
<div class="navbar-item">
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script></div>
<div class="navbar-item">
<script>
document.write(`
<div class="version-switcher__container dropdown">
<button id="pst-version-switcher-button-3"
type="button"
class="version-switcher__button btn btn-sm dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="pst-version-switcher-list-3"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="pst-version-switcher-list-3"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="pst-version-switcher-button-3">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div>
`);
</script></div>
<div class="navbar-item"><ul class="navbar-icon-links"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://gitter.im/matplotlib/matplotlib" title="Gitter" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-gitter fa-lg" aria-hidden="true"></i>
<span class="sr-only">Gitter</span></a>
</li>
<li class="nav-item">
<a href="https://discourse.matplotlib.org" title="Discourse" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-discourse fa-lg" aria-hidden="true"></i>
<span class="sr-only">Discourse</span></a>
</li>
<li class="nav-item">
<a href="https://github.com/matplotlib/matplotlib" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-github fa-lg" aria-hidden="true"></i>
<span class="sr-only">GitHub</span></a>
</li>
</ul></div>
</div>
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<nav class="bd-docs-nav bd-links"
aria-label="Section Navigation">
<p class="bd-links__title" role="heading" aria-level="1">Section Navigation</p>
<div class="bd-toc-item navbar-nav"><ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contributing guide</a></li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="development_setup.html">Setting up Matplotlib for development</a></li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="development_workflow.html">Development workflow</a></li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
</ul>
<ul class="current nav bd-sidenav">
<li class="toctree-l1 has-children"><a class="reference internal" href="coding_guide.html">Coding guidelines</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
<li class="toctree-l2"><a class="reference internal" href="license.html">Licenses for contributed code</a></li>
</ul>
</details></li>
<li class="toctree-l1 current active"><a class="current reference internal" href="#">API guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing</a></li>
</ul>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="document.html">Write 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="tag_guidelines.html">Tagging guidelines</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
<li class="toctree-l2"><a class="reference internal" href="tag_glossary.html">Tag Glossary</a></li>
</ul>
</details></li>
</ul>
<ul class="nav bd-sidenav">
<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="pr_guide.html">Pull request guidelines</a></li>
</ul>
<ul class="nav bd-sidenav">
<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="communication_guide.html">Community management guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="min_dep_policy.html">Dependency version policy</a></li>
<li class="toctree-l1 has-children"><a class="reference internal" href="MEP/index.html">Matplotlib Enhancement Proposals</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul>
<li class="toctree-l2"><a class="reference internal" href="MEP/template.html">MEP Template</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP08.html">MEP8: PEP8</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP09.html">MEP9: Global interaction manager</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP10.html">MEP10: Docstring consistency</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP11.html">MEP11: Third-party dependencies</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP12.html">MEP12: Improve Gallery and Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP13.html">MEP13: Use properties for Artists</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP14.html">MEP14: Text handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/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="MEP/MEP19.html">MEP19: Continuous Integration</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP21.html">MEP21: color and cm refactor</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP22.html">MEP22: Toolbar rewrite</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP23.html">MEP23: Multiple Figures per GUI window</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP24.html">MEP24: Negative radius in polar plots</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP25.html">MEP25: Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP26.html">MEP26: Artist styling</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP27.html">MEP27: Decouple pyplot from backends</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP28.html">MEP28: Remove Complexity from Axes.boxplot</a></li>
<li class="toctree-l2"><a class="reference internal" href="MEP/MEP29.html">MEP29: Text light markup</a></li>
</ul>
</details></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item">
<nav aria-label="Breadcrumb" class="d-print-none">
<ul class="bd-breadcrumbs">
<li class="breadcrumb-item breadcrumb-home">
<a href="../index.html" class="nav-link" aria-label="Home">
<i class="fa-solid fa-home"></i>
</a>
</li>
<li class="breadcrumb-item"><a href="index.html" class="nav-link">Contribute</a></li>
<li class="breadcrumb-item active" aria-current="page">API guidelines</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section id="api-guidelines">
<span id="api-changes"></span><h1>API guidelines<a class="headerlink" href="#api-guidelines" title="Link to this heading">#</a></h1>
<p>API consistency and stability are of great value; Therefore, API changes
(e.g. signature changes, behavior changes, removals) will only be conducted
if the added benefit is worth the effort of adapting existing code.</p>
<p>Because we are a visualization library, our primary output is the final
visualization the user sees; therefore, the appearance of the figure is part of
the API and any changes, either semantic or aesthetic, are backwards-incompatible
API changes.</p>
<section id="add-new-api">
<h2>Add new API<a class="headerlink" href="#add-new-api" title="Link to this heading">#</a></h2>
<p>Every new function, parameter and attribute that is not explicitly marked as
private (i.e., starts with an underscore) becomes part of Matplotlib's public
API. As discussed above, changing the existing API is cumbersome. Therefore,
take particular care when adding new API:</p>
<ul class="simple">
<li><p>Mark helper functions and internal attributes as private by prefixing them
with an underscore.</p></li>
<li><p>Carefully think about good names for your functions and variables.</p></li>
<li><p>Try to adopt patterns and naming conventions from existing parts of the
Matplotlib API.</p></li>
<li><p>Consider making as many arguments keyword-only as possible. See also
<a class="reference external" href="https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters">API Evolution the Right Way -- Add Parameters Compatibly</a>.</p>
</li>
</ul>
</section>
<section id="add-or-change-colormaps-color-sequences-and-styles">
<h2>Add or change colormaps, color sequences, and styles<a class="headerlink" href="#add-or-change-colormaps-color-sequences-and-styles" title="Link to this heading">#</a></h2>
<p>Visual changes are considered an API break. Therefore, we generally do not modify
existing colormaps, color sequences, or styles.</p>
<p>We put a high bar on adding new colormaps and styles to prevent excessively growing
them. While the decision is case-by-case, evaluation criteria include:</p>
<ul class="simple">
<li><p>novelty: Does it support a new use case? e.g. slight variations of existing maps,
sequences and styles are likely not accepted.</p></li>
<li><p>usability and accessibility: Are colors of sequences sufficiently distinct? Has
colorblindness been considered?</p></li>
<li><p>evidence of wide spread usage: for example academic papers, industry blogs and
whitepapers, or inclusion in other visualization libraries or domain specific tools</p></li>
<li><p>open license: colormaps, sequences, and styles must have a BSD compatible license
(see <a class="reference internal" href="license.html#license-discussion"><span class="std std-ref">Licenses for contributed code</span></a>)</p></li>
</ul>
</section>
<section id="deprecate-api">
<span id="deprecation-guidelines"></span><h2>Deprecate API<a class="headerlink" href="#deprecate-api" title="Link to this heading">#</a></h2>
<p>When deciding to deprecate API we carefully consider the balance between the advantages
(clearer interfaces, better usability, less maintenance) and the disadvantages (users
have to learn new API and have to modify existing code).</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>A rough estimate on the current usage of an API can be obtained by a GitHub code
search. A good search pattern is typically
<code class="docutils literal notranslate"><span class="pre">[expression]</span> <span class="pre">language:Python</span> <span class="pre">NOT</span> <span class="pre">is:fork</span></code>. <code class="docutils literal notranslate"><span class="pre">[expression]</span></code> may be a simple
string, but often regular expressions are helpful to exclude incorrect matches.
You can start simple and look at the search results, if there are too many
incorrect matches, gradually refine your search criteria.</p>
<p><em>Example</em>: Calls of the method <code class="docutils literal notranslate"><span class="pre">Figure.draw()</span></code> could be matched using
<code class="docutils literal notranslate"><span class="pre">/\bfig(ure)?\.draw\(/</span></code>. This expression employs a number of patterns:</p>
<ul class="simple">
<li><p>Add the opening bracket <code class="docutils literal notranslate"><span class="pre">(</span></code> after the method name to only find method calls.</p></li>
<li><p>Include a common object name if there are otherwise too many false positives.
There are many <code class="docutils literal notranslate"><span class="pre">draw()</span></code> functions out there, but the ones we are looking for
are likely called via <code class="docutils literal notranslate"><span class="pre">fig.draw()</span></code> or <code class="docutils literal notranslate"><span class="pre">figure.draw()</span></code>.</p></li>
<li><p>Use the word boundary marker <code class="docutils literal notranslate"><span class="pre">\b</span></code> to make sure your expression is not a
matching as part of a longer word.</p></li>
</ul>
<p><a class="reference external" href="https://github.com/search?q=%2F%5Cbfig%28ure%29%3F%5C.draw%5C%28%2F+language%3APython+NOT+is%3Afork&type=code">Link to the resulting GitHub search</a></p>
</div>
<p>API changes in Matplotlib have to be performed following the deprecation process
below, except in very rare circumstances as deemed necessary by the development
team. Generally API deprecation happens in two stages:</p>
<ul class="simple">
<li><p><strong>introduce:</strong> warn users that the API <em>will</em> change</p></li>
<li><p><strong>expire:</strong> API <em>is</em> changed as described in the introduction period</p></li>
</ul>
<p>This ensures that users are notified before the change will take effect and thus
prevents unexpected breaking of code. Occasionally deprecations are marked as
<strong>pending</strong>, which means that the deprecation will be introduced in a future release.</p>
<section id="rules">
<h3>Rules<a class="headerlink" href="#rules" title="Link to this heading">#</a></h3>
<ul class="simple">
<li><p>Deprecations are targeted at the next <a class="reference internal" href="pr_guide.html#pr-milestones"><span class="std std-ref">meso release</span></a> (e.g. 3.Y)</p></li>
<li><p>Deprecated API is generally removed (expired) two point-releases after introduction
of the deprecation. Longer deprecations can be imposed by core developers on
a case-by-case basis to give more time for the transition</p></li>
<li><p>The old API must remain fully functional during the deprecation period</p></li>
<li><p>If alternatives to the deprecated API exist, they should be available
during the deprecation period</p></li>
<li><p>If in doubt, decisions about API changes are finally made by the
<a class="reference external" href="https://matplotlib.org/governance/people.html">API consistency lead</a> developer.</p></li>
</ul>
</section>
<section id="introduce-deprecation">
<span id="intro-deprecation"></span><h3>Introduce deprecation<a class="headerlink" href="#introduce-deprecation" title="Link to this heading">#</a></h3>
<p>Deprecations are introduced to warn users that the API will change. The deprecation
notice describes how the API will change. When alternatives to the deprecated API exist,
they are also listed in the notice and decorators.</p>
<ol class="arabic">
<li><p>Create a <a class="reference internal" href="#api-whats-new"><span class="std std-ref">deprecation notice</span></a></p></li>
<li><p>If possible, issue a <a class="reference internal" href="../api/matplotlib_configuration_api.html#matplotlib.MatplotlibDeprecationWarning" title="matplotlib.MatplotlibDeprecationWarning"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MatplotlibDeprecationWarning</span></code></a> when the
deprecated API is used. There are a number of helper tools for this:</p>
<ul class="simple">
<li><p>Use <code class="docutils literal notranslate"><span class="pre">_api.warn_deprecated()</span></code> for general deprecation warnings</p></li>
<li><p>Use the decorator <code class="docutils literal notranslate"><span class="pre">@_api.deprecated</span></code> to deprecate classes, functions,
methods, or properties</p></li>
<li><p>Use <code class="docutils literal notranslate"><span class="pre">@_api.deprecate_privatize_attribute</span></code> to annotate deprecation of
attributes while keeping the internal private version.</p></li>
<li><p>To warn on changes of the function signature, use the decorators
<code class="docutils literal notranslate"><span class="pre">@_api.delete_parameter</span></code>, <code class="docutils literal notranslate"><span class="pre">@_api.rename_parameter</span></code>, and
<code class="docutils literal notranslate"><span class="pre">@_api.make_keyword_only</span></code></p></li>
</ul>
<p>All these helpers take a first parameter <em>since</em>, which should be set to
the next point release, e.g. "3.x".</p>
<p>You can use standard rst cross references in <em>alternative</em>.</p>
</li>
<li><p>Make appropriate changes to the type hints in the associated <code class="docutils literal notranslate"><span class="pre">.pyi</span></code> file.
The general guideline is to match runtime reported behavior.</p>
<ul class="simple">
<li><p>Items marked with <code class="docutils literal notranslate"><span class="pre">@_api.deprecated</span></code> or <code class="docutils literal notranslate"><span class="pre">@_api.deprecate_privatize_attribute</span></code>
are generally kept during the expiry period, and thus no changes are needed on
introduction.</p></li>
<li><p>Items decorated with <code class="docutils literal notranslate"><span class="pre">@_api.rename_parameter</span></code> or <code class="docutils literal notranslate"><span class="pre">@_api.make_keyword_only</span></code>
report the <em>new</em> (post deprecation) signature at runtime, and thus <em>should</em> be
updated on introduction.</p></li>
<li><p>Items decorated with <code class="docutils literal notranslate"><span class="pre">@_api.delete_parameter</span></code> should include a default value hint
for the deleted parameter, even if it did not previously have one (e.g.
<code class="docutils literal notranslate"><span class="pre">param:</span> <span class="pre"><type></span> <span class="pre">=</span> <span class="pre">...</span></code>).</p></li>
</ul>
</li>
</ol>
</section>
<section id="expire-deprecation">
<span id="id2"></span><h3>Expire deprecation<a class="headerlink" href="#expire-deprecation" title="Link to this heading">#</a></h3>
<p>The API changes described in the introduction notice are only implemented after the
introduction period has expired.</p>
<ol class="arabic simple">
<li><p>Create a <a class="reference internal" href="#api-whats-new"><span class="std std-ref">deprecation announcement</span></a>. For the content,
you can usually copy the deprecation notice and adapt it slightly.</p></li>
<li><p>Change the code functionality and remove any related deprecation warnings.</p></li>
<li><p>Make appropriate changes to the type hints in the associated <code class="docutils literal notranslate"><span class="pre">.pyi</span></code> file.</p>
<ul class="simple">
<li><p>Items marked with <code class="docutils literal notranslate"><span class="pre">@_api.deprecated</span></code> or <code class="docutils literal notranslate"><span class="pre">@_api.deprecate_privatize_attribute</span></code>
are to be removed on expiry.</p></li>
<li><p>Items decorated with <code class="docutils literal notranslate"><span class="pre">@_api.rename_parameter</span></code> or <code class="docutils literal notranslate"><span class="pre">@_api.make_keyword_only</span></code>
will have been updated at introduction, and require no change now.</p></li>
<li><p>Items decorated with <code class="docutils literal notranslate"><span class="pre">@_api.delete_parameter</span></code> will need to be updated to the
final signature, in the same way as the <code class="docutils literal notranslate"><span class="pre">.py</span></code> file signature is updated.</p></li>
<li><p>Any entries in <code class="file docutils literal notranslate"><span class="pre">ci/mypy-stubtest-allowlist.txt</span></code> which indicate a deprecation
version should be double checked. In most cases this is not needed, though some
items were never type hinted in the first place and were added to this file
instead. For removed items that were not in the stub file, only deleting from the
allowlist is required.</p></li>
</ul>
</li>
</ol>
</section>
<section id="pending-deprecation">
<span id="id3"></span><h3>Pending deprecation<a class="headerlink" href="#pending-deprecation" title="Link to this heading">#</a></h3>
<p>A pending deprecation is an announcement that a deprecation will be introduced in the
future. By default, pending deprecations do not raise a warning to the user; however,
pending deprecations are rendered in the documentation and listed in the release notes.
Pending notices are primarily intended to give downstream library and tool developers
time to adapt their code so that it does not raise a deprecation
warning. This is because their users cannot act on warnings triggered by how the tools
and libraries use Matplotlib. It's also possible to run Python in dev mode to raise
<a class="reference external" href="https://docs.python.org/3/library/exceptions.html#PendingDeprecationWarning" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">PendingDeprecationWarning</span></code></a>.</p>
<p>To mark a deprecation as pending, set the following parameters on the appropriate
deprecation decorator:
* the <em>pending</em> parameter is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>
* the <em>removal</em> parameter is left blank</p>
<p>When converting a pending deprecation to an introduced deprecation, update the
decorator such that:
* <em>pending</em> is set to <code class="docutils literal notranslate"><span class="pre">False</span></code>
* <em>since</em> is set to the next meso release (3.Y+1)
* <em>removal</em> is set to at least 2 meso releases after (3.Y+3) introduction.</p>
<p>Pending deprecations are documented in the <a class="reference internal" href="#api-whats-new"><span class="std std-ref">API change notes</span></a> in
the same manner as introduced and expired deprecations. The notice should include
<em>pending deprecation</em> in the title.</p>
</section>
</section>
<section id="announce-new-and-deprecated-api">
<span id="api-whats-new"></span><h2>Announce new and deprecated API<a class="headerlink" href="#announce-new-and-deprecated-api" title="Link to this heading">#</a></h2>
<p>When adding or changing the API in a backward in-compatible way, please add the
appropriate <a class="reference internal" href="#versioning-directives"><span class="std std-ref">versioning directive</span></a> and document it
in the <a class="reference internal" href="../users/release_notes.html#release-notes"><span class="std std-ref">release notes</span></a> by adding an entry to the appropriate
folder:</p>
<div class="pst-scrollable-table-container"><table class="table">
<thead>
<tr class="row-odd"><th class="head"></th>
<th class="head"><p>versioning directive</p></th>
<th class="head"><p>announcement folder</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>new feature</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">..</span> <span class="pre">versionadded::</span> <span class="pre">3.N</span></code></p></td>
<td><p><code class="file docutils literal notranslate"><span class="pre">doc/users/next_whats_new/</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>API change</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">..</span> <span class="pre">versionchanged::</span> <span class="pre">3.N</span></code></p></td>
<td><p><code class="file docutils literal notranslate"><span class="pre">doc/api/next_api_changes/[kind]</span></code></p></td>
</tr>
</tbody>
</table>
</div>
<p>When deprecating API, please add a notice as described in the
<a class="reference internal" href="#deprecation-guidelines"><span class="std std-ref">deprecation guidelines</span></a> and summarized here:</p>
<div class="pst-scrollable-table-container"><table class="table">
<thead>
<tr class="row-odd"><th class="head" colspan="2"><p>stage</p></th>
<th class="head"><p>announcement folder</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td colspan="2"><p><a class="reference internal" href="#intro-deprecation"><span class="std std-ref">introduce deprecation</span></a></p></td>
<td><p><code class="file docutils literal notranslate"><span class="pre">doc/api/next_api_changes/deprecation</span></code></p></td>
</tr>
<tr class="row-odd"><td colspan="2"><p><a class="reference internal" href="#expire-deprecation"><span class="std std-ref">expire deprecation</span></a></p></td>
<td><p><code class="file docutils literal notranslate"><span class="pre">doc/api/next_api_changes/[kind]</span></code></p></td>
</tr>
</tbody>
</table>
</div>
<p>Generally the introduction notices can be repurposed for the expiration notice as they
are expected to be describing the same API changes and removals.</p>
<section id="versioning-directives">
<span id="id4"></span><h3>Versioning directives<a class="headerlink" href="#versioning-directives" title="Link to this heading">#</a></h3>
<p>When making a backward incompatible change, please add a versioning directive in
the docstring. The directives should be placed at the end of a description block.
For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">Foo</span><span class="p">:</span>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> This is the summary.</span>
<span class="sd"> Followed by a longer description block.</span>
<span class="sd"> Consisting of multiple lines and paragraphs.</span>
<span class="sd"> .. versionadded:: 3.5</span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> a : int</span>
<span class="sd"> The first parameter.</span>
<span class="sd"> b: bool, default: False</span>
<span class="sd"> This was added later.</span>
<span class="sd"> .. versionadded:: 3.6</span>
<span class="sd"> """</span>
<span class="k">def</span><span class="w"> </span><span class="nf">set_b</span><span class="p">(</span><span class="n">b</span><span class="p">):</span>
<span class="s2">"""</span>
<span class="s2"> Set b.</span>
<span class="s2"> .. versionadded:: 3.6</span>
<span class="s2"> Parameters</span>
<span class="s2"> ----------</span>
<span class="s2"> b: bool</span>
</pre></div>
</div>
<p>For classes and functions, the directive should be placed before the
<em>Parameters</em> section. For parameters, the directive should be placed at the
end of the parameter description. The micro release version is omitted and
the directive should not be added to entire modules.</p>
</section>
<section id="release-notes">
<span id="id5"></span><h3>Release notes<a class="headerlink" href="#release-notes" title="Link to this heading">#</a></h3>
<p>For both change notes and what's new, please avoid using cross-references in section
titles as it causes links to be confusing in the table of contents. Instead, ensure that
a cross-reference is included in the descriptive text.</p>
<section id="api-change-notes">
<span id="id6"></span><h4>API change notes<a class="headerlink" href="#api-change-notes" title="Link to this heading">#</a></h4>
<p>API change notes for future releases are collected in <code class="file docutils literal notranslate"><span class="pre">doc/api/next_api_changes/</span></code>.
They are divided into four subdirectories:</p>
<ul class="simple">
<li><p><strong>Deprecations</strong>: Announcements of future changes. Typically, these will
raise a deprecation warning and users of this API should change their code
to stay compatible with future releases of Matplotlib. If possible, state
what should be used instead.</p></li>
<li><p><strong>Removals</strong>: Parts of the API that got removed. If possible, state what
should be used instead.</p></li>
<li><p><strong>Behaviour changes</strong>: API that stays valid but will yield a different
result.</p></li>
<li><p><strong>Development changes</strong>: Changes to the build process, dependencies, etc.</p></li>
</ul>
<p>Please place new entries in these directories with a new file named
<code class="docutils literal notranslate"><span class="pre">99999-ABC.rst</span></code>, where <code class="docutils literal notranslate"><span class="pre">99999</span></code> would be the PR number, and <code class="docutils literal notranslate"><span class="pre">ABC</span></code> the
author's initials. Typically, each change will get its own file, but you may
also amend existing files when suitable. The overall goal is a comprehensible
documentation of the changes.</p>
<p>A typical entry could look like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Locators
~~~~~~~~
The unused `Locator.autoscale()` method is deprecated (pass the axis
limits to `Locator.view_limits()` instead).
</pre></div>
</div>
<p>Please avoid using references in section titles, as it causes links to be
confusing in the table of contents. Instead, ensure that a reference is
included in the descriptive text. Use inline literals (double backticks)
to denote code objects in the title.</p>
</section>
<section id="what-s-new-notes">
<span id="whats-new-notes"></span><h4>What's new notes<a class="headerlink" href="#what-s-new-notes" title="Link to this heading">#</a></h4>
<p>Each new feature (e.g. function, parameter, config value, behavior, ...) must
be described through a "What's new" entry.</p>
<p>Each entry is written into a separate file in the
<code class="file docutils literal notranslate"><span class="pre">doc/users/next_whats_new/</span></code> directory. They are sorted and merged into
<code class="file docutils literal notranslate"><span class="pre">whats_new.rst</span></code> during the release process.</p>
<p>When adding an entry please look at the currently existing files to
see if you can extend any of them. If you create a file, name it
something like <code class="file docutils literal notranslate"><span class="pre">cool_new_feature.rst</span></code> if you have added a brand new
feature or something like <code class="file docutils literal notranslate"><span class="pre">updated_feature.rst</span></code> for extensions of
existing features.</p>
<p>Include contents of the form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Section</span> <span class="n">title</span> <span class="k">for</span> <span class="n">feature</span>
<span class="o">-------------------------</span>
<span class="n">A</span> <span class="n">description</span> <span class="n">of</span> <span class="n">the</span> <span class="n">feature</span> <span class="kn">from</span><span class="w"> </span><span class="nn">the</span> <span class="n">user</span> <span class="n">perspective</span><span class="o">.</span> <span class="n">This</span> <span class="n">should</span> <span class="n">include</span>
<span class="n">what</span> <span class="n">the</span> <span class="n">feature</span> <span class="n">allows</span> <span class="n">users</span> <span class="n">to</span> <span class="n">do</span> <span class="ow">and</span> <span class="n">how</span> <span class="n">the</span> <span class="n">feature</span> <span class="ow">is</span> <span class="n">used</span><span class="o">.</span> <span class="n">Technical</span>
<span class="n">details</span> <span class="n">should</span> <span class="n">be</span> <span class="n">left</span> <span class="n">out</span> <span class="n">when</span> <span class="n">they</span> <span class="n">do</span> <span class="ow">not</span> <span class="n">impact</span> <span class="n">usage</span><span class="p">,</span> <span class="k">for</span> <span class="n">example</span>
<span class="n">implementation</span> <span class="n">details</span><span class="o">.</span>
<span class="n">The</span> <span class="n">description</span> <span class="n">may</span> <span class="n">include</span> <span class="n">a</span> <span class="n">a</span> <span class="n">short</span> <span class="n">instructive</span> <span class="n">example</span><span class="p">,</span> <span class="k">if</span> <span class="n">it</span> <span class="n">helps</span> <span class="n">to</span>
<span class="n">understand</span> <span class="n">the</span> <span class="n">feature</span><span class="o">.</span>
</pre></div>
</div>
<p>Please avoid using references in section titles, as it causes links to be
confusing in the table of contents. Instead, ensure that a reference is
included in the descriptive text. Use inline literals (double backticks)
to denote code objects in the title.</p>
</section>
</section>
</section>
<section id="discourage-api">
<h2>Discourage API<a class="headerlink" href="#discourage-api" title="Link to this heading">#</a></h2>
<p>We have API that we do not recommend anymore for new code, but that cannot be
deprecated because its removal would be breaking backward-compatibility and too
disruptive. In such a case we can formally discourage API. This can cover
specific parameters, call patterns, whole methods etc.</p>
<p>To do so, add a note to the docstring</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">..</span> <span class="n">admonition</span><span class="p">::</span> <span class="n">Discouraged</span>
<span class="p">[</span><span class="n">description</span> <span class="ow">and</span> <span class="n">suggested</span> <span class="n">alternative</span><span class="p">]</span>
</pre></div>
</div>
<p>You find several examples for good descriptions if you search the codebase for
<code class="docutils literal notranslate"><span class="pre">..</span> <span class="pre">admonition::</span> <span class="pre">Discouraged</span></code>.</p>
<p>Additionally, if a whole function is discouraged, prefix the summary line with
<code class="docutils literal notranslate"><span class="pre">[*Discouraged*]</span></code> so that it renders in the API overview like this</p>
<blockquote>
<div><p>[<em>Discouraged</em>] Return the XAxis instance.</p>
</div></blockquote>
</section>
</section>
</article>
</div>
<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">
<div class="sidebar-secondary-item">
<div
id="pst-page-navigation-heading-2"
class="page-toc tocsection onthispage">
<i class="fa-solid fa-list"></i> On this page
</div>
<nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#add-new-api">Add new API</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#add-or-change-colormaps-color-sequences-and-styles">Add or change colormaps, color sequences, and styles</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#deprecate-api">Deprecate API</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#rules">Rules</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#introduce-deprecation">Introduce deprecation</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#expire-deprecation">Expire deprecation</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#pending-deprecation">Pending deprecation</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#announce-new-and-deprecated-api">Announce new and deprecated API</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#versioning-directives">Versioning directives</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#release-notes">Release notes</a><ul class="nav section-nav flex-column">
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#api-change-notes">API change notes</a></li>
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#what-s-new-notes">What's new notes</a></li>
</ul>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#discourage-api">Discourage API</a></li>
</ul>
</nav></div>
</div></div>
</div>
<footer class="bd-footer-content">
</footer>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="../_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="../_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
<footer class="bd-footer">
<div class="bd-footer__inner bd-page-width">
<div class="footer-items__start">
<div class="footer-item">
<p class="copyright">
© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2025 The Matplotlib development team.
<br/>
</p>
</div>
<div class="footer-item">
<p class="sphinx-version">
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
<br/>
</p>
</div>
<div class="footer-item">
<p class="sphinx-version">
Built from v3.10.1-711-g492a478bfe.
<br/>
</p>
</div>