Skip to content

Commit

Permalink
Fixed issue with xaxis subgroup orientation and updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris committed Sep 27, 2018
1 parent 8980ab9 commit 5b390c1
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 66 deletions.
11 changes: 7 additions & 4 deletions chartify/_core/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,14 @@ def _convert_major_orientation_labels(orientation):
def _convert_subgroup_orientation_labels(self, orientation):
"""Map the user inputted orientation values to the values expected by
bokeh for group labels."""
horizontal_value = 'normal'
vertical_value = 'parallel'
# Flip the values if the chart is vertical.

if self._vertical:
horizontal_value, vertical_value = vertical_value, horizontal_value
horizontal_value = 'parallel'
vertical_value = pi / 180 * 90
else:
horizontal_value = 'normal'
vertical_value = 'parallel'

if orientation == 'horizontal':
orientation = horizontal_value
elif orientation == 'vertical':
Expand Down
124 changes: 62 additions & 62 deletions examples/Examples.ipynb

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ def test_xaxis_tick_orientation(self):
assert ch.figure.xaxis[0].subgroup_label_orientation == 'parallel'
assert ch.figure.xaxis[0].group_label_orientation == 'parallel'

ch.axes.set_xaxis_tick_orientation('vertical')
assert np.allclose(ch.figure.xaxis[0].major_label_orientation,
1.5707963267948966)
assert np.allclose(ch.figure.xaxis[0].subgroup_label_orientation,
1.5707963267948966)
assert np.allclose(ch.figure.xaxis[0].group_label_orientation,
1.5707963267948966)

ch = chartify.Chart(blank_labels=True,
y_axis_type='categorical')
ch.plot.bar(
Expand Down

0 comments on commit 5b390c1

Please sign in to comment.