Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
335 views
in Technique[技术] by (71.8m points)

antialiasing - Anti-aliasing in R graphics under Windows (as per Mac)

is there a way to plot anti-aliased graphics from the Windows version of R? As you can see from the two versions below the Mac version of R prints graphics anti aliased.... Mac Version

....whereas while the Windows version anti-aliases text, it does not anti-alias the actual graphic, as can be seen from the riser points, and the grid: Windows Version

Here is the code by the way:

library(scatterplot3d) 
attach(mtcars) 
s3d <-scatterplot3d(wt,disp,mpg, pch=16, highlight.3d=TRUE,
  type="h", main="3D Scatterplot")
fit <- lm(mpg ~ wt+disp) 
s3d$plane3d(fit)

I need the highest quality possible, for web page publication. I am running Windows 7 and pulling data from RBloomberg, which only works under Windows.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is likely to depend on details of the rendering engine on each platform, which could be hard to modify. My suggestions (untested, for lack of time and access to Windows):

  • install the cairoDevice package and use Cairo_png(). According to the documentation:
 This functions the same as any other R graphics device. You may
 use the conventional plot commands and expect essentially the same
 output, except that everything is anti-aliased (similar to other
 vector-based devices like Quartz). Alpha-blending is supported, as
 is enhanced interactivity via ‘getGraphicsEvent’. The device
 should work the same across all supported platforms (Mac, Windows,
 and Linux).
  • Render the PNG at a much higher resolution (or output data from R as PDF) and use ImageMagick (convert) or some other tool to get the anti-aliased version you need.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...