我们如何制作 xkcd 风格的图表? [英] How can we make xkcd style graphs?

查看:28
本文介绍了我们如何制作 xkcd 风格的图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,人们已经想出了如何制作 :以 XKCD 风格绘制 ggplot2 图形.

库(xkcd)小插图(xkcd-介绍")

一些示例(散点图、条形图):

  • 散点图:

  • 条形图:

Apparently, folk have figured out how to make xkcd style graphs in Mathematica and in LaTeX. Can we do it in R? Ggplot2-ers? A geom_xkcd and/or theme_xkcd?

I guess in base graphics, par(xkcd=TRUE)? How do I do it?

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. 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?

解决方案

You might want to consider the following package:

Package xkcd: Plotting ggplot2 graphics in a XKCD style.

library(xkcd)
vignette("xkcd-intro")

Some examples (Scatterplots, Bar Charts):

  • Scatterplot:

  • Bar Chart:

这篇关于我们如何制作 xkcd 风格的图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆