Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stacked bar plot example, by using the correct starting_value #498

Merged
merged 2 commits into from
Jan 2, 2020

Conversation

midhun-pm
Copy link
Contributor

Fixes #444

@@ -47,7 +47,7 @@ def __init__(self, index, series_a, series_b, series_c, **kw):


index = numpy.array([1,2,3,4,5])
demo = PlotExample(index, index*10, index*5, index*2)
demo = PlotExample(index, index*10, index*15, index*17)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not possible to do this without changing the input data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring for starting_value says the following:

    #: The data source to use as "starting" values for bars (along value axis).
    #: For instance, if the values are [10, 20] and starting_value
    #: is [3, 7], BarPlot will plot two bars, one  between 3 and 10, and
    #: one between 7 and 20

I think BarPlot is designed not to change the value when stacking, so the user may have to do it explicitly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could reverse the input data instead. The original version of this relied on the rendering order (the tallest bar was drawn first, etc.).

Even better might be to sum the data as part of the process of creating the plots (ie. barplot 1 is from 0 to series_a, barplot 2 is from series_a to series_a + series_b, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, that's better, made the change.

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to have this merged as is; feel free to modify if desired.

@midhun-pm midhun-pm merged commit 2000cd7 into master Jan 2, 2020
@rahulporuri rahulporuri deleted the fix/bar_plot_stacked_example branch October 27, 2020 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bar_plot_stacked example unfinished?
3 participants