matplotlib - Python multiple boxplots automatic label -
is possible automatically set labels multiple boxplots? know can done custom annotations or ticklabels, possible automatically?
naively 1 expect following, plt.boxplot doesn't support labels.
import numpy np import matplotlib.pyplot plt #fake data data = (np.random.random(50), np.random.random(50)) labels = ('random set 1', 'random set 2') plt.boxplot(data, labels=labels) plt.legend() plt.show()
any ideas?
i realized shortest , cleanest along lines of:
import numpy np import matplotlib.pyplot plt #fake data data = (np.random.random(50), np.random.random(50)) labels = ('random set 1', 'random set 2') plt.boxplot(data) plt.xticks(np.arange(len(labels))+1,labels) plt.show()
but i'm still open other (automatic) suggestions.
Comments
Post a Comment