Live data from Hacker News

Tufte in R

motioninsocial.com

1–10 of 18 posts

Re: Tufte in R

#3
I've done a lot of work writing how to make nice plots in R/ggplot2 (http://minimaxir.com/2015/02/ggplot-tutorial/), but I admit that a lot here is new to me.

As the Tufte code samples indicate, plotting using base R graphics can be headache inducing, though, which is why the inclusion of a ggplot2 implementation is helpful. The other themes included with ggthemes seem pretty interesting as well.

An important thing to note about plotting with R is that if you can, you should use R in OS X for antialiasing. It makes a very notable difference for high-res charts (see my post), and it's clear that there's a lot of pixelation around the text and lines in the OP. Here's the Tuft line ggplot2 plot rendered on my MacBook: http://i.imgur.com/DC6TgW9.png

Re: Tufte in R

#4
I've been using Tufte all day today. First to make an email template for my CV and then a theme for MOU so i can take some clean notes. Man, this is just so good, like really really good, I am almost embarassed by comparison. Super cool, great job.

Re: Tufte in R

#5

I've done a lot of work writing how to make nice plots in R/ggplot2 ( http://minimaxir.com/2015/02/ggplot-tutorial/ ), but I admit that a lot here is new to me. As the Tufte code samples indicate, plotting using base R graphics can be headache inducing, though, which is why the inclusion of a ggplot2 implementation is helpful. The other themes included with ggthemes seem pretty interesting as well. An important thing…

I thought Linux had antialiasing if you used cairo? Its tough to see the difference in the quality of your image versus the one in the article given the disparity in file size / resolution. Your image is 3000x1800 / 222 KB versus 720x432 32 KB in the linked article.

Re: Tufte in R

#6
post #4

I've been using Tufte all day today. First to make an email template for my CV and then a theme for MOU so i can take some clean notes. Man, this is just so good, like really really good, I am almost embarassed by comparison. Super cool, great job.

What do you mean by "an email template for my CV?"

Re: Tufte in R

#7
post #5

I've done a lot of work writing how to make nice plots in R/ggplot2 ( http://minimaxir.com/2015/02/ggplot-tutorial/ ), but I admit that a lot here is new to me. As the Tufte code samples indicate, plotting using base R graphics can be headache inducing, though, which is why the inclusion of a ggplot2 implementation is helpful. The other themes included with ggthemes seem pretty interesting as well. An important thing…

I thought Linux had antialiasing if you used cairo? Its tough to see the difference in the quality of your image versus the one in the article given the disparity in file size / resolution. Your image is 3000x1800 / 222 KB versus 720x432 32 KB in the linked article.

Due to the way the theme is configured, I had to set it to that resolution to get everything at the right ratio. Even if you manually resized it to 1/5th of the original size, the aliasing would still not be present.

I've tried using the Cairo package in R with ggplot2 before on Windows, atleast. It's better, but not perfect.

EDIT: I am wrong; see comment reply to other parent.

Re: Tufte in R

#8

I've done a lot of work writing how to make nice plots in R/ggplot2 ( http://minimaxir.com/2015/02/ggplot-tutorial/ ), but I admit that a lot here is new to me. As the Tufte code samples indicate, plotting using base R graphics can be headache inducing, though, which is why the inclusion of a ggplot2 implementation is helpful. The other themes included with ggthemes seem pretty interesting as well. An important thing…

Can’t you just export a vector file and then let whatever other renderer (e.g. a browser) handle the antialiasing?

Edit: I don’t think I understand your complaint. The graphics in the original article are antialiased. Are you just saying their antialiasing algorithm isn’t as good?

Here’s what your version (on the left) looks like when rescaled (using Preview on OS X to rescale) to about the same size as theirs; the two seem roughly comparable: http://i.imgur.com/LWCeAPj.png

(I think the reason for the difference in apparent line/font weight in my picture there is that Preview properly downscales in a linear (not gamma-encoded) color space, whereas most vector antialiasing/rasterizing algorithms, including both Quartz and Cairo AFAIK, work in a gamma-encoded space). If you had generated the image at the same original size, I suspect it would look extremely similar to the one in the blog post.

Re: Tufte in R

#9
post #6
post #4

I've been using Tufte all day today. First to make an email template for my CV and then a theme for MOU so i can take some clean notes. Man, this is just so good, like really really good, I am almost embarassed by comparison. Super cool, great job.

What do you mean by "an email template for my CV?"

Maybe a template for sending a CV through email?

Re: Tufte in R

#10

I've done a lot of work writing how to make nice plots in R/ggplot2 ( http://minimaxir.com/2015/02/ggplot-tutorial/ ), but I admit that a lot here is new to me. As the Tufte code samples indicate, plotting using base R graphics can be headache inducing, though, which is why the inclusion of a ggplot2 implementation is helpful. The other themes included with ggthemes seem pretty interesting as well. An important thing…

Can’t you just export a vector file and then let whatever other renderer (e.g. a browser) handle the antialiasing? Edit: I don’t think I understand your complaint. The graphics in the original article are antialiased. Are you just saying their antialiasing algorithm isn’t as good? Here’s what your version (on the left) looks like when rescaled (using Preview on OS X to rescale) to about the same size as theirs; the t…

Whoops, I figured out what the problem was. I rendered it the way the author did using png("test.png", width=720, height=432) instead of using ggsave(). The resulting image is close to what's in the article. I'll need to look into it more.

> Can’t you just export a vector file and then let whatever other renderer (e.g. a browser) handle the antialiasing?

You can export as .svg but it's not recommended since .svg support isn't great.

Post reply on HN