我们如何制作xkcd样式图? - How can we make xkcd style graphs?

问题:

Apparently, folk have figured out how to make xkcd style graphs in Mathematica and in LaTeX . 显然,民间已经想出了如何在MathematicaLaTeX中制作xkcd风格的图形。 Can we do it in R? 我们可以用R做吗? Ggplot2-ers? GGPLOT2-ERS? A geom_xkcd and/or theme_xkcd? 一个geom_xkcd和/或theme_xkcd?

I guess in base graphics, par(xkcd=TRUE)? 我想在基本图形中,par(xkcd = TRUE)? How do I do it? 我该怎么做?

xkcd#1064

As a first stab (and as much more elegantly shown below) in ggplot2, adding the jitter argument to a line makes for a great hand-drawn look. 作为ggplot2中的第一个刺(并且在下面更加优雅地显示),将jitter参数添加到一行可以获得很好的手绘外观。 So - 所以 -

ggplot(mapping=aes(x=seq(1,10,.1), y=seq(1,10,.1))) + 
  geom_line(position="jitter", color="red", size=2) + theme_bw()

It makes for a nice example - but the axes and fonts appear trickier. 这是一个很好的例子 - 但轴和字体显得比较棘手。 Fonts appear solved (below), though. 但是,字体显示已解决(下方)。 Is the only way to deal with axes to blank them out and draw them in by hand? 处理轴的唯一方法是将它们清空并用手绘制它们吗? Is there a more elegant solution? 有更优雅的解决方案吗? In particular, in ggplot2, can element_line in the new theme system be modified to take a jitter-like argument? 特别是在ggplot2中,是否可以修改新主题系统中的element_line以获取类似抖动的参数?


解决方案:

参考一: https://en.stackoom.com/question/rBNr
参考二: https://stackoom.com/question/rBNr
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章