I have the attached datasets and use this R code to plot the data:
plotData <- read.csv("plotdata.csv")
ix <- 1:nrow(plotData)
long <- melt(transform(plotData, id = ix), id = "id") # add id col; melt to long form
ggp2 <- ggplot(long, aes(id, value, fill = variable))+geom_bar(stat = "identity", position = "dodge")+
scale_x_continuous(breaks = ix) +
labs(y='Throughput (Mbps)',x='Nodes') +
scale_fill_discrete(name="Legend",
labels=c("Inside Firewall (Dest)",
"Inside Firewall (Source)",
"Outside Firewall (Dest)",
"Outside Firewall (Source)")) +
theme(legend.position="right") + # The position of the legend
theme(legend.title = element_text(colour="blue", size=14, face="bold")) + # Title appearance
theme(legend.text = element_text(colour="blue", size = 12, face = "bold")) # Label appearance
plot(ggp2)
The resulting plot is attached as well.
Now I need to add numbers from different datasets on top of each bar. For example:
- on top of "Inside Firewall (Dest)" should be the numbers from sampleNumIFdest.csv
- on top of "Inside Firewall (Source)" should be the numbers from sampleNumIFsource.csv
- on top of "Outside Firewall (Dest)" should be the numbers from sampleNumOFdest.csv
- on top of "Outside Firewall (Source)" should be the numbers from sampleNumOFsource.csv
I have tried to use geom_text()
but I do not know how to read the numbers from the different datasets. Please note, that the datasets have different number of rows (which causes additional problems for me). Any suggestion is highly appreciated.
Sorry, I had to zip all my files as I am not allowed to add more then 2 URLs in my post.