Last active
November 23, 2017 14:31
-
-
Save valentinitnelav/3b2a572ab5576cad29a64ab5d929d415 to your computer and use it in GitHub Desktop.
Revisions
-
valentinitnelav revised this gist
Nov 23, 2017 . 1 changed file with 63 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,10 +15,71 @@ pdf(file = "test.pdf", par(mai = c(0.9/2.54, 1.4/2.54, 0.15/2.54, 2/2.54)) barplot(aggreg, beside = TRUE, ylim = c(0, 60), ylab = "Counts", legend.text = c("female", "male"), args.legend = list(x = 8, y = 50, text.font = 3, xpd = TRUE)) # legend("topright", inset = c(-0.2,0), legend = c("female", "male")) dev.off() aggreg2 <- table(my_data$MATCH, my_data$DOMINANT_SIDE) colnames(aggreg2) <- c("left-handed", "right-handed") rownames(aggreg2) <- c("stumbling left", "stumbling right") aggreg2 pdf(file = "test2.pdf", width = 9/2.54, height = 7/2.54, family="Times", pointsize = 8) # Adjust margins of plotting region (Bottom, Left, Top, Right) : X[cm]/2.54 = inch par(mai = c(0.9/2.54, 1.4/2.54, 0.15/2.54, 2.7/2.54)) barplot(aggreg2, beside = TRUE, ylim = c(0, 60), ylab = "Counts", legend.text = c("left-handed", "right-handed"), args.legend = list(x = 9, y = 50, text.font = 3, xpd = TRUE)) dev.off() ########## pdf(file = "test4.pdf", width = 15/2.54, height = 7/2.54, family="Times", pointsize = 8) # layout(matrix(1:2, ncol=2)) par(mai = c(0.9/2.54, 1.4/2.54, 2/2.54, .5/2.54), mfrow = c(1,2)) barplot(aggreg, beside = TRUE, ylim = c(0, 60), ylab = "Counts", legend.text = c("female", "male"), args.legend = list(x = 6, y = 70, text.font = 3, xpd = TRUE)) # par(mai = c(0.9/2.54, 1.4/2.54, 0.15/2.54, 2.5/2.54)) barplot(aggreg2, beside = TRUE, ylim = c(0, 60), # ylab = "Counts", legend.text = c("stumbling left", "stumbling right"), args.legend = list(x = 6, y = 70, text.font = 3, xpd = TRUE)) mtext("Karl Pearson's drunkard's walk", side = 3, line = 4, at = -0.5, font=2, cex=14/8) dev.off() ############# # ggplot(data = my_data, # aes(x = DOMINANT_SIDE)) + # geom_bar(stat="identity", # position=position_dodge()) -
valentinitnelav created this gist
Nov 23, 2017 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ setwd("share/") getwd() my_data <- read.table("data/drunkwalks_data.txt", header = TRUE) plot(my_data) aggreg <- table(my_data$SEX, my_data$DOMINANT_SIDE) rownames(aggreg) <- c("female", "male") colnames(aggreg) <- c("left-handed", "right-handed") pdf(file = "test.pdf", width = 9/2.54, height = 7/2.54, family="Times", pointsize = 8) # Adjust margins of plotting region (Bottom, Left, Top, Right) : X[cm]/2.54 = inch par(mai = c(0.9/2.54, 1.4/2.54, 0.15/2.54, 2/2.54)) barplot(aggreg, beside = TRUE, ylim = c(0, 55), ylab = "Counts", legend.text = c("female", "male"), args.legend = list(x = 8, y = 50, text.font = 3, xpd = TRUE))