This file contains hidden or 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(egg) | |
library(gridExtra) | |
library(grid) | |
justify <- function(x, hjust="center", vjust="center", draw=FALSE){ | |
w <- sum(x$widths) | |
h <- sum(x$heights) | |
xj <- switch(hjust, | |
center = 0.5, |
This file contains hidden or 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
#!/bin/bash | |
pbpaste | highlight -O rtf -S $1 -u UTF8 -k Source\ Sans\ Pro -K 32 -s github | pbcopy |
This file contains hidden or 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
delayedAssign('open', { | |
system('open .') | |
getwd() | |
}) |
This file contains hidden or 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
--- | |
title: Wizard • pointy-hatted • pipe smoker | |
author: gandalf the grey | |
alsoknown: Olórin, Gandalf | |
nationality: Maia, bearer of Narya | |
age: Born before Arda was created | |
date: third age | |
address: Valinor, Arda | |
mobile: "`flying moths`" | |
email: "`[email protected]`" |
This file contains hidden or 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
%%----------------------------------------------------------------------- | |
%% Make your own quadrille, graph, hex, etc paper! | |
%% Uses the pgf/TikZ package for LaTeX, which should be part of | |
%% any modern TeX installation. | |
%% Email: [email protected] | |
%% Twitter: @mcnees | |
%%----------------------------------------------------------------------- | |
\documentclass[11pt]{article} |
This file contains hidden or 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(gridExtra) | |
library(grid) | |
library(tikzDevice) | |
chem <- "\\setatomsep{1em}\\chemfig{*6(-=-=(-[:90]N-[:30](=[:90]O)-[:-30](=[:-90]O)-[:30]N-[:-30]-[:30]-[:-30]N-[:30](=[:90]O)-[:-30](=[:-90]O)-[:30]N-[:-30](-[:-90]-[:-30](-[:30])-[:-90])-[:30](=[:90]O)-[:-30]O-[:30])-*6(-(=O)-*6(-=-=-=)--(=O)-)=)}" | |
p <- ggplot() + xlab('some chemistry') + ylab("some value") + | |
theme(plot.background = element_rect(colour = 'black', fill=NA), |
This file contains hidden or 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(grid) | |
library(gtable) | |
d <- iris[1:2,1:3] | |
g <- tableGrob(d, rows=NULL) | |
grid.newpage() | |
grid.draw(g) |
This file contains hidden or 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(sf) | |
# sf::st_layers('zzz.gpx') | |
a <- sf::st_read('zzz.gpx', 'track_points') | |
cbind(sf::st_coordinates(a), a$ele) | |
st_bbox(a) | |
a %>% mapview:: mapview(a) |
This file contains hidden or 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(tikzDevice) | |
library(ggplot2) | |
options(tikzLatexPackages = | |
c(getOption('tikzLatexPackages'),"\\usepackage{graphics}\n")) | |
d = data.frame(x=1:10, y=1:10, f=factor(sample(letters[1:2], 10, repl=TRUE))) | |
p <- qplot(x,y,data=d) + theme_bw() + | |
theme(plot.margin = unit(c(1, 1, 5, 1), "lines"), | |
axis.text.x = element_text(size = 12 * |
This file contains hidden or 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
fun_labels <- function(x) sprintf("<b>%s</b>", x) | |
ggplot() + | |
scale_x(breaks = c('a','b','c')) + | |
theme(axis.label = element_sticker(grob = fancyGrob, dictionary = fun_labels)) | |
my_labels <- tibble(label = letters[1:3], grobs = I(lapply(1:3, fancyGrob))) |