Legend or Key for charts with colored groups
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cairo Plot |
In Progress
|
Medium
|
Rodrigo Moreira Araújo |
Bug Description
When I make a bar chart, I like the ability to compare different sources of data with groups. For example, here is a chart I'm using for:
cairoplot.
[ [0.87, 0.82], [0.83, 0.50], [0.70, 0.11] ],
340, 280, border = 10, grid = True,
x_labels = ['Parses', 'Generates', 'Generates Original'],
y_labels = ['%d%%' % i for i in range(0,110,10)],
y_bounds = (0,1) )
I've attached the png file generated so you can see what I mean.
Which makes a nice bar chart with three groups with two bars each. I can label the groups (as I have done here), but I cannot label what each color means. I would like to have a legend on some side of the chart with each color in a box and a label next to it. This could be defined as:
legend = ['Grammar 1', 'Grammar 2']
where 'Grammar 1' (yellow) is the source for the 0.87, 0.83, and 0.70 in the data, and 'Grammar 2' (blue) is for the 0.82, 0.50, and 0.11.
Changed in cairoplot: | |
importance: | High → Medium |
Nice observation.
I don't know you've seen but the ScatterPlot, DotLinePlot and FunctionPlot classes already support that. Whenever a user passes data using dictionaries, the dictionaries keys are plotted on a little box on the upper corner.
For BarPlot charts it won't be possible to use dictionaries. I'll give it further studying though. If I don't find a way to maintain code compatibility, I believe I'll follow your advice and add a new parameter to the function. Something like group_legend or group_names.