Skip to content

Instantly share code, notes, and snippets.

@xupefei
Last active April 3, 2024 20:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xupefei/b045c20730da67c890724f9a0e8a5eb1 to your computer and use it in GitHub Desktop.
Save xupefei/b045c20730da67c890724f9a0e8a5eb1 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(tikzDevice)
options(
tikzLatexPackages = c(
getOption('tikzLatexPackages'),
"\\usepackage{libertine}",
"\\usepackage{libertinust1math}",
"\\usepackage[T1]{fontenc}"
)
)
data = list("x" = as.factor(c(1, 2, 3, 4, 5, 6)), "y" = as.factor(c(1, 2, 3, 4, 5, 6)))
tikz(
file = "test.tex",
standAlone = T,
width = 6,
height = 3.7
)
plot1 = qplot(
x = data$x,
y = data$y,
colour = data$y,
shape = data$y,
xlab = "$x$",
ylab = "y"
) + scale_colour_Publication() + theme_Publication() + legend_title("") +
legend_pos("lt") + geom_point(size = 3)
print(plot1)
dev.off()
tools::texi2dvi('test.tex', pdf = T, clean = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment