We are working on some ggplot2 graphs. Each graph contains multiple lines. However, when our line number exceeds more than 3 lines, there are only 3 lines showing in the graph, and the rest lines are gone. The weird thing is that the legends are all there.
Here is the snapshot of the code:
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)
The GitHub link is the complete script and sample data txt file:
https://github.com/Stanley131/ggplot2_issue
Thanks in advance:)