【发布时间】:2017-04-13 15:23:16
【问题描述】:
我和How can I make my vertical labels fit within my plotting window? 的人有同样的问题,但在 Jupyter。当我在 Jupyter 中的 R 中制作条形图时,任何长的垂直 x 轴标签都会被切断。例如
animals = c("dog","cat","squirrel","dog","fox","dog","llama","cat","tyrannosaurus rex")
sorted <- sort(table(animals), decreasing=T)
barplot(sorted, las = 2)
使用链接问题的解决方案
animals = c("dog","cat","squirrel","dog","fox","dog","llama","cat","tyrannosaurus rex")
sorted <- sort(table(animals), decreasing=T)
par(mar = c(15,4,4,2) + 0.1)
barplot(sorted, las = 2)
适用于 Mac 的 R gui,但不适用于 Jupyter。
例如,我也尝试过使用 repr 及其选项
library(repr)
options(repr.plot.width=4, repr.plot.height=4)
虽然这可以缩小和拉伸情节,但底部仍然会被切断。
有什么想法吗?
【问题讨论】: