Skip to main content

Posts

Showing posts from March, 2021

Ggplot2 visualizations - examples - in the subject of Covid19 again!

 I have prepared example of two charts, Multiseries Line chart and Scatterplot to illustrate how ggplot2 is working.  Additionally I have put some formatting elements to show how we can improve looks of our charts. We need libraries below to create our graphs. Install them if you don't have it yet. library(readr) #data import tool, part of the Tidyverse. library(dplyr) #perfect package for data manipulation, queries and much more, part of the Tidyverse. library(ggplot2) #the subject of this post, package for data visualizations, part of the Tidyverse. library(RColorBrewer) #package which is helpful while we are choosing the colors. I downloaded data file "COVID_data_2021_01_19" from website: https://shiny.rstudio.com/gallery/covid19-tracker. Thanks to readr package I import dataset to R and transform it a bit. I used dplyr to pick some observations I wanted to visualized therefore I created "covid2" data.frame. covid<-COVID_data_2021_01_19 covid$country=as.fa...

Ggplot2 for data visualizations

 When I have started my adventure with R, immediately I've noticed that everybody was taking about ggplot2 and its importance.  Tap "ggplot2"  in google and check it by yourself.  You will see a lots of professional fancy graphs, articles, blogs and other great materials.  I was so impressed  that I was even trying to start my learning of R programming from ggplot2.  Soon I understood, that I needed some basics first and it is better to take time if you are starting from zero. Before jumping to the ggplot2 structure I will share with you some tips I find useful. First it is good to remember that there are some steps while you explore your data. Most of the time you have to collect data first,  do some pre-processing and exploration,  modelling & analysis and only after comes visualization. Of course in previous steps,  graphs also can be helpful to interpret the situation correctly however it is important that you have prepared, clea...