Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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: 

2 Replies