# convert to tidy table for z values calculated by HY and read from SK chart library(tidyr) library(ggplot2) # load both tables (matrices) load(file = "../data/z_hy.rda") z_sk_chart <- cbind(as.double(rownames(z_sk_chart)), z_sk_chart) # new column for Tpr rownames(z_sk_chart) <- NULL # reset row names colnames(z_sk_chart)[1] <- "Tpr" # add column name .z_chart <- as.data.frame(z_sk_chart) # dataframe z_hy_deriv <- cbind(as.double(rownames(z_hy_deriv)), z_hy_deriv) rownames(z_hy_deriv) <- NULL colnames(z_hy_deriv)[1] <- "Tpr" .z_calcs <- as.data.frame(z_hy_deriv) z_chart <- gather(.z_chart, "ppr", "z.chart", 2:8) z_calcs <- gather(.z_calcs, "ppr", "z.calcs", 2:8) zcombined <- cbind(z_chart, z.calc = z_calcs$z.calcs) zcombined$dif <- zcombined$z.chart - zcombined$z.calc
ggplot(zcombined, aes(x = ppr, y = z.chart, size = dif)) + geom_point(shape = 21) + facet_grid(. ~Tpr)
z_HY <- zcombined save(z_HY, file = "../data/z_HallYarborough.rda")
# in this case, th evariable name "ppr" has been changed to "Ppr" ggplot(hy_dif, aes(x = Ppr, y = z.chart, size = dif)) + geom_point(shape = 21) + facet_grid(. ~Tpr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.