MBravoS / splotch

Simple PLOTs, Contours and Histograms is a small package with wrapper functions designed to simplify plotting calls from matplotlib.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

splotch.curve() overwrites any existing legend #62

Closed AstroRobin closed 3 years ago

AstroRobin commented 3 years ago

The current functionality of splotch.curve() means that when a legend is produced, it overwrites any legend that may already exist. Instead, splotch.curve() should extract any legend object that currently exists in the axis and append the created curves handles.

This issue may actually be present in several other functions that produce legends on the fly.

AstroRobin commented 3 years ago

splotch.curve() no longer attempts to create legends during the call, rather it simply adds labels to each of the plot calls, relying on the user to create a legend afterwards. The idea here is that splotch.curve() will only take care of the auto-generation of fancy handles and labels for the expression(s), but the creation and positioning of a legend object itself should be handled by plt.legend(), which allows this function to be used in conjunction with any other separate matplotlib/splotch call.