Last active
April 3, 2024 20:49
-
-
Save xupefei/b045c20730da67c890724f9a0e8a5eb1 to your computer and use it in GitHub Desktop.
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(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