Home > Software engineering >  Display matplotlib legend element as 2D line of colormap
Display matplotlib legend element as 2D line of colormap

Time:07-27

I wish to modify the 2D line in my legend to plot as code output showing concentric circles are variable radii

CodePudding user response:

The following approach uses the using HandlerTuple for the legend

CodePudding user response:

I am not sure if this is your goal but here is a stab at it. Following Fig with colorbar

I was unsuccessful in creating an actual ax.legend() from a LineCollection or a multicolored line - it only plotted one color - so my solution was this 'fake' legend approach. Hope this helps, cheers.

  • Related