VizWhiz 4: designing your plots

The final visualization step that we cover in the course is the layout. Titles, colors, axes, font, and gridline. R can make it very easy for you.

Assignment: graph layout

 

  • try out some of the themes on the last plot created, including classic and minimal

#try out some of the themes on the last plot created, including classic and minimal 

   data_combined %>% 
    na.omit() %>% 
    ggplot(aes(x= vasPijnGemiddeld_1, y = vasFunctie_1 color = geslacht)) +

    theme_classic()+
    geom_point() + 
    geom_smooth() 

 

data_combined %>% 
    na.omit() %>% 
    ggplot(aes(x= vasPijnGemiddeld_1, y = vasFunctie_1 color = geslacht)) +

    theme_minimal()+
    geom_point() + 
    geom_smooth() 

Answers

Now add titles and modify the names on the x-xis and y-axis

(We skip the second video of VizWhiz 4 from R Ladies)

Assignment: graph layout 2

 

  • Make a scatter plot again in which you can show to what extent VAS pain correlates with the VAS function

  • Use geom_point for this

  • Fit a line with geom_smooth and color the men and women.

  • Use theme_classic for the layout. Give the plot the title "relationship between pain and hand functon"

  • Assign the x-axis the title "VAS pain (0-10)" and the y-axis the title "VAS function (0-10)

#Create scatter plot for assignment: graph layout 2

     data_combined %>% 
    na.omit() %>% 
    ggplot(aes(x= vasPainGemiddeld_1, y = vasFunctie_1, color = geslacht)) +
    geom_point() + 
    geom_smooth() + 
    theme_classic() +
    labs(title =
"relationship between pain and hand functon"
             x =
"VAS pain (0-10)",
             y=
"VAS function (0-10)")

Answers

In conclusion

This concludes this part of the course. You should now have a basic understanding of how R is used and organized. Of course, like any language, further mastering R needs a lot of practice. 

We now suggest that you will start to work with GitHub. That is the next part of this course. The last part is then a set of examples and tutorials that you can play with to further master your R skills

R-course: RYouReady

Gemstracker and HandWristStudyGroup data

R-course: RYouReady

General introduction to R and GitHub

Applying R to HandWristStudyGroup data