proplot icon indicating copy to clipboard operation
proplot copied to clipboard

Feature request: allow a single label for a group of lines

Open kinyatoride opened this issue 1 year ago • 4 comments

Description

Hi, is it possible to allow a single label for a group of lines? Currently, we need to pass the same number of labels for plotted elements. Here, I am showing an example of the wished behavior.

import numpy as np
import proplot as pplt

state = np.random.RandomState(51423)
x = np.linspace(0, 5, 20)
y1 = x[:, np.newaxis] + state.rand(20, 10)
y2 = x[::-1, np.newaxis] + state.rand(20, 10)

fig, ax = pplt.subplots()
ax.plot(y1, c='r', label='y1')
ax.plot(y2, c='b', label='y2')
ax.legend()

Expected behavior output

kinyatoride avatar May 01 '23 16:05 kinyatoride