I am exporting plots as png
files. I am exporting plots individually then using grid.arrange to export plots together. The grid.arrange
exports png
files just fine, however saving plots individually returns and empty image in the same folder. The image is actually the plot size but graph/titles are apparent. The code below shows how I am plotting.
########## Cy5 individual plots############
png(file='10pMcomp_plots/DNA01_Cy5_10pM.png',width=600,height=600,res=100)
AllCy5MeansDNA1bind10pMwithoutcontrols<-melt(AllCy5MeansDNA1bind10pMwithoutcontrols, id=c("Spot_Size","Molarity","Mean Fluorescence"))
DNA1Cy5_10pm<-ggplot(AllCy5MeansDNA1bind10pMwithoutcontrols, aes(x=as.factor(Molarity), y=AllCy5MeansDNA1bind10pMwithoutcontrols$Mean, fill=Spot_Size)) + geom_bar(stat = "identity", position = "dodge") + ylab("Mean Fluorescence") + ylim(0,650) +xlab("Molarity (uM)") + ggtitle("Trimmed Mean of Cy5 Fluorescence \n with DNA 01 probe.")+ theme(plot.title = element_text(size = 15))
dev.off()
png(file='10pMcomp_plots/DNA02_Cy5_10pM.png',width=600,height=600,res=100)
AllCy5MeansDNA2bind10pMwithoutcontrols<-melt(AllCy5MeansDNA2bind10pMwithoutcontrols, id=c("Spot_Size","Molarity","Mean Fluorescence"))
DNA2Cy5_10pm<-ggplot(AllCy5MeansDNA2bind10pMwithoutcontrols, aes(x=as.factor(Molarity), y=AllCy5MeansDNA2bind10pMwithoutcontrols$Mean, fill=Spot_Size)) + geom_bar(stat = "identity", position = "dodge") + ylab("Mean Fluorescence") + ylim(0,650) + xlab("Molarity (uM)") + ggtitle("Trimmed Mean of Cy5 Fluorescence \n with DNA 02 probe. ")+ theme(plot.title = element_text(size = 15))
dev.off()
png(file='10pMcomp_plots/DNA01_Cy5_10pM.png',width=600,height=600,res=100)
AllCy5MeansDNA19bind10pMwithoutcontrols<-melt(AllCy5MeansDNA19bind10pMwithoutcontrols, id=c("Spot_Size","Molarity","Mean Fluorescence"))
DNA19Cy5_10pm<-ggplot(AllCy5MeansDNA19bind10pMwithoutcontrols, aes(x=as.factor(Molarity), y=AllCy5MeansDNA19bind10pMwithoutcontrols$Mean, fill=Spot_Size)) + geom_bar(stat = "identity", position = "dodge") + ylab("Mean Fluorescence") + ylim(0,650) +xlab("Molarity (uM)") + ggtitle("Trimmed Mean of Cy5 Fluorescence \n with DNA 19 probe.")+ theme(plot.title = element_text(size = 15))
dev.off()
png(file='10pMcomp_plots/DNA02_Cy5_10pM.png',width=600,height=600,res=100)
AllCy5MeansDNA20bind10pMwithoutcontrols<-melt(AllCy5MeansDNA20bind10pMwithoutcontrols, id=c("Spot_Size","Molarity","Mean Fluorescence"))
DNA20Cy5_10pm<-ggplot(AllCy5MeansDNA20bind10pMwithoutcontrols, aes(x=as.factor(Molarity), y=AllCy5MeansDNA20bind10pMwithoutcontrols$Mean, fill=Spot_Size)) + geom_bar(stat = "identity", position = "dodge") + ylab("Mean Fluorescence") + ylim(0,650) + xlab("Molarity (uM)") + ggtitle("Trimmed Mean of Cy5 Fluorescence \n with DNA 20 probe.")+ theme(plot.title = element_text(size = 15))
dev.off()
#########ARRAY OF PLOTS#############
png(file='10pMcomp_plots/Cy5_10pM.png',width=800,height=800,res=100)
grid.arrange(DNA1Cy5_10pm, DNA2Cy5_10pm, DNA19Cy5_10pm, DNA20Cy5_10pm, ncol=2, main = "Cy5 Fluorescence with 10pM complement" )
dev.off()
Any help would be appreciated.