我想知道如何配置Jupyter在R内核中绘制一个较小的数字。
我尝试过使用options(repr.plot.width = 1, repr.plot.height = 0.75, repr.plot.res = 300)
,但结果有点混乱。它正在改变产生的图R的大小。有没有什么办法可以在Jupyter中直接配置输出图形大小。
换句话说,如何将第一个数字中的大小更改为第二个数字中的大小,同时不会弄乱情节。
答案 0 :(得分:4)
您需要手动设置刻度尺寸,标记尺寸和文字大小。文本大小和标记大小可以通过theme()
函数设置,而标记大小可以通过geom_point()
函数设置。
df_1 = data.frame(x=c(5, 6, 7, 8, 9), y = c(200, 225, 250, 270, 310))
options(repr.plot.width = 1, repr.plot.height = 0.75)
ggplot(df_1, aes(x = x, y = y)) + geom_point(size = 0.3) +
theme(text = element_text(size = 3), element_line(size = 0.1))
答案 1 :(得分:2)
您只需要更改绘图的分辨率即可。例如,在以下位置尝试repr.plot.res = 100
:
options(repr.plot.width = 1, repr.plot.height = 0.75, repr.plot.res = 100)