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
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors
Top Kudoed Authors