* You are viewing Posts Tagged ‘expression’

Adding p values and R squared values to a plot using expression()

I was fooling around with including a p-value and R2 value on a plot I was putting together, and found myself quickly descending into the world of R graphics esoterica. I wanted to be able to include the values on the fly using values extracted from a linear model summary object, and I wanted to use the proper italics and superscripts for the text. The desired output is shown below. What follows is how I finally generated the plot.

The goal, include the p-value and adjusted R-squared … Continue Reading

A simple ggplot2 scatterplot

Here’s a bit of code used to produce one of the figures in my recent paper dealing with modeling rocky intertidal snail body temperatures. This was my first foray into ggplot2, and it only involved a few hours of head-scratching. The plot is a comparison of 10 years of  daily maximum body temperatures of a modeled littorine snail sitting on a rock with its foot out on the rock or withdrawn into the shell. The original data are here: dailymax_runs139_169.

The code below will open the data file, create the ggplot2 figure, and save the output … Continue Reading