Generate all graphs

This commit is contained in:
Loïc Guégan 2024-07-02 14:39:26 +02:00
parent b11940fc56
commit ed4f922633
19 changed files with 62 additions and 44 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -51,6 +51,9 @@ g_legend <- function(a.gplot){
}
custom_theme=function(){theme_clean()+ theme(plot.background=element_blank())}
colorAlpha=0.6
pointSize=3
lineSize=1.2
data=data%>%dformat()
@ -69,55 +72,68 @@ statsReceiver=statsReceiver%>%group_by(wireless,wakeupfor,datasize,simkey)%>%sum
# Energy
sender60sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
sender180sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
# A scpecial one to highligh low energy values:
sender60sPlotEnergyForEandHE=ggplot(statsSender%>%filter(wakeupfor==60)%>%dsformat()%>%filter(simkey!="Extended",simkey!="Hints+Extended"),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
receiver60sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
receiver180sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
# A scpecial one to highligh low energy values:
sender180sPlotEnergyForEandHE=ggplot(statsSender%>%filter(wakeupfor==180)%>%dsformat()%>%filter(simkey!="Extended",simkey!="Hints+Extended"),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
# Success
sender60sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
sender180sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
receiver60sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
receiver180sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=colorAlpha)+
geom_point(size=pointSize)+geom_line(aes(linetype=simkey),linewidth=lineSize)+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",linetype="none",fill=guide_legend(title="Policy"))
@ -125,11 +141,13 @@ w1=10
h1=4
w2=15
h2=4
ggsave("figures/scalability_datasize_60s_sender_energy.pdf",plot=sender60sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_datasize_60s_receiver_energy.pdf",plot=receiver60sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_datasize_60s_sender_energy.pdf",plot=sender60sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_datasize_60s_receiver_energy.pdf",plot=receiver60sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_datasize_60s_success.pdf",plot=sender60sPlotSuccess,width=w2,height=h2)
ggsave("figures/scalability_datasize_180s_sender_energy.pdf",plot=sender180sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_datasize_180s_receiver_energy.pdf",plot=receiver180sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_datasize_180s_sender_energy.pdf",plot=sender180sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_datasize_180s_receiver_energy.pdf",plot=receiver180sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_datasize_180s_success.pdf",plot=sender180sPlotSuccess,width=w2,height=h2)
ggsave("figures/scalability_datasize_60s_sender_energy_onlyEandHE.pdf",plot=sender60sPlotEnergyForEandHE,width=w1,height=h1)
ggsave("figures/scalability_datasize_180s_sender_energy_onlyEandHE.pdf",plot=sender180sPlotEnergyForEandHE,width=w1,height=h1)

View file

@ -55,52 +55,52 @@ sender60sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==60),aes(n_nodes,energ
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",fill=guide_legend(title="Policy"))
sender180sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==180),aes(n_nodes,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",fill=guide_legend(title="Policy"))
receiver60sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==60),aes(n_nodes,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",fill=guide_legend(title="Policy"))
receiver180sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==180),aes(n_nodes,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
guides(colour="none",fill=guide_legend(title="Policy"))
# Success
sender60sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==60),aes(n_nodes,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",fill=guide_legend(title="Policy"))
sender180sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==180),aes(n_nodes,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",fill=guide_legend(title="Policy"))
receiver60sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==60),aes(n_nodes,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",fill=guide_legend(title="Policy"))
receiver180sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==180),aes(n_nodes,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Number of node")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour="none",fill=guide_legend(title="Policy"))
@ -108,11 +108,11 @@ w1=7
h1=4
w2=15
h2=4
ggsave("figures/scalability_nnodes_60s_sender_energy.pdf",plot=sender60sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_nnodes_60s_receiver_energy.pdf",plot=receiver60sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_nnodes_60s_sender_energy.pdf",plot=sender60sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_nnodes_60s_receiver_energy.pdf",plot=receiver60sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_nnodes_60s_success.pdf",plot=sender60sPlotSuccess,width=w2,height=h2)
ggsave("figures/scalability_nnodes_180s_sender_energy.pdf",plot=sender180sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_nnodes_180s_receiver_energy.pdf",plot=receiver180sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("figures/scalability_nnodes_180s_sender_energy.pdf",plot=sender180sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_nnodes_180s_receiver_energy.pdf",plot=receiver180sPlotEnergy+guides(fill = "none", color = "none"),width=w1,height=h1)
ggsave("figures/scalability_nnodes_180s_success.pdf",plot=sender180sPlotSuccess,width=w2,height=h2)

View file

@ -95,20 +95,20 @@ pareto = pareto %>% dformat()
##### Policies
ggplot(stats%>%dformat(),aes(energy,success,color=simkey,shape=simkey))+
geom_line(data=pareto,aes(energy,success),linetype="dashed", size=1,inherit.aes=FALSE)+
geom_line(data=pareto,aes(energy,success),linetype="dashed", linewidth=1,inherit.aes=FALSE)+
geom_point(size=4)+
geom_point(data=pareto,size=4)+scale_y_reverse()+
labs(color="Policies:",shape="Policies:")+scale_color_brewer(palette = "Set1")+theme_minimal()+theme(text=element_text(size=20), legend.position=c(.8,.75),legend.box.background = element_rect(color="black", size=1, fill="white"))+scale_shape_manual(values = c(17,18,20,3,4))+
labs(color="Policies:",shape="Policies:")+scale_color_brewer(palette = "Set1")+theme_minimal()+theme(text=element_text(size=20), legend.position="inside", legend.position.inside=c(.8,.75),legend.box.background = element_rect(color="black", linewidth=1, fill="white"))+scale_shape_manual(values = c(17,18,20,3,4))+
xlab("Sender energy consumption (J)")+ylab(TeX(r'(#Succ$_p$)'))
# +facet_wrap(~wakeupfor+wireless,scale="free")
ggsave("figures/pareto_policies.pdf",width=10,height=9)
##### Strategies
ggplot(stats%>%dformat(),aes(energy,success,color=strategy,shape=strategy))+
geom_line(data=pareto,aes(energy,success),linetype="dashed", size=1,inherit.aes=FALSE)+
geom_line(data=pareto,aes(energy,success),linetype="dashed", linewidth=1,inherit.aes=FALSE)+
geom_point(size=4)+
geom_point(data=pareto,size=4)+scale_y_reverse()+
labs(color="Strategies:",shape="Strategies:")+scale_color_brewer(palette = "Dark2")+theme_minimal()+theme(text=element_text(size=20), legend.position=c(.8,.75),legend.box.background = element_rect(color="black", size=1, fill="white"))+scale_shape_manual(values = c(17,18,20,3,4))+
labs(color="Strategies:",shape="Strategies:")+scale_color_brewer(palette = "Dark2")+theme_minimal()+theme(text=element_text(size=20), legend.position="inside",legend.position.inside=c(.8,.75),legend.box.background = element_rect(color="black", linewidth=1, fill="white"))+scale_shape_manual(values = c(17,18,20,3,4))+
xlab("Sender energy consumption (J)")+ylab(TeX(r'(#Succ$_p$)'))
# +facet_wrap(~wakeupfor+wireless,scale="free")
ggsave("figures/pareto_strategies.pdf",width=10,height=9)