影响pdf中颜色外观的alpha级别与R中png绘图的alpha级别
当我在影响pdf中颜色外观的alpha级别与R中png绘图的alpha级别,r,plot,colors,R,Plot,Colors,当我在rgb中指定alpha级别并将绘图另存为pdf(颜色透明度小于1)时,我试图找出为什么颜色会显得暗淡。保存为png时不会发生这种情况 考虑以下3个测试数据: # Figure 1 # pdf with alpha specified in rgb # blues are dull and muted relative to colors in plot window pdf('test1.pdf', height = 4, width = 4) plot(1,1, type = 'n')
rgb
中指定alpha
级别并将绘图另存为pdf
(颜色透明度小于1)时,我试图找出为什么颜色会显得暗淡。保存为png
时不会发生这种情况
考虑以下3个测试数据:
# Figure 1
# pdf with alpha specified in rgb
# blues are dull and muted relative to colors in plot window
pdf('test1.pdf', height = 4, width = 4)
plot(1,1, type = 'n')
rect(0, 0, 1, 2, col = rgb(red = 0, green = 0, blue = 1, alpha = 0.1))
abline(v = 1.3, col = 'blue', lwd = 5)
dev.off()
因此,在使用pdf
时,如何使用透明颜色,同时保持控制台/打印窗口中显示的常规颜色方案
编辑:我正在使用Windows7,刚刚意识到这在Windows8或10上似乎不是问题。不过,我确实在MacOS10.7.5(Lion)上复制了它。我也知道,我在2013年使用的任何版本的R都有这个问题,还有这个更新的版本
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reshape2_1.4.1 abind_1.4-5 CTSim_0.1.7
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 raster_2.5-8 magrittr_1.5 MASS_7.3-45 splines_3.3.1 fdrtool_1.2.15
[7] lattice_0.20-33 FNN_1.1 quadprog_1.5-5 subplex_1.1-6 stringr_1.0.0 plyr_1.8.4
[13] tools_3.3.1 xts_0.9-7 GUILDS_1.2.1 parallel_3.3.1 grid_3.3.1 gstat_1.1-3
[19] poilog_0.4 poweRlaw_0.60.3 intervals_0.15.1 numDeriv_2014.2-1 sads_0.3.1 bbmle_1.0.18
[25] VGAM_1.0-2 sp_1.2-3 stringi_1.1.1 pracma_1.9.3 stats4_3.3.1 spacetime_1.1-5
[31] zoo_1.7-13
无法在MacOS 10.11.6或Ubuntu 14.10上复制。您是否尝试过Cairo::CairoPDF()?通过您的编辑,问题似乎更可能出在您的PDF查看器上。尝试在Windows 7中编写一个文件,并在其他系统中打开它以查看。。。。或者,如果可能的话,在同一系统上尝试其他PDF查看器。是的,你们都是对的。在GIMP中打开文件时,颜色看起来很好。是时候放弃Adobe Acrobat Professional 8了!
# Figure 3
# pdf, alpha not specified in rgb
# colors are same as plot window
pdf('test3.pdf', height = 4, width = 4)
plot(1,1, type = 'n')
rect(0, 0, 1, 2, col = rgb(red = 0, green = 0, blue = 1))
abline(v = 1.3, col = 'blue', lwd = 5)
dev.off()
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reshape2_1.4.1 abind_1.4-5 CTSim_0.1.7
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 raster_2.5-8 magrittr_1.5 MASS_7.3-45 splines_3.3.1 fdrtool_1.2.15
[7] lattice_0.20-33 FNN_1.1 quadprog_1.5-5 subplex_1.1-6 stringr_1.0.0 plyr_1.8.4
[13] tools_3.3.1 xts_0.9-7 GUILDS_1.2.1 parallel_3.3.1 grid_3.3.1 gstat_1.1-3
[19] poilog_0.4 poweRlaw_0.60.3 intervals_0.15.1 numDeriv_2014.2-1 sads_0.3.1 bbmle_1.0.18
[25] VGAM_1.0-2 sp_1.2-3 stringi_1.1.1 pracma_1.9.3 stats4_3.3.1 spacetime_1.1-5
[31] zoo_1.7-13