Skip to content

Percentage of bin in bar chart #2479

Answered by jakevdp
LSchueler asked this question in Q&A
Discussion options

You must be logged in to vote

You can do this by roughly following the Percent of Total example, along with some pre-processing of your data in a calculate transform. For example:

import pandas as pd
import io
import altair as alt

data = """\
ind  value                                        bins
0    Negative                                    0 - 50
1    Negative                                    0 - 50
2    Negative                                    0 - 50
3    Negative                                    0 - 50
4    Negative                                    0 - 50
5    Negative                                    0 - 50
6    Positive                                  51 - 100
7    Positive                       …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@LSchueler
Comment options

Answer selected by LSchueler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants