<style type="text/css"> .remark-slide-content { font-size: 17px; padding: 1em 2em 1em 4em; } </style> # Open RStudio 1. go to [www.github.com/collnell/GWU-visual](www.github.com/collnell/GWU-visual) to access workshop materials 1. download the `GWU_ggplot.R` script 1. open it in RStudio 1. make sure you have the `ggplot2` and `dplyr` packages installed ```r install.packages('ggplot2') install.packages('dplyr') library(ggplot2) library(dplyr) ``` <br><br><br><br><br><br> Intro guide to R: [www.rpubs.com/collnellphd/rbasics](www.rpubs.com/collnellphd/rbasics) ??? Does everybody have RStudio, ggplot2, and dplyr installed? Is everyone who wants to be getting emails about the workshops on the list? who has used ggplot2 before? --- name: data viz class: center, top # Data visualization with R <img src="images/fig_banner.png" width="700" /> .pull-left[ Wednesdays 1-3 pm, SEH room 1800 **Jan 30th: grammar of graphics in ggplot2** Feb 6th: Publication-ready figures Feb 13th: Complex visualizations Workshop materials: [www.github.com/collnell/GWU-visual](www.github.com/collnell/GWU-visual) ] .pull-right[####.center[Colleen Nell] email: collnell@gwu.edu website: [www.collnell.com](www.collnell.com) twitter: @collnell office: SEH 6880] ??? About me: UCI DSI, rstats contractor, USGS, WWF, CNPS expert in multivariate statistics, data wrangling, visualizations, rmarkdown, rshiny, mixed models, parameteric statistics I'll help you! Schedule - 3rd day is flexible, to your needs email with requests, figures liek to be able to recreate --- # Workshop materials Workshop materials: [www.github.com/collnell/GWU-visual](www.github.com/collnell/GWU-visual) 1. download the `GWU_ggplot.R` script 1. open in RStudio 1. modify arguments, adapt to data <br><br> Installing `ggplot2` and `dplyr` packages: ```r install.packages('ggplot2') install.packages('dplyr') library(ggplot2) library(dplyr) ``` ??? Follow along: gituhub will be updated each week - links to slides - Rscripts to follow with follow along in Rstudio - if you change nothing, should work - use to experiment with base code provided, learn functionality - adapt to your own datasets data - all data can be read directly from github - no need to download anything troubleshooting - 1st look at your neighbor - stuck put a stick note on your computer - faster, slower, repeat?? --- # Today's objectives 1. overview of ggplot2 capabilities 1. understand logic behind ggplot2 syntax 1. create common/useful figures types 1. customize plot appearance <br><br> <img src="images/hex-ggplot2.png" width="200" /> <br><br><br> Workshop materials: [www.github.com/collnell/GWU-visual](www.github.com/collnell/GWU-visual) --- # [Information is Beautiful](https://informationisbeautiful.net/visualizations/what-makes-a-good-data-visualization/)  ??? Data viz is not just about the data or statistics it is one of the mroe creative things we get to do as scientists and a truly good figure or data visualization not only shows the data, but also has an important function in telling the story of your science through a visual can really make or break any sort of manuscript or determine how many people read it 90% of info transmitted to brain is visual humans process images 60,000x faster than text --- # 10 rules for better figures modified from [Rougier, Droettbroom, & Bourne (2014)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003833) 1. Know your audience 1. Identify your message 1. Adapt to medium (publication, poster, presentation) 1. Label, annotate, describe 1. Do not trust defaults 1. Use color intentionally 1. Represent data accureately, do not mislead the reader 1. Avoid unnecessary elements, less is more 1. Message > Beauty 1. Use the right chart & tools [Top 10 worst scientific graphs](https://www.biostat.wisc.edu/~kbroman/topten_worstgraphs/) [R Graph Gallery](https://www.r-graph-gallery.com/) <br><br> Workshop materials: [www.github.com/collnell/GWU-visual](www.github.com/collnell/GWU-visual) ??? and that's why it's important we are intentional and thoughtful with how we design figures 1-3 - make it easier on the reader 4-6 - customize the appearance to enhance the interpretation 7-9 - don't get carried away, keep it clean 10- - use ggplot2 b/c it does all these things So moving forward, lets keep these things in the back of our minds --- # ggplot2 .pull-left[ <img src="images/hex-ggplot2.png" width="150" /> ].pull-right[ <br> [ggplot2 reference](https://ggplot2.tidyverse.org/reference/) [ggplot2 cheatsheet](https://www.rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf) `ggplot2` is part of the [tidyverse](https://www.tidyverse.org/packages/) ] ```r install.packages('ggplot2') library(ggplot2) install.packages('tidyverse') library(tidyverse) ``` ```r library(tidyverse) ``` <br><br> Workshop materials: [www.github.com/collnell/GWU-visual](www.github.com/collnell/GWU-visual) ??? created by Hadley Wickham, chief data scientist for R other plotting options in R - base graphics, lattice, factoextra ++ What are the fundamental components of a figure?? --- # ggplot2: [a layered grammar of graphics](https://www.tandfonline.com/doi/abs/10.1198/jcgs.2009.07098) <br> .center[ **PLOT = data + geometric objects + coordinate system** <br> <img src="images/ggplot_layers.png" width="500" /> ] ??? language to concisely describe the components of a graphic move beyond terms like scatterplot, think about underlying structure what are the essential components that you can build every graph from? at the core geometric objects, scales & coordinate systems, plot annotations emphasize certain terms because used throughout Aesthetics – axes, plot positions, encodings. E.g. how the appearance of the plot relates to the attributes of the data - Color, linetypes, shapes Geometries – What shapes are used to represent the data? Line, points, bar Facets-Subplots or dimensions of the data, sall ultiples Statistics - Summarization of the data, mean, confidence intervals -Outputs of statistical models Coordinates – How are the x and y axes shown? - Exponential? Log scale? Reverse? Theme - Type, gridlines, legends etc --- # data: tree diversity experiment From a [field experiment](https://royalsocietypublishing.org/doi/full/10.1098/rspb.2018.1842) at the [UADY forest diversity experiment in Mexico](http://www.treedivnet.ugent.be/ExpUADY.html). Compared forest plots with 1 or 4 tree species (monoculture or polyculture) to test for tree diversity effect on: - tree height - bird communities - abundance, functional diversity, cwm.inv - predation rates on clay caterpillars <img src="images/plots_aerial.png" width="400" /> <img src="images/plots_poly.png" width="400" /> --- # data: tree diversity experiment ```r # read in directly from github birds<-read.csv('https://raw.githubusercontent.com/collnell/GWU-visual/master/bird_pred.csv') ```
--- class: center # What kind of figure?  [source](https://verstaresearch.com/blog/how-to-select-the-type-of-chart-to-use/) ??? What type of data? How many variables? What are you trying to show? ### Data types in ecology & biology **quantitative/numeric** - continuous, discrete, counts, proportions **qualitative/categorical** - groups, binary, ordinal **multivariate**, 2+ variables - complex structure - multiple treatments, groups, species, sites - timeseries - dates, repeated measures - spatial - many observations, replicates, covariates, scales --- # data types **quantitative/numeric** - continuous, discrete, counts, proportions **qualitative/categorical** - groups, binary, ordinal **multivariate**, 2+ variables - complex structure - multiple treatments, groups, species, sites - timeseries - dates, repeated measures - spatial - many observations, replicates, covariates, scales ```r str(birds) ``` ``` ## 'data.frame': 34 obs. of 10 variables: ## $ diversity: Factor w/ 2 levels "M","P": 1 1 1 1 1 1 1 1 1 1 ... ## $ plot : int 3 9 12 13 17 20 21 23 30 35 ... ## $ predation: num 0.12 0.186 0.152 0.104 0.106 ... ## $ tree_sps : Factor w/ 19 levels "A","ABCD","ABCE",..: 17 1 18 17 19 1 10 1 17 19 ... ## $ abundance: int 2 11 4 7 11 5 21 8 3 9 ... ## $ FD : num 0.189 0.581 0.48 0.332 0.649 0.352 0.788 0.456 0.352 0.534 ... ## $ cwm.inv : num 30 45 56.7 33 56 ... ## $ height : num 7.65 8.07 6.11 7.23 9.45 7.88 7.23 7.22 7.78 7.3 ... ## $ height_sd: num 1.12 1.12 1.08 1.02 1.59 1.19 1.26 1.34 1.52 1.51 ... ## $ ceiba : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 2 1 1 1 ... ``` --- # know your data ```r plot(birds) ``` <!-- --> --- # ggplot() Figures are made by **layering** different **geoms** that are defined by their **aestetic** mappings ```r ggplot() ``` Every plot starts the same way: ```r ggplot(data=birds, aes()) ``` ??? go to console --- # aes() Aesthetic mappings = how data variables are tied to visual properties of `geoms` - assign coordinates `(x,y)` - color, fill, shape, size, alpha ++ - `aes()` maps data to the geom ```r # Assign 'predation' variable to the x-axis: ggplot(data=birds, aes(x=predation)) ``` <!-- --> --- # geoms [geometric objects](https://ggplot2.tidyverse.org/reference/) define what shapes are used to represent the data [ggplot2 cheatsheet](https://www.rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf) ```r # Assign 'predation' variable to the x-axis: ggplot(data=birds, aes(x=predation))+ geom_histogram() ``` ``` ## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. ``` <!-- --> --- # distributions **one variable - continuous** geom_histogram(), geom_density(), geom_freqpoly(), geom_area(), geom_dotplot() ```r ggplot(data=birds, aes(x=predation))+ geom_histogram() ``` ``` ## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. ``` <!-- --> --- # distributions: histogram arguments: `bins`, `binwidth`, and `breaks` ```r # bin = number of bins ggplot(data=birds, aes(x=predation))+ geom_histogram(bins = 15) ``` <!-- --> ```r # binwidth = size of bins (in units of variable) ggplot(data=birds, aes(x=predation))+ geom_histogram(binwidth = .05) ``` <!-- --> ```r # manually set bin breaks ggplot(data=birds, aes(x=predation))+ geom_histogram(breaks = c(0.1, 0.15, 0.2, 0.25, 0.3, 0.4)) ``` <!-- --> --- # distributions: density plot `bw` = smoothing bandwidth ```r ggplot(data=birds, aes(x=predation))+ geom_density() ``` <!-- --> --- # layering use `+` to add components to a plot ```r ggplot(data=birds, aes(x=predation))+ geom_histogram(bins=15)+ geom_density(bw = .02) ``` <!-- --> --- # frequency polygon & dotplot ```r ggplot(birds, aes(x=predation))+ geom_freqpoly(binwidth = .02) ggplot(birds, aes(x=predation))+ geom_dotplot(binwidth= .02, method='dotdensity')# method = 'histodot' or 'dotdensity' ``` <!-- --> --- # distributions: by categorical variable ```r ggplot(birds, aes(x=predation, group = diversity))+ geom_density(bw = .02) ``` <!-- --> ??? a. a few categorical variables - ‘diversity’, had either 1 (monoculture) or 4 (polyculture) tree species b. by adding a grouping to the aes() we can show the two levels of this factor on the same figure c. now you can see there are 2 density curves in the plot e. s map an aesthetic attribute to this variable, like color a. Instead of using group=diversity, use fill=diversity to change the color that fills in our density curve b. Now we can see which curve is monoculture which is polyculture c. And a legend appears to inform us which color is associated with each level of the variable d. However, because the distributions overlap – we can only see part of the monoculture values and total range --- # [aesthetics](https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-specs.html) arguments inside the `aes()` are assigned to a variable, outside `aes()` is fixed .pull-left[- position (x & y axes) - `color` (“outside” color) - `fill` (“inside” color) - `shape` (of points) ] .pull-right[- linetype - `size` (width in mm) - `alpha` (transparency; 0-1) - `stroke`] ``` ## Scale for 'y' is already present. Adding another scale for 'y', which ## will replace the existing scale. ``` <!-- --> ```r colors() ``` ??? stop and show what happens if it is outside aes vs in a. So here I s alist of the different kinds of aesthetics that we can use b. Options vary depending on nature of geom c. Control the appearance of the geom. d. We will get back to these more, but for now let’s use fill to designate the colors i. To see a list of all the named colors simply type colors() go to link to show options --- # aesthetics: fill vs. color `color` = 'outside' color `fill` = 'inside' color ```r ggplot(birds, aes(x=predation))+ geom_density(bw = .02, fill = 'blue', color='violet', size=2) ``` <!-- --> ??? demo in console - change line thickness to show different color also switch with mapped vs not --- # Challenge #### Using the birds dataset: 1. Make a density plot of predation by tree diversity, adjust binwidth (bw) as needed 2. Map fill & linetype to tree diversity 3. Adjust transparency (alpha) so overlapping area is visible 4. Increase line thickness to be able to distinguish linetypes <!-- --> ??? So that's basically it, data+aes mapping+geom could use a bit further refining, will get to that --- class: center # relationship: 2 numeric variables  --- # relationships: 2 numeric variables `geom_point()`, `geom_line()`, `geom_smooth()`, `geom_rug()` <!-- --> --- # relationships **Show the relationship between predation and another numeric variable** --- # relationships **Show the relationship between predation and another numeric variable** ```r g<-ggplot(birds, aes(x=FD, y=predation))+ geom_point(size=3) g ``` <!-- --> ??? Here assigning the plot to a letter g can use this as bse to build off of if don't want to change anything int hat layer --- # add trendline ```r g<-plot.fd<-ggplot(birds, aes(x=FD, y=predation))+ geom_point(size=2) g+geom_smooth(method='lm') g+geom_smooth(method='loess') # smoothed fit curve g+geom_smooth(method='lm', se=FALSE) # remove confidence around line g+geom_smooth(method='lm', se=FALSE)+geom_rug() ``` ??? show outcome of these all in console add some geom_rug on the sides --- # layering & aesthetics - arguments in `ggplot()` are applied to ALL layers - data and `aes()` can also be mapped to individual geoms `color` by diversity: ```r ggplot(birds, aes(x=FD, y=predation))+ geom_point(size=3, aes(color=diversity))+ geom_smooth(method = 'lm', se=FALSE) ``` <!-- --> ??? show using size, color, shape notice that legend appears when variables mapped with aes --- # how are they different? <br><br> <!-- --> ??? recreate in console --- # <br><br> <!-- --> --- # what's missing? .center[ <br> <img src="images/ggplot_layers.png" width="500" /> ] ??? control over scales labels theme facets --- # scales: controlling aesthetic mapping how a variable is mapped to an aesthetic (`color`, `size`, `shape` etc) `scale_[aesthetic]_[type]()` `scale_color_manual()`, `scale_fill_manual()`, `scale_shape_manual()`, `scale_linetype_manual()` `scale_color_manual()`, `scale_color_discrete()`, `scale_color_gradient()` ```r ggplot(birds, aes(x=FD, y=predation))+ geom_point(size=3, shape = 21, aes(fill=diversity))+ geom_smooth(method = 'lm', se=FALSE, color='black')+ scale_fill_manual(values=c('black', 'white')) ``` <!-- --> ```r # set shape scale ggplot(birds, aes(x=FD, y=predation))+ geom_point(size=3, aes(shape=diversity, color=diversity))+ geom_smooth(method = 'lm', se=FALSE, color='black')+ scale_color_manual(values=c('black', 'grey'))+ scale_shape_manual(values=c(21,22)) ``` <!-- --> ??? write scale_aes_type on board manual is most explicit, most control oer discrete categories spend --- # scales: gradients `scale_color_gradient()`- 2 color gradient `scale_color_gradientn()` - with n colors `scale_color_gray()` `scale_color_gradient2(low = , mid= , high = )` - diverging color gradient ```r g<-ggplot(birds, aes(x=abundance, y=predation))+ geom_point(size=3, shape = 21, aes(fill=predation))+ geom_smooth(method = 'lm', se=FALSE, color='black') g+scale_fill_gradient(low = 'red',high = 'yellow') ``` <!-- --> ```r g+scale_fill_gradientn(colors=rainbow(9)) ``` <!-- --> ```r g+scale_fill_gradient2(low = 'red', mid='yellow', high = 'pink', midpoint = 0.2) ``` <!-- --> --- # scales: axes scales are also used to set axis limits ```r g+xlim(0, NA) # ensure axis starts at 0 ``` <!-- --> ```r #g+xlim(0, NA)+ylim(0, NA) ``` --- # scales: position `scale_x_discrete()` `scale_x_continuous()` `scale_x_log10()` `scale_x_sqrt()` `scale_x_reverse()` --- # legends ```r g<-ggplot(birds, aes(x=FD, y=predation))+ geom_point(size=3, shape = 21, aes(fill=diversity))+ geom_smooth(method = 'lm', se=FALSE, color='black') g+scale_fill_manual(values=c('black', 'white'), name='Tree diversity', labels=c('Monoculture', 'Polyculture'))+ theme(legend.position = 'bottom') # top, bottom, left, right or none ``` <!-- --> --- # + labs() arguments: `x = `, `y = `, `title =` ```r gg<-g+scale_fill_manual(values=c('black', 'white'), name='Tree diversity', labels=c('Monoculture', 'Polyculture'))+ theme(legend.position = 'bottom')+ labs(x = 'Bird functional diversity', y='Caterpillar predation rate') gg ``` <!-- --> ??? 2 thigns are happening here move the location of the legend around but also renaming variables in the legend --- # themes themes set the appearance of non-data elements - plot background - gridlines - fonts - legend appearance ```r gg+theme(legend.position='top') ``` <!-- --> ??? ...more later --- # [built-in themes](https://ggplot2.tidyverse.org/reference/ggtheme.html) <!-- --> https://github.com/ricardo-bion/ggtech --- # Customizing themes The function `theme()` is used to control non-data parts of the graph including: **Line elements:** axis lines, minor and major grid lines, plot panel border, axis ticks background color, +++ `axis.line`, `axis.line.x`, `axis.line.y`, `plot.grid.major`, `panel.border` **Text elements:** plot title, axis titles, legend title and text, axis tick mark labels, +++ `axis.title`, `axis.title.x` **Rectangle elements:** plot background, panel background, legend background, ++ `panel.border` There is a specific function to modify each of these three elements: `element_line()` to modify the line elements of the theme `element_text()` to modify the text elements `element_rect()` to change the appearance of the rectangle elements `element_blank()` to remove theme element ??? diffficult, often easier to start with a base theme, and edit that --- # Customizing themes ```r gg+theme_classic(base_size = 18) gg+theme_classic(base_size = 18)+theme(panel.border = element_rect(fill=NA, size=2)) gg+theme_classic(base_size = 18)+theme(axis.line = element_blank()) ``` --- # Challenge #### Using any data: 1. Show the relationship between 2 continuous variables 1. Use aesthetics and scales to customize appearance 1. Adjust labels and theme --- class: center # comaprison: categorical & numeric  --- # comparisons `geom_boxplot()`, `geom_violin()`, `geom_bar()`, `geom_point()`, `geom_jitter()`, `geom_linerange()` ++ ```r ggplot(birds, aes(x = diversity, y = predation))+ geom_boxplot() ggplot(birds, aes(x = diversity, y = predation))+ geom_violin() ``` <!-- --> ??? with comparisons we often want to show the range of values, error, not just means --- # + geom_point() Use geom_point() to show raw data over boxplots include `position = position_jitter(.1)` to spread overlapping points ```r plot.box<-ggplot(birds, aes(y = predation, x = diversity, color = diversity))+ geom_boxplot() plot.box + geom_point() plot.box + geom_jitter(width=0.1) ``` <!-- --> ??? In a dataset with many valuables, maybe adjust alpha to see all --- # geom_bar() ```r g<-ggplot(birds, aes(x=plot, y=height))+ geom_bar(stat='identity') g ``` <!-- --> ??? use scale_x_discrete to reorder axes --- # lollipop chart <!-- --> ??? more modern barchart alternative how would you go about recreating this? --- # comparisons: means with error bars means: `geom_bar()`, `geom_point()` error: `geom_errorbar()`, `geom_linerange()`, `geom_pointrange()` *error bars require `ymin` and `ymax`* <!-- --> --- # summarizing data with dplyr se = standard error = standard deviation / sqrt of n ```r #install.packages('dplyr') library(dplyr) # summarize statistics for predation summary.df<-birds%>% group_by(diversity)%>% summarize(mean = mean(predation), n = length(predation), sd = sd(predation))%>% mutate(se = sd/sqrt(n)) ``` ```r summary.df ``` ``` ## # A tibble: 2 x 5 ## diversity mean n sd se ## <fct> <dbl> <int> <dbl> <dbl> ## 1 M 0.147 17 0.0525 0.0127 ## 2 P 0.239 17 0.0898 0.0218 ``` --- # plot mean and error Generate a plot showing mean values with some measure of error <!-- --> --- # layering & aesthetics <!-- --> --- # layering multiple dataframes Similarly, the dataframe can be assigned to specific geoms: ```r ggplot()+ geom_errorbar(data=summary.df, aes(x = diversity, ymin = mean-se, ymax=mean+se), width=.2)+ geom_point(data=summary.df, aes(x= diversity, y= mean, color=diversity)) ``` <!-- --> --- # tree-level data ```r trees<-read.csv('https://raw.githubusercontent.com/collnell/GWU-visual/master/tree_pred.csv') head(trees) ``` ``` ## diversity plot tree tree_n cater_n bird_bites predation ## 1 M 3 D 13 50 6 0.1200000 ## 2 M 9 A 12 43 8 0.1860465 ## 3 M 12 E 12 46 7 0.1521739 ## 4 M 13 D 12 48 5 0.1041667 ## 5 M 17 F 12 47 5 0.1063830 ## 6 M 20 A 12 45 7 0.1555556 ``` ??? biology normal to have nested designs, many groups, replicates etc representign sites, treatments --- # multiple grouping variables `diversity` & `tree` ```r ggplot(trees, aes(diversity, predation))+ geom_boxplot()+ geom_jitter(aes(shape=tree)) ``` <!-- --> ```r ggplot(trees, aes(tree, predation))+ geom_boxplot()+ geom_jitter(aes(color=diversity)) ``` <!-- --> ??? equivalent to sites, treatments --- # aggregate by plot ```r se<-function(x) sd(x, na.rm=TRUE)/sqrt(length(x)) plot.pred<-trees%>% group_by(diversity, tree)%>% summarize(mean=mean(predation), se=se(predation)) head(plot.pred) ``` ``` ## # A tibble: 6 x 4 ## # Groups: diversity [1] ## diversity tree mean se ## <fct> <fct> <dbl> <dbl> ## 1 M A 0.159 0.0145 ## 2 M B 0.212 0.0122 ## 3 M C 0.203 0.00561 ## 4 M D 0.110 0.00495 ## 5 M E 0.109 0.0332 ## 6 M F 0.111 0.0287 ``` --- # plot means by tree ```r # tree point ggplot(plot.pred, aes(tree, mean, color=diversity))+ geom_point()+ geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.1) ``` <!-- --> ```r # tree bar - position dodge ggplot(plot.pred, aes(tree, mean, color=diversity))+ geom_bar(stat='identity', position=position_dodge(1))+ geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.1, position=position_dodge(1)) ``` <!-- --> ```r # position=position_dodge(1)) ``` --- # plot means by diversity ```r # div point position dodge ggplot(plot.pred, aes(diversity, mean, color=tree))+ geom_point(position=position_dodge(1))+ geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.1, position=position_dodge(1)) # div bar - position dodge ggplot(plot.pred, aes(diversity, mean, fill=tree))+ geom_bar(stat='identity', position=position_dodge(1))+ geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.1, position=position_dodge(1)) ``` --- # facets facets create small multiples of your plot based upon a categorical variable: ```r # facet by diversity ggplot(plot.pred, aes(tree, mean, color=diversity))+ geom_point(position=position_dodge(1))+ geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.1, position=position_dodge(1))+ facet_wrap(~diversity) ``` <!-- --> ??? #facet tree comp ggplot(plot.pred, aes(diversity, mean))+ geom_point(stat='identity', position=position_dodge(1))+ geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.1, position=position_dodge(1))+ facet_wrap(~tree) --- # connect the dots ``` ## Warning: Ignoring unknown parameters: stoke ``` <!-- --> --- # +coord_flip() <!-- --> --- # questions?? --- # next week Send me any examples of what your are trying to plot, chart types, interests Publication ready figures - Tweaking theme to fit journal guidelines - Custom themes & color palettes - Saving – figure format, resolution - Multi-panel figs, faceting - Annotating plots – adding pvalues, rsquared, highlighting data - Working with scales – color scales - Ggpubr, cowplot, fortify, gganimate - Reordering axes