Kozea / Kozea/pygal

Bar Chart: Adding labels push data to the left.

Open
#66 3 comments 0 reactions 0 assignees View on GitHub
Feature request (AKA Feel free to make a pull request)
Dominant language
Python
Stars
2.8k
Forks
419
PR merge metrics
No merged PRs in 30d

Description

Hi. When I plot a bar chart without applying object.x_labels, my bars plot across the screen and everything seems ok:

![screen shot 2013-09-26 at 12 55 03 pm](https://f.cloud.github.com/assets/5551345/1219653/d7daf4a6-26ce-11e3-9615-164ff2b9ded7.png)

When I try to plot with object.x_labels defined, however, the bars push to the left of the graph and the labels go across the bottom of the screen:

![screen shot 2013-09-26 at 12 57 36 pm](https://f.cloud.github.com/assets/5551345/1219659/fa7d1f8e-26ce-11e3-91a8-aa45fb8770e8.png)

This is the code I am using to create labels (histogram is my bar chart object):

histogram.x_labels = map(str,xaxislabels)
histogram.x_label_rotation=270

xaxislabels is a list that is equal in size to the number of bars I am plotting.

I have tried this using this as well:

histogram.xlabels = map(str,range(len(xaxislabels)))
histogram.x_label_rotation=270

Just for reference, I am using Google Chrome on Mac OSX 10.8.5 to view the SVG files. I will update this issue when I get a chance to view it with other browsers. Thanks.

Contributor guide

Open the contributing guide

Research direction

Reproduce the bar chart using histogram.x_labels, x_label_rotation=270, and labels matching the number of bars, then inspect the generated SVG in Chrome on macOS. Compare it with the chart without x_labels and verify that labels render along the bottom without shifting the bars to the left.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.