question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proportion (percentage) with geom_line and stat_bin ?

See original GitHub issue

I see that with geom_line and stat_bin, I can have the y-values either as count, ncount, etc:

p9.geom_line(data=pd_rasters, stat='bin', bins=200, na_rm=True,
                mapping=p9.aes(x='Slope', color='Algorithm', y='stat(count)'),
                position='position_identity',
                alpha=0.8, size=1)

Can I get this as a percentage of values (rows)? something like using y='stat(prop)' ?

I thought about a custom function as in #231 but I’m not sure how to get the total size of each group.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
CarlosGrohmanncommented, Nov 20, 2020

Ok, did it. Please check if I did it the right way. Thanks the oppportunity to contribute

0reactions
has2k1commented, Nov 20, 2020

When you ask if I want to do it, you mean a PR?

Yes

To what part of the code it should be added?

In the result_dataframe routine. Then add the book keeping info about it in stat_bin.py, just like the others count, ndensity, … .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I display percentage in geom_line in ggplot2?
I am trying to display percentages in ggplot2 using geom_line and geom_point. My code is: print(ggplot(data=dfComb, aes(x=hour_adj, ...
Read more >
Ex 08 Visualizing Distributions
Numerically the value can verified with the table of proportion of the states in the North Central region to be indeed round about...
Read more >
Statin-prescribing trends for primary and secondary ... - NCBI
Objective. To determine the proportion of patients receiving statins for primary or secondary prevention of cardiovascular disease (CVD), as well as to describe ......
Read more >
Proportion of Days Covered: Statins (PDC-STA) - Florida Blue
Star Measure: Medication Adherence Cholesterol (Statins) ... Note: The PDC is the percent of days in the measurement period covered by prescription claims....
Read more >
Statins: Types, Uses and Side Effects - Cleveland Clinic
Statins are prescription drugs that help many people decrease their cholesterol level, which cuts their risk of atherosclerosis, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found