@@ -2120,11 +2120,10 @@ def colormaps():
21202120
21212121def _setup_pyplot_info_docstrings ():
21222122 """
2123- Generate the plotting docstring .
2123+ Setup the docstring of ` plotting` and of the colormap-setting functions .
21242124
2125- These must be done after the entire module is imported, so it is
2126- called from the end of this module, which is generated by
2127- boilerplate.py.
2125+ These must be done after the entire module is imported, so it is called
2126+ from the end of this module, which is generated by boilerplate.py.
21282127 """
21292128 commands = get_plot_commands ()
21302129
@@ -2160,6 +2159,15 @@ def _setup_pyplot_info_docstrings():
21602159 ]
21612160 plotting .__doc__ = '\n ' .join (lines )
21622161
2162+ for cm_name in colormaps ():
2163+ if cm_name in globals ():
2164+ globals ()[cm_name ].__doc__ = f"""
2165+ Set the colormap to { cm_name !r} .
2166+
2167+ This changes the default colormap as well as the colormap of the current
2168+ image if there is one. See ``help(colormaps)`` for more information.
2169+ """
2170+
21632171
21642172## Plotting part 1: manually generated functions and wrappers ##
21652173
@@ -3121,211 +3129,25 @@ def yscale(value, **kwargs):
31213129
31223130
31233131# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3124- def autumn ():
3125- """
3126- Set the colormap to "autumn".
3127-
3128- This changes the default colormap as well as the colormap of the current
3129- image if there is one. See ``help(colormaps)`` for more information.
3130- """
3131- set_cmap ("autumn" )
3132-
3133-
3134- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3135- def bone ():
3136- """
3137- Set the colormap to "bone".
3138-
3139- This changes the default colormap as well as the colormap of the current
3140- image if there is one. See ``help(colormaps)`` for more information.
3141- """
3142- set_cmap ("bone" )
3132+ def autumn (): set_cmap ( 'autumn' )
3133+ def bone (): set_cmap ( 'bone' )
3134+ def cool (): set_cmap ( 'cool' )
3135+ def copper (): set_cmap ( 'copper' )
3136+ def flag (): set_cmap ( 'flag' )
3137+ def gray (): set_cmap ( 'gray' )
3138+ def hot (): set_cmap ( 'hot' )
3139+ def hsv (): set_cmap ('hsv' )
3140+ def jet (): set_cmap ( 'jet' )
3141+ def pink (): set_cmap ( 'pink' )
3142+ def prism (): set_cmap ( 'prism' )
3143+ def spring (): set_cmap ( 'spring' )
3144+ def summer (): set_cmap ( 'summer' )
3145+ def winter (): set_cmap ( 'winter' )
3146+ def magma (): set_cmap ( 'magma' )
3147+ def inferno (): set_cmap ( 'inferno' )
3148+ def plasma (): set_cmap ( 'plasma' )
3149+ def viridis (): set_cmap ( 'viridis' )
3150+ def nipy_spectral (): set_cmap ('nipy_spectral' )
31433151
31443152
3145- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3146- def cool ():
3147- """
3148- Set the colormap to "cool".
3149-
3150- This changes the default colormap as well as the colormap of the current
3151- image if there is one. See ``help(colormaps)`` for more information.
3152- """
3153- set_cmap ("cool" )
3154-
3155-
3156- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3157- def copper ():
3158- """
3159- Set the colormap to "copper".
3160-
3161- This changes the default colormap as well as the colormap of the current
3162- image if there is one. See ``help(colormaps)`` for more information.
3163- """
3164- set_cmap ("copper" )
3165-
3166-
3167- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3168- def flag ():
3169- """
3170- Set the colormap to "flag".
3171-
3172- This changes the default colormap as well as the colormap of the current
3173- image if there is one. See ``help(colormaps)`` for more information.
3174- """
3175- set_cmap ("flag" )
3176-
3177-
3178- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3179- def gray ():
3180- """
3181- Set the colormap to "gray".
3182-
3183- This changes the default colormap as well as the colormap of the current
3184- image if there is one. See ``help(colormaps)`` for more information.
3185- """
3186- set_cmap ("gray" )
3187-
3188-
3189- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3190- def hot ():
3191- """
3192- Set the colormap to "hot".
3193-
3194- This changes the default colormap as well as the colormap of the current
3195- image if there is one. See ``help(colormaps)`` for more information.
3196- """
3197- set_cmap ("hot" )
3198-
3199-
3200- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3201- def hsv ():
3202- """
3203- Set the colormap to "hsv".
3204-
3205- This changes the default colormap as well as the colormap of the current
3206- image if there is one. See ``help(colormaps)`` for more information.
3207- """
3208- set_cmap ("hsv" )
3209-
3210-
3211- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3212- def jet ():
3213- """
3214- Set the colormap to "jet".
3215-
3216- This changes the default colormap as well as the colormap of the current
3217- image if there is one. See ``help(colormaps)`` for more information.
3218- """
3219- set_cmap ("jet" )
3220-
3221-
3222- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3223- def pink ():
3224- """
3225- Set the colormap to "pink".
3226-
3227- This changes the default colormap as well as the colormap of the current
3228- image if there is one. See ``help(colormaps)`` for more information.
3229- """
3230- set_cmap ("pink" )
3231-
3232-
3233- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3234- def prism ():
3235- """
3236- Set the colormap to "prism".
3237-
3238- This changes the default colormap as well as the colormap of the current
3239- image if there is one. See ``help(colormaps)`` for more information.
3240- """
3241- set_cmap ("prism" )
3242-
3243-
3244- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3245- def spring ():
3246- """
3247- Set the colormap to "spring".
3248-
3249- This changes the default colormap as well as the colormap of the current
3250- image if there is one. See ``help(colormaps)`` for more information.
3251- """
3252- set_cmap ("spring" )
3253-
3254-
3255- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3256- def summer ():
3257- """
3258- Set the colormap to "summer".
3259-
3260- This changes the default colormap as well as the colormap of the current
3261- image if there is one. See ``help(colormaps)`` for more information.
3262- """
3263- set_cmap ("summer" )
3264-
3265-
3266- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3267- def winter ():
3268- """
3269- Set the colormap to "winter".
3270-
3271- This changes the default colormap as well as the colormap of the current
3272- image if there is one. See ``help(colormaps)`` for more information.
3273- """
3274- set_cmap ("winter" )
3275-
3276-
3277- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3278- def magma ():
3279- """
3280- Set the colormap to "magma".
3281-
3282- This changes the default colormap as well as the colormap of the current
3283- image if there is one. See ``help(colormaps)`` for more information.
3284- """
3285- set_cmap ("magma" )
3286-
3287-
3288- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3289- def inferno ():
3290- """
3291- Set the colormap to "inferno".
3292-
3293- This changes the default colormap as well as the colormap of the current
3294- image if there is one. See ``help(colormaps)`` for more information.
3295- """
3296- set_cmap ("inferno" )
3297-
3298-
3299- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3300- def plasma ():
3301- """
3302- Set the colormap to "plasma".
3303-
3304- This changes the default colormap as well as the colormap of the current
3305- image if there is one. See ``help(colormaps)`` for more information.
3306- """
3307- set_cmap ("plasma" )
3308-
3309-
3310- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3311- def viridis ():
3312- """
3313- Set the colormap to "viridis".
3314-
3315- This changes the default colormap as well as the colormap of the current
3316- image if there is one. See ``help(colormaps)`` for more information.
3317- """
3318- set_cmap ("viridis" )
3319-
3320-
3321- # Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3322- def nipy_spectral ():
3323- """
3324- Set the colormap to "nipy_spectral".
3325-
3326- This changes the default colormap as well as the colormap of the current
3327- image if there is one. See ``help(colormaps)`` for more information.
3328- """
3329- set_cmap ("nipy_spectral" )
3330-
33313153_setup_pyplot_info_docstrings ()
0 commit comments