ANU BDSI
workshop Data Visualisation with R Part 1
Biological Data Science Institute
10th April 2024
ggplot2
ggplot2
ggplot2
ggplot2 R package (as part of his PhD project).plotnine) and Julia (e.g., Gadfly.jl, VegaLite.jl).ggplotdata.frameggplotgeom - the geometric object to use display the datastat - statistical transformation to use on the data datadata to be displayed in this layer (usually inherited)mapping - aesthetic mappings (usually inherited)position - position adjustmenty = stat(density) and y = ..density..
geom_bar()geom_col()geom_point()geom_tile()geom_density()geom_bar()stat = "count" is computing the frequencies for each category for you.stat_count() and change the geom.geom_col()stat = "count" to do the counting for you and use geom_col() instead.geom_bar(stat = "identity") where stat = "identity" means that you will take the value as supplied without any statistical transformation."stack""dodge""dodge" = position_dodge()"dodge2""dodge2" uses a different algorithm to recalculate the x-values with an option to add a padding between geometric objects"fill"x, then position = "fill" can be handy.coord_polar()coord_cartesian() for Cartesian coordinate systems (default)coord_flip() to flip the x and ycoord_fixed() to use a fixed aspect ratiocoord_equal() is essentially coord_fixed(ratio = 1)coord_trans() to transform the coordinate after the statistical transformationcoord_map() to use projection based on mapprojgeom - the geometric object to use display the datastat - statistical transformation to use on the data datadata to be displayed in this layer (usually inherited)mapping - aesthetic mappings (usually inherited)position - position adjustmentfill, stack, dodge, dodge2, and identity.30:00 anu-bdsi.github.io/workshop-data-vis-R1/