library(ggplot2)
library(reshape2)
data <- data.frame(partition = c("1", "2", "3", "4","5"),
edge = c(2914.2025,4274.438333,7072.29,7984.68,10232.96333),
cloud = c(11445.02,10384.94,9165.71,7884.15,7113.79),
communication = c(803345.0248,805614.764,810357.3823,460484.3287,483277.6666))
data2 <- data.frame(partition = c("1", "2", "3", "4","5"),
output_data = c(199.1,199.1,199.1,99.5,99.5))
elections_long <- melt(data, id = "partition")
ggplot(elections_long, aes(x = partition, y = value)) +
geom_bar(stat="identity", aes(fill = variable)) +
geom_line(data=df2, aes(x=partition, y=value), colour="blue")
tidyr::pivot_longer(data, cols = -partition) %>%
ggplot() + aes(x = partition, y = value) +
geom_col(aes(fill = name)) +
geom_line(data=data2, aes(x=partition, y=output_data, group = 1), colour="blue")
I am plotting a stacked bar and line graph in one figure as shown here:
The value for the line graph is in MB while for the stack bar its in milliseconds. The line graph is in blue which is not being differentiated due to the scale of the values. Any help on this is highly appreciated. Thanks