Skip to content

Bar and interval charts not aligning correctly #114

Open

Description

@wtn20

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

type: bug

type: feature

What happened:
When plotting a bar and associated interval chart with three categorical levels, the intervals do not align correctly.

Screen Shot 2020-07-28 at 1 42 13 PM

What you expected to happen:
They should align

How to reproduce it (as minimally and precisely as possible):

import pandas as pd
import chartify

example_data = pd.DataFrame(
    list(zip(
        ['a', 'a', 'a', 'a', 'b', 'b', 'b', 'b'],
        ['A', 'A', 'B', 'B', 'A', 'A', 'B', 'B'],
        ['c', 'd', 'c', 'd', 'c', 'd', 'c', 'd'],
        [1, 2, 3, 4, 5, 6, 7, 8],
        [v + 0.1 for v in [1, 2, 3, 4, 5, 6, 7, 8]],
        [v - 0.1 for v in [1, 2, 3, 4, 5, 6, 7, 8]]
    )),
    columns=['cat_1', 'cat_2', 'cat_3', 'val', 'upper', 'lower']
)

ch = chartify.Chart(blank_labels=True, x_axis_type='categorical')
ch.plot.bar(
    data_frame=example_data,
    categorical_columns=['cat_1', 'cat_2', 'cat_3'],
    numeric_column='val'
)
ch.plot.interval(
    data_frame=example_data,
    categorical_columns=['cat_1', 'cat_2', 'cat_3'],
    lower_bound_column='lower',
    upper_bound_column='upper',
)
ch.show('png')

Anything else we need to know?:

Activity

  1. metehankutlu commented on Sep 1, 2020

    @metehankutlu

    Is there any way we can find the metrics (like space between bars, bar width etc.) of the bar chart? I found interval gets these values from style.py but couldn't find the metrics for bar chart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions