Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

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
v-eachen-msft
Community Support
Community Support

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.