@@ -149,17 +149,15 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
149149norm = mpl .colors .Normalize (vmin = 1 , vmax = 17 )
150150# Create an empty ScalarMappable to set the colorbar's colormap and norm.
151151# The following gives a basic continuous colorbar with ticks and labels.
152- cb1 = fig .colorbar (mpl .cm .ScalarMappable (cmap = cmap , norm = norm ),
153- cax = axl , orientation = 'horizontal' )
154- cb1 .set_label ('Some Units' )
152+ fig .colorbar (mpl .cm .ScalarMappable (cmap = cmap , norm = norm ),
153+ cax = axl , orientation = 'horizontal' , label = 'Some Units' )
155154
156155
157156# And again for the second colorbar.
158157cmap2 = mpl .cm .cool
159158norm2 = mpl .colors .Normalize (vmin = 1 , vmax = 17 )
160- cb2 = fig .colorbar (mpl .cm .ScalarMappable (cmap = cmap2 , norm = norm2 ),
161- cax = axl2 , orientation = 'horizontal' )
162- cb2 .set_label ('Some other units' )
159+ fig .colorbar (mpl .cm .ScalarMappable (cmap = cmap2 , norm = norm2 ),
160+ cax = axl2 , orientation = 'horizontal' , label = 'Some other units' )
163161
164162
165163# The second example illustrates the use of a ListedColormap, a
@@ -173,15 +171,15 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
173171# monotonically increasing.
174172bounds = [2 , 3 , 7 , 9 , 15 ]
175173norm3 = mpl .colors .BoundaryNorm (bounds , cmap3 .N )
176- cb3 = fig .colorbar (mpl .cm .ScalarMappable (cmap = cmap3 , norm = norm3 ),
177- cax = axl3 ,
178- # to use 'extend', you must specify two extra boundaries:
179- boundaries = [0 ] + bounds + [18 ],
180- extend = 'both' ,
181- ticks = bounds , # optional
182- spacing = 'proportional' ,
183- orientation = 'horizontal' )
184- cb3 . set_label ( 'Discrete intervals, some other units' )
174+ fig .colorbar (mpl .cm .ScalarMappable (cmap = cmap3 , norm = norm3 ),
175+ cax = axl3 ,
176+ # to use 'extend', you must specify two extra boundaries:
177+ boundaries = [0 ] + bounds + [18 ],
178+ extend = 'both' ,
179+ ticks = bounds , # optional
180+ spacing = 'proportional' ,
181+ orientation = 'horizontal' ,
182+ label = 'Discrete intervals, some other units' )
185183
186184
187185# Create the 17 segment model
0 commit comments