r - ggplot2没有显示所有行
问题描述
我们正在研究一些 ggplot2 图表。每个图表包含多条线。但是,当我们的行数超过 3 行时,图表中只显示了 3 行,其余的行都没有了。奇怪的是,传说都在那里。
这是代码的快照:
tailStretchPlot[[i]] <- ggplot() +
geom_step(data=tmp, aes(x=SizeCumPercent-SizeCntPercent/2,
y=TailStretch, width=SizeCntPercent, colour=TransportType), size=4)
plotTitle <- paste(append(unlist(strsplit(plotTitle, split='')), '\n',
as.integer(nchar(plotTitle)/2)), sep='', collapse='')
xIntervals <- findInterval(c(0)+seq(2,102,10),
tmp[tmp$TransportType=='homa',]$SizeCumPercent)
tailStretchPlot[[i]] <- tailStretchPlot[[i]] +
theme(text = element_text(size=1.5*textSize),
axis.text = element_text(size=1.3*textSize),
axis.text.x = element_text(angle=75, vjust=0.5),
strip.text = element_text(size = textSize),
plot.title = element_text(size = 1.2*titleSize,
color='darkblue'), plot.margin=unit(c(2,2,2.5,2.2),"cm"),
legend.position = c(0.1, 0.85),
legend.text = element_text(size=1.5*textSize)) +
guides(colour = guide_legend(override.aes = list(size=textSize/4)))+
scale_x_continuous(limits = c(0,101),
breaks = tmp[xIntervals,]$SizeCumPercent,
labels=tmp[xIntervals,]$MsgSizeRange, expand = c(0, 0)) +
scale_y_log10(breaks=c(1,2,3,4,5,10,15)) +
coord_cartesian(ylim=c(1, yLimit)) +
labs(title = plotTitle, y = yLab, x = xLab)
GitHub 链接是完整的脚本和示例数据 txt 文件:
https://github.com/Stanley131/ggplot2_issue
提前致谢:)
解决方案
推荐阅读
- aws-lambda - 无服务器 nuxt 应用程序中的路由不起作用
- python - 将数据从 API 写入 CSV
- python-3.x - 如何更改python子列表中元素的大小写?
- python - RuntimeWarning:exp 中遇到溢出(记录到相对)
- java - 重复提醒通知Android(java)问题
- java - Groovy + Spock 测试“Validator”类型的 void 方法,在不满足条件时抛出错误
- java - arraylist 如何在子集算法中操作和重用
- vue.js - 状态在多个应用程序之间共享。- vuex 持久化状态
- python - 使用 hvplot 从 xarray 数据集中绘制两个数据变量
- android - 过滤器正在折叠列表视图