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

Commit6578035

Browse files
committed
Add __all__ to pyplot
1 parent28a0205 commit6578035

File tree

2 files changed

+138
-2
lines changed

2 files changed

+138
-2
lines changed

‎lib/matplotlib/pyplot.py

Lines changed: 119 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,106 @@
3535
implicit and explicit interfaces.
3636
"""
3737

38-
# fmt: off
39-
4038
from __future__importannotations
4139

40+
__all__= [
41+
"Annotation",
42+
"Arrow",
43+
"Artist",
44+
"AutoLocator",
45+
"Axes",
46+
"Circle",
47+
"Figure",
48+
"FixedFormatter",
49+
"FixedLocator",
50+
"FormatStrFormatter",
51+
"Formatter",
52+
"FuncFormatter",
53+
"GridSpec",
54+
"IndexLocator",
55+
"Line2D",
56+
"LinearLocator",
57+
"Locator",
58+
"LogFormatter",
59+
"LogFormatterExponent",
60+
"LogFormatterMathtext",
61+
"LogLocator",
62+
"MaxNLocator",
63+
"MultipleLocator",
64+
"Normalize",
65+
"NullFormatter",
66+
"NullLocator",
67+
"PolarAxes",
68+
"Polygon",
69+
"Rectangle",
70+
"ScalarFormatter",
71+
"Subplot",
72+
"Text",
73+
"draw_all",
74+
"findobj",
75+
"switch_backend",
76+
"show",
77+
"isinteractive",
78+
"ion",
79+
"ioff",
80+
"pause",
81+
"rc_context",
82+
"gci",
83+
"setp",
84+
"xkcd",
85+
"figure",
86+
"gcf",
87+
"fignum_exists",
88+
"get_fignums",
89+
"get_figlabels",
90+
"connect",
91+
"disconnect",
92+
"close",
93+
"clf",
94+
"draw",
95+
"savefig",
96+
"ginput",
97+
"waitforbuttonpress",
98+
"figtext",
99+
"suptitle",
100+
"figimage",
101+
"figlegend",
102+
"axes",
103+
"delaxes",
104+
"sca",
105+
"gca",
106+
"subplot",
107+
"subplot2grid",
108+
"twinx",
109+
"twiny",
110+
"subplots_adjust",
111+
"subplot_tool",
112+
"tight_layout",
113+
"box",
114+
"xlim",
115+
"ylim",
116+
"xticks",
117+
"yticks",
118+
"rgrids",
119+
"thetagrids",
120+
"get_plot_commands",
121+
"colormaps",
122+
"color_sequences",
123+
"colorbar",
124+
"clim",
125+
"set_cmap",
126+
"imread",
127+
"imsave",
128+
"matshow",
129+
"polar",
130+
]# further expanded below with autogenerated functions
131+
132+
# fmt: off
133+
42134
fromcontextlibimportExitStack
43135
fromenumimportEnum
44136
importfunctools
137+
45138
importimportlib
46139
importinspect
47140
importlogging
@@ -4280,3 +4373,27 @@ def nipy_spectral():
42804373
image if there is one. See ``help(colormaps)`` for more information.
42814374
"""
42824375
set_cmap("nipy_spectral")
4376+
4377+
__all__+= [
4378+
"acorr","angle_spectrum","annotate","arrow","autoscale",
4379+
"axhline","axhspan","axis","axline","axvline","axvspan","bar",
4380+
"barbs","barh","bar_label","boxplot","broken_barh","clabel",
4381+
"cohere","contour","contourf","csd","errorbar","eventplot",
4382+
"fill","fill_between","fill_betweenx","grid","hexbin","hist",
4383+
"stairs","hist2d","hlines","imshow","legend","locator_params",
4384+
"loglog","magnitude_spectrum","margins","minorticks_off",
4385+
"minorticks_on","pcolor","pcolormesh","phase_spectrum","pie",
4386+
"plot","plot_date","psd","quiver","quiverkey","scatter",
4387+
"semilogx","semilogy","specgram","spy","stackplot","stem",
4388+
"step","streamplot","table","text","tick_params",
4389+
"ticklabel_format","tricontour","tricontourf","tripcolor",
4390+
"triplot","violinplot","vlines","xcorr","sci","title","xlabel",
4391+
"ylabel","xscale","yscale","figimage","figtext","gca","gci",
4392+
"ginput","subplots_adjust","suptitle","tight_layout",
4393+
"waitforbuttonpress","contour","contourf","hexbin","scatter",
4394+
"pcolor","pcolormesh","hist2d","imshow","spy","quiver",
4395+
"specgram","streamplot","tricontour","tricontourf","tripcolor",
4396+
"autumn","bone","cool","copper","flag","gray","hot","hsv",
4397+
"jet","pink","prism","spring","summer","winter","magma",
4398+
"inferno","plasma","viridis","nipy_spectral"
4399+
]

‎tools/boilerplate.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
importfunctools
1919
importinspect
2020
frominspectimportParameter
21+
importitertools
2122
frompathlibimportPath
2223
importsys
2324
importsubprocess
25+
importtextwrap
2426

2527

2628
# This line imports the installed copy of matplotlib, and not the local copy.
@@ -371,6 +373,23 @@ def boilerplate_gen():
371373
yieldAUTOGEN_MSG
372374
yieldCMAP_TEMPLATE.format(name=name)
373375

376+
# extend __all__
377+
all_text_wrapper=textwrap.TextWrapper(
378+
break_long_words=False,width=74,
379+
initial_indent=' '*4,subsequent_indent=' '*4)
380+
381+
all_additions=all_text_wrapper.fill(
382+
', '.join([
383+
'"%s"'%funcname.split(':',1)[0]
384+
forfuncnameinitertools.chain(
385+
_axes_commands,_figure_commands,cmappable,cmaps
386+
)
387+
])
388+
)
389+
390+
yield'\n'
391+
yieldf'__all__ += [\n{all_additions}\n]\n'
392+
374393

375394
defbuild_pyplot(pyplot_path):
376395
pyplot_orig=pyplot_path.read_text().splitlines(keepends=True)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp