I would like some feedback on a new feature I have developed to control the length of colorbar extension triangles. This is a feature I have desired for some time, so that the plots I produce with matplotlib can be more consistent with those produced from other popular plotting software (e.g., IDL). I have added a new keyword argument, extendfrac, to the ColorbarBase class. This may be set to a scalar, a two-tuple, the string ‘auto’, or the string ‘default’. The behaviour of this keyword depends on the setting of the existing spacing keyword argument.

For spacing=‘uniform’ or spacing=‘proportional’:

extendfrac=None - sets the lengths of both the minimum and maximum colorbar extension triangles to 0.05 times the interior colorbar length (the existing hard-coded setting).

extendfrac=‘default’ - same as None.

extendfrac=FRACTION - sets the lengths of both the minimum and maximum colorbar extension triangles to the given fraction of the interior colorbar length.

For spacing=‘uniform’:

extendfrac=‘auto’ - sets the lengths of both the minimum and maximum colorbar extension triangles to be the same as the length of the interior boxes.

For spacing=‘proportional’:

extendfrac=‘auto’ - sets the length of the minimum colorbar extension triangle to the length of the left/bottom-most interior box, and the length of the maximum colorbar extension triangle to the length of the right/top-most interior box.

extendfrac=(FRACTION1, FRACTION2) - as for FRACTION above but the minimum and maximum extension triangles may be different lengths.

This is quite a small modification actually, but it does change the API for colorbars. I am wondering if this could be included in matplotlib? I have set up a fork of matplotlib on Github to implement this feature, if anyone thinks it is worth it…

Andrew

I forgot to include the link to the Github compare page in my last message:

http://github.com/ajdawson/matplotlib/compare/master…colorbar-extensions

Andrew

## ···

On 16 November 2011 12:19, Andrew Dawson <ajdatm@…149…> wrote:

I would like some feedback on a new feature I have developed to control the length of colorbar extension triangles. This is a feature I have desired for some time, so that the plots I produce with matplotlib can be more consistent with those produced from other popular plotting software (e.g., IDL). I have added a new keyword argument, extendfrac, to the ColorbarBase class. This may be set to a scalar, a two-tuple, the string ‘auto’, or the string ‘default’. The behaviour of this keyword depends on the setting of the existing spacing keyword argument.

For spacing=‘uniform’ or spacing=‘proportional’:

extendfrac=None - sets the lengths of both the minimum and maximum colorbar extension triangles to 0.05 times the interior colorbar length (the existing hard-coded setting).

extendfrac=‘default’ - same as None.

extendfrac=FRACTION - sets the lengths of both the minimum and maximum colorbar extension triangles to the given fraction of the interior colorbar length.

For spacing=‘uniform’:

extendfrac=‘auto’ - sets the lengths of both the minimum and maximum colorbar extension triangles to be the same as the length of the interior boxes.

For spacing=‘proportional’:

extendfrac=‘auto’ - sets the length of the minimum colorbar extension triangle to the length of the left/bottom-most interior box, and the length of the maximum colorbar extension triangle to the length of the right/top-most interior box.

extendfrac=(FRACTION1, FRACTION2) - as for FRACTION above but the minimum and maximum extension triangles may be different lengths.

This is quite a small modification actually, but it does change the API for colorbars. I am wondering if this could be included in matplotlib? I have set up a fork of matplotlib on Github to implement this feature, if anyone thinks it is worth it…

Andrew