10
Az R adatelemzési nyelv alapjai III. Egészségügyi informatika és biostatisztika Gézsi András [email protected]

Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András [email protected] . Graphics with ggplot2. Data visualization •Exploratory

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Az R adatelemzési nyelvalapjai III.

Egészségügyi informatika és biostatisztika

Gézsi Andrá[email protected]

Page 2: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Graphics with ggplot2

Page 3: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Data visualization

• Exploratory data visualizationExploring the data visually to find patterns among the data entities

• Explanatory data visualizationShowcasing the identified patterns using simple graphs

Page 4: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Why ggplot2?

• de facto standard visualization package

• designed for print-quality graphics in seconds

• consistent underlying grammar of graphics

• plot specification at a high level of abstraction

• very flexible

• theme system for polishing plot appearance

• mature and complete graphics system

• many users, active mailing list

Page 5: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Why ggplot2?

Page 6: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Grammar of graphics

• The basic idea: independently specify plot building blocks and combine them to create just about any kind of graphical display you want.

• Building blocks:• data• aesthetic mapping• geometric object (~ layers)• statistical transformations• scales• coordinate system• position adjustments• faceting• themes

Page 7: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Working with the grammar

• Three required components• Data – The raw material of the visualization.

• Aesthetics – The mappings of the data to thevisualization.

• Layers – How to render the data and aesthetics to thescreen. Typically „geom_” functions.

Page 8: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Data: Titanic

PassengerId Passenger ID

Survived Passenger Survival Indicator

Pclass Passenger Class

Name Name

Sex Sex

Age Age

SibSp Number of Siblings/Spouses Aboard

Parch Number of Parents/Children Aboard

Ticket Ticket Number

Fare Passenger Fare

Cabin Cabin

Embarked Port of Embarkation

Page 9: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Credits

• https://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html

• https://www.edureka.co/blog/ggplot2-tutorial/

• https://tutorials.datasciencedojo.com/introduction-to-data-visualization-with-r-and-ggplot2/

Page 10: Az R adatelemzési nyelv alapjai III. - mit.bme.hu fileEgészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu . Graphics with ggplot2. Data visualization •Exploratory

Further reading

• Hadley Wickhamggplot2: Elegant Graphics

for Data AnalysisSpringer 2016