## Stacked and Grouped Bar Charts and Mosaic Plots in R |R Tutorial 2.6| MarinStatsLectures

Skip to content
## Stacked and Grouped Bar Charts and Mosaic Plots in R |R Tutorial 2.6| MarinStatsLectures

##
24 thoughts on “Stacked and Grouped Bar Charts and Mosaic Plots in R |R Tutorial 2.6| MarinStatsLectures”

### Leave a Reply

What about 100% stacked column charts? cheers

@MarinStatsLectures Hi Mike. Tranks for sharing your Videos that are very helpful. Here's one question: I formed a short table myself. At first R see gender as character; after using as.factor, R see it as factor. But when I wanna combine gender and smoke into one table, R warn me that all arguments should have the same length. I checked my table and am sure that they have the same length. So what do you think is the problem here? I'm so confused!!!

Hi,

How can I set different bin sizes in same mosaic plot? I have data ranging from 0 to 50000. Many entries are decimal values and very less entries are above 10000. For now I can loose the outlying data.

Please guide about this. Thanks in advance.

Is there a way to change the position of the legend box? I saw that it overlapped with your chart.

Thank you so much for all your videos . It was really useful especially a beginner like me. can you give me your mail id. or your website where i can communicate with you please.

Hi Marin. You work is very much appreciated, thank you.

I have created the object table1, but in my working environment i get something like:

" table1 | 'table' int [1:2, 1:2] 314 44 334 33" instead of "table[4]" as you did. Why is that? Thanks

Hi Marin. First of all, your videos are fantastic! I wanted to know if you have a video on how to make a barplot with two explanatory variables?

hi Marin, your videos are very helpful. I would like to know how to create a barplot showing the proportion of smokers/non-smoker by gender. The plot should show two groups of bars: (1) 1 group of 2 bars on the left corresponding

to the proportions for females, and (2) 1 group of 2 bars on the right

corresponding to the proportions for males. Could you help me, please?

hi Marin, can you please load any video for mongolite examples?

When I try to find the class in the LungCapData file, I'm get these error messages dont know why ..

> class(Gender)

Error: object 'Gender' not found

> class(Age)

Error: object 'Age' not found

…why is that so?

Thanks for the video! This made learning how to create bar charts really simple to understand.

Any reason to why the box surrounding the font within my legend doesn't fit properly? The box is too small for the font. Any quick fixes here?

Hi MarinCould you help me please? I'm new to R and struggling to find an answer using 'help' function.I am trying to produce a spine plot. Two of the variables in my excel data set are outcome of crime and district crime was committed in, with 100 row labels. I want a spineplot to display this, and have been told to use the below command.spineplot(crime,Outcome~District)However I get error message:Error in spineplot(crime,Outcome#District)dependant variable should be a factorIf you could help me out with what this means and how to overcome I would be very appreciative.

Hello Marin, I really appreciate your tutorials. In a word, you have made a great tutorials. I just finished your series 1 and half way to complete series 2. I wish to complete your all 53 videos. Do you have any plan to make a tutorial series on Time series using R( probably you may follow a text) or fiancial data analysis using R. Standard videos of these two topics on R are rare on youtube. Just a request to you. And great thanks for these videos.

Hello Marin, How can produce a stack barplot where on the x-axis we have two categorical variables and on the y-axis one variable (frequencies). Thanks

Hey Marin, fantastic Video it really helps me a lot! I have two questions:

1. Is possible to change my counts on the y-axis to percent?

2. My version of R Studio (latest), can't find the argument "col". Is this argument part of a package, I need to download first?

Thanks and have a blessed day! 🙂

THANK YOU SO MUCH! I have a presentation on RStudio due tomorrow and your information saved me! Bless you!!!

What if I wanted to dislocate the legend a little bit to the right, in order to see the bars clearer? Thanks!

Hi Mike! thanks for your instructional videos, the default legend of my plot is overlaping the figures, how can I move this legend towards the upper right portion of the graphic?

This is helpful, thanks Mike

In this R video tutorial we will learn how to produce and customize stacked bar charts, clustered bar charts, and mosaic plots for examining the relationship between two categorical variables in R. We will also learn to create contingency table as well as modifying the plots in R. Like to support us? You can Donate (https://bit.ly/2CWxnP2), Share our Videos, Leave us a Comment and Give us a Thumbs up! Either way We Thank You!

Nice video, though it will be easy to Google up on how to add stats like sd or se, but it would have been better if you would have covered it in this video. What's the use of bar plots otherwise?

i need to access excel and shows the clustred ans stacked bar graph displays in localhost or local ip …….based on this give any suggestion (take in this video table example)

This is excellent. Thank you! If you have the time, how would you add error bars? I've been searching online (using ggplot, ggpubr etc) and can't find an easy, simple way to do so. Thanks again!