我們如何製作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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章