How to add plot icon displayed in legend to axis label?

Is it possible to extract the icon (line, marker, etc) displayed in a typical Legend so that I can display them in ax.xlabel and ax.ylabel?


The left plot is what we usually get by using Legend (or axislegend). I want to produce something similar to the right one where the icon labelling the ScatterLine is now displayed in the ax.ylabel (or somewhere else like ax.title, Label, text!(...), etc)

I’m not quite sure what you need, why do you want a legend symbol in an x or y label? Do you have a visual example of what you wanted to do?

Just added an example