Producing heatmap using geom_raster() makes different results in PDF and display

后端 未结 1 1397
孤独总比滥情好
孤独总比滥情好 2021-01-03 16:50

I am trying to produce heatmap using geom_raster() of ggplot2. Here is the code:

foo <- matrix(1:999,ncol=3)
ggplot(melt(foo), aes(X2,X1, fill=value)) + g         


        
相关标签:
1条回答
  • 2021-01-03 17:39

    Some pdf viewers don't manage properly the output of grid.raster, even with interpolate=FALSE they insist on showing some spurious gradient. Your pdf most probably is good (as per the pdf format specifications), it's the pdf viewer that is deficient (overzealous to smooth).

    Try to see if you have some preferences in the viewer to turn off interpolation and/or a different pdf viewer, e.g. in Mac's Preview application, one can switch "smooth text and line art" off and see the expected output. There's a similar option in the cross-platform Adobe Reader.

    0 讨论(0)
提交回复
热议问题