问题描述
在高DPI 4K监视器上,似乎在Windows下RStudio绘图窗口使用像素加倍使绘图易读(我使用RStudio 0.99.483和R 3.2.2和Windows 8.1,但在Windows 10下使用相同的结果) 。这导致了真正模糊的文本&图形(加上与Cleartype不兼容,因为它在像素加倍后导致色彩边缘)。示例:
qplot(Sepal.Length,Petal.Length ,data = iris,color = Species,
size = Petal.Width,alpha = I(0.7))
将RStudio放大到200%会给我一个模糊的图像(带有色边),如
完全缩小后会给我一个清晰的图像,但文字太小,绘图符号&菜单项:
有人可能会推荐一个解决这个问题的方法吗?
RStudio在内部使用什么Web浏览器来显示绘图窗口?任何东西都可以固定在那个前面?这应该在什么水平上解决? RStudio或R本身(在 grDevices
或 grid
??)中。编辑:使用
<$ p <$ p
$ b
编辑:使用
$ p $ windows()
qplot(Sepal.Length,Petal.Length,data = iris,color = Species,
size = Petal.Width,alpha = I(0.7) )
给了我一个清晰的图像:
: - )
使用其他选项 xpinch $ c在窗口调用中$ c>和
ypinch
使我的窗口更大,例如:
windows(xpinch = 340,ypinch = 340)
qplot(Sepal.Length,Petal.Length,data = iris,color = Species,
size = Petal.Width,alpha = I(0.7))
但字体看起来并不像他们应该相对于其他字体和情节符号那样缩放稍大一些(剧情画布虽然好像缩放了,但不是线条宽度)。不知道问题出在哪里 - ggplot2
或 grid
输出是否应该更好地适应
和 windows()
设备的xpinch ypinch
设置,或者如果它更低水平。 x11()
似乎没有任何dpi设置,而 quartz()
does(argument dpi = ...
) - 虽然我无法测试后者,因为我没有Mac ...猜猜问题的一部分是,这些不同的设备似乎没有有一个一致的设置来指定的dpi,所以也许并不奇怪,他们被严重考虑到特定的软件包...不知道关于RStudio图形设备...
总之,使R图在不同的图形设备上以不同的dpi进行良好和可重复缩放看起来相当困难...除了导出为PDF并查看它们之外,还有什么想法?
据我所知,较高DPI屏幕在许多应用程序的显示缩放问题上存在问题。你有没有尝试禁用缩放?你可以这样做:
我希望这可以帮助您解决问题。道歉,如果我理解错误的问题,或者如果你已经尝试过这一点。
对不起,我只能发表一个答案,而不是评论。我还没有足够的声望
On high DPI 4K monitors it seems that under Windows the RStudio plot window uses pixel doubling to make the plot legible (I'm using RStudio 0.99.483 and R 3.2.2 and Windows 8.1, but same result under Windows 10). This results in really fuzzy text & graphics (plus doesn't play well with Cleartype, as it results in colour fringing after pixel doubling).
Example:
qplot(Sepal.Length, Petal.Length, data = iris, color = Species,
size = Petal.Width, alpha = I(0.7))
with zoom in RStudio set to 200% gives me a fuzzy image (with colour fringing) like
Zooming out completely in turn gives me a sharp image, but with far too small text, plot symbols & menu items:
Could anybody perhaps recommend a solution to this problem?What web browser does RStudio use internally to display the plot window? Can anything be fixed on that front? At what level should this be fixed? RStudio or R itself (in grDevices
or grid
??). Just not really sure at what level this could be patched... Any thoughts?
EDIT: using
windows()
qplot(Sepal.Length, Petal.Length, data = iris, color = Species,
size = Petal.Width, alpha = I(0.7))
gives me a sharp image :
but with the annoyance that the default window is then quite small (twice as small as on a normal monitor, 1/ 4 in terms of area), and that if I scale it, the size of the text will change relative to the rest (specifying width=XXX and height=XX has the same effect). So this comes back to the issue I always have with scaling R graphs. :-)
Using the additional options xpinch
and ypinch
in the windows call makes my window larger, e.g. :
windows(xpinch=340, ypinch=340)
qplot(Sepal.Length, Petal.Length, data = iris, color = Species,
size = Petal.Width, alpha = I(0.7))
but fonts don't seem to scale the way they should relative to the rest and plot symbols become slightly bigger (plot canvas though seems to have scaled OK, but not the line widths). Not sure where the problem is - whether the ggplot2
or grid
output should adapt better to the xpinch
and ypinch
settings of the windows()
device, or if it's something more low level. x11()
doesn't seem to have any dpi settings, whereas quartz()
does (argument dpi=...
) - though I can't test the latter as I don't have a Mac... Guess part of the problem is that these different devices don't seem to have a consistent setting to specify the dpi, so maybe no surprise they are badly taken into account by particular packages... Not sure about the RStudio graphics device...
In short it seems pretty hard to make R graphs with good and reproducible scaling on different graphics devices with different dpi... Any thoughts, aside from exporting to PDF and viewing that?
From what I know, higher DPI screens have problems with display scaling on many applications. Have you tried disabling the scaling? You can do it as follows:
- Right click on the application's icon (R and Rstudio) and select Properties
- Go to "Compatibility" tab and select the box that says "Disable display scaling on high DPI settings"
- Click Apply and OK
- Restart RStudio/R
I hope this can help your problem. Apologies if i understand the problem incorrectly or if you have tried this already.
P.s sorry I can only post an answer, not a comment. I dont have enough reputation yet
这篇关于R / RStudio:图表缩放问题&高dpi屏幕上的模糊性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!