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 characters
library(ggplot2) | |
library(grid) | |
p1 <- qplot(1,1000, colour="test", linetype="longer legend") + | |
ylab("double\nline") | |
p2 <- qplot(1:10,1:10, colour="test") + | |
ylab("y") + guides(color="none") | |
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 characters
library(grid) | |
rowMax.units <- function(u, nrow){ # rowMax with a fake matrix of units | |
matrix.indices <- matrix(seq_along(u), nrow=nrow) | |
do.call(unit.c, lapply(seq(1, nrow), function(ii) { | |
max(u[matrix.indices[ii, ]]) | |
})) | |
} | |
colMax.units <- function(u, ncol){ # colMax with a fake matrix of units |
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 characters
library(grid) | |
rowMax.units <- function(u, nrow){ # rowMax with a fake matrix of units | |
matrix.indices <- matrix(seq_along(u), nrow=nrow) | |
do.call(unit.c, lapply(seq(1, nrow), function(ii) { | |
max(u[matrix.indices[ii, ]]) | |
})) | |
} | |
colMax.units <- function(u, ncol){ # colMax with a fake matrix of units |
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 characters
library(gridExtra) | |
library(RColorBrewer) | |
pal1 <- 1:7 | |
pal2 <- brewer.pal(7, "Set1") | |
pal3 <- brewer.pal(7, "Pastel1") | |
pal4 <- brewer.pal(7, "PRGn") | |
colorstrip <- function(x){ |
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 characters
library(ggplot2) | |
library(grid) | |
fixed_width <- function(p, width = unit(3, "cm"), | |
draw = FALSE){ | |
gt <- ggplot_gtable(ggplot_build(p)) | |
panel_index <- gt$layout$r[gt$layout$name == "panel"] | |
gt$widths[[panel_index]] <- width |
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 characters
require(scales) | |
require(RColorBrewer) | |
require(grid) | |
##' greyscale palette function | |
##' | |
##' returns a palette function that maps values to grey | |
##' @title greyscale_palette | |
##' @export | |
##' @param d data giving the range of the palette |
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 characters
m = structure(list(theta = c(0, 0.602006688963212, 1.20401337792641, | |
1.80602006688964, 2.40802675585284, 3.01003344481606, 3.61204013377926, | |
4.21404682274247, 4.8160535117057, 5.4180602006689, 6.0200668896321, | |
6.62207357859532, 7.22408026755854, 7.82608695652174, 8.42809364548496, | |
9.03010033444817, 9.63210702341137, 10.2341137123746, 10.8361204013378, | |
11.438127090301, 12.0401337792642, 12.6421404682274, 13.2441471571906, | |
13.8461538461538, 14.448160535117, 15.0501672240803, 15.6521739130435, | |
16.2541806020067, 16.8561872909699, 17.4581939799331, 18.0602006688963, | |
18.6622073578595, 19.2642140468227, 19.866220735786, 20.4682274247492, | |
21.0702341137124, 21.6722408026756, 22.2742474916388, 22.876254180602, |
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 characters
split_dot <- function(x) | |
strsplit(x, "\\.")[[1]] | |
is_dot <- function(x) | |
length(split_dot(x)) == 2L | |
split_underscore <- function(x) | |
strsplit(x, "_")[[1]] | |
is_underscore <- function(x) |
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 characters
library(gtable) | |
library(plyr) | |
library(grid) | |
table_theme <- function(bg = c("grey95", "grey98"), | |
fg = c("black", "black"), | |
just=c("center","center"), | |
separator = list(h=FALSE, v=TRUE), box = FALSE, | |
core = list(bg=bg, fg=fg, separator=separator, box=box, just=just), |
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 characters
adda_spectrum = function(shape = "ellipsoid", | |
dimensions = c(1,1), | |
lambda = 0.5, | |
radius = 0.100, | |
m = 1.5 + 0.2i , | |
medium.index = 1.46, | |
dpl = ceiling(10 * abs(m)), | |
test = TRUE) { | |
command <-paste("echo ./adda -shape ", shape, dimensions[1], dimensions[2], |