cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

R-Script Code, need Y-AXIS to show Count

Hi everyone - 

 

I've been playing around with this distribution curve and was hoping I might be able to adjust the y-axis to show count frequency. 

Is this possible? 

 

Take a look at the code below. 

And take a look at the visualization it's currently producing. 

 

Sample DataSet: 

Here's a sample dataset 

 

Code: 

 

 

library(ggplot2)
ggplot(data=dataset,aes(x=dataset$Performance)) +
    geom_histogram(aes(y=..density..),col="#ffffff",fill="#004253") +
    labs(title="Business Unit", x="Performance Ratings", y="Frequency") +
    geom_density(col=2) +
    stat_function(fun = dnorm, 
        args = list(mean = mean(dataset$Performance, na.rm = TRUE), 
                    sd = sd(dataset$Performance, na.rm = TRUE)), 
                    colour = 'blue') 

 

 

 

 

Visualization: 

Histogram.PNG

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: R-Script Code, need Y-AXIS to show Count

Hi @GradStudent2020 ,

 

I don't have access to your dataset.

To add y-axis labels, you could refer to this link ( the 4th graph 😞

https://stats.idre.ucla.edu/r/faq/how-can-i-add-features-or-dimensions-to-my-bar-plot/

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Highlighted

Re: R-Script Code, need Y-AXIS to show Count

Oops. . . . here's the link to the sample dataset. 

 

I'm looking to transform the y-axis from 0.0, 0.2, 0.4, 0.6 (density) - to show the count of data points that contributes to the histogram. I'll take a look at the resource you've shared. 

 

Thanks much for your help! 

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors