= "cyan") plot(log10(weight) ~ log10(length), data=perch,xlim=c(1.4,2.5), pch=24, col="red", bg="black") Use the par() command Every plot thereafter will have these settings… old_par <- par() # Always put this at the start of your code, if you’re messing with base plots… par(old_par) #... So you can put this line after to reset them
ink ratio = Fill up the plot with meaningful ink – not decorative ink # of pieces of data -------------------------- Area of graphic Data density = Edward Tufte But… colours are not for decoration
and positive values Temperature (cold to hot) Opinion: Disagree – Agree - Value bound at zero Temperature (K) Size Qualitative - Categorical, unordered values Country Species
= green Quiz: * Is this sequential, diverging, or qualitative? * Have I used an appropriate scale here? b <- ggplot(pallid, aes(x = tl, y = sl)) + geom_point(aes(colour=w), size=4) + scale_colour_gradient(high="red", low="green") + theme_bw() + xlab("Total length (mm)") + ylab("Standard length (mm)") + theme(axis.text=element_text(size=12), axis.title = element_text(size=14) ) Normally I wouldn’t use diverging for this. I’m about to illustrate something…
geom_point(aes(colour=w), size=8) + scale_colour_gradient(high=dichromat("darkred", type = "tritan"), low=dichromat("green", type = "tritan")) + theme_bw() + xlab("Total length (mm)") + ylab("Standard length (mm)") + theme(axis.text=element_text(size=12), axis.title = element_text(size=14), title = element_text(size=16) ) + ggtitle("Tritan - blue appears green") dichromat("red", type = "tritan") "#F35B5B" Dichromat takes a colour you input, and outputs a hex code for the colour you would see if you had this form of colourblindness
of pieces of data -------------------------- Area of graphic As high as possible, without becoming confusing. How are we doing here? Recall data density:
- Manual label or shape - From data Sometimes you may want to add text to every label E.g. plot names of species on a scatterplot Let’s add the year to each dot in this plot
- Year of capture - Death status - Weight - Location captured Purpose: Demonstrate how to add each of these features. This plot is probably too confusing.
code that contains a series of instructions that you can call repeatedly throughout your script From: http://www.cookbook- r.com/Graphs/Multiple_graphs_on_one_page_(ggplot2)/ By running it at the top of the script, we can call it repeatedly throughout
data • This should be a two-variable (minimum) plot, made in either ggplot or base ❑ Select an appropriate type of plot for the data ❑Format the axes and any legends used with high-quality, descriptive labels ❑Modify at least one colour, or apply a colour gradient; and/or; ❑Use faceting or multipanel plotting ❑ have a reasonable data:ink ratio, and data density • All elements necessary for publication should be present (Panels should be counted off with A, B, C, etc)
300-600 dpi (i.e. make it suitable for publication in Plos One) Deliverables: - One PDF, outputted from the PACE system (https://pacev2.apexcovantage.com/), containing your plot - A .txt file with a figure caption enclosed
minimal graphical parameters? (Answer is yes, if PACE outputs a PDF) /4 – Did you include a figure caption /1? • Scientific basics: /5 • Appropriate choice of plot type? • Sensible variables on X and Y? • Graphical elements /5 • Informative axes? (Good titles, large font?) • Graphical elements worked to enhance, not just decorate the plot