shamrock.matplotlib.legend.HandlerColormapLine#

class shamrock.matplotlib.legend.HandlerColormapLine(cmap, num_stripes=8)#

Bases: HandlerBase

Legend handler that draws a horizontal colormap gradient swatch.

Methods

adjust_drawing_area

create_artists

Return the legend artists generated.

legend_artist

Return the artist that this HandlerBase generates for the given original artist/handle.

update_prop

create_artists(legend, orig_handle, xdescent, ydescent, width, height, fontsize, trans)#

Return the legend artists generated.

Parameters#

legend~matplotlib.legend.Legend

The legend for which these legend artists are being created.

orig_handle~matplotlib.artist.Artist or similar

The object for which these legend artists are being created.

xdescent, ydescent, width, heightint

The rectangle (xdescent, ydescent, width, height) that the legend artists being created should fit within.

fontsizeint

The fontsize in pixels. The legend artists being created should be scaled according to the given fontsize.

trans~matplotlib.transforms.Transform

The transform that is applied to the legend artists being created. Typically from unit coordinates in the handler box to screen coordinates.

legend_artist(legend, orig_handle, fontsize, handlebox)#

Return the artist that this HandlerBase generates for the given original artist/handle.

Parameters#

legend~matplotlib.legend.Legend

The legend for which these legend artists are being created.

orig_handlematplotlib.artist.Artist or similar

The object for which these legend artists are being created.

fontsizeint

The fontsize in pixels. The artists being created should be scaled according to the given fontsize.

handlebox~matplotlib.offsetbox.OffsetBox

The box which has been created to hold this legend entry’s artists. Artists created in the legend_artist method must be added to this handlebox inside this method.