How do I save a plot created from hydroTSM::hydroplot?

51 Views Asked by At

I have the plot generated by the following code:

hydroTSM::hydroplot(as.zoo(series_xts[,i]),FUN=funcion,na.rm=TRUE,
    ptype="ts+boxplot+hist",pfreq=escalas,xlab='Tiempo',ylab=variable,
    var.unit=unidad,col=colores_pastel,main=names(series_xts[,i]))

How can I save it in my working directory as a png file? I understand that it is of class Histogram

1

There are 1 best solutions below

0
On

You can open a png file and print the graph in it before closing it:

png(file = 'plotgraph.png', res = 300)

hydroTSM::hydroplot(as.zoo(series_xts[,i]),FUN=funcion,na.rm=TRUE,ptype="ts+boxplot+hist",pfreq=escalas,xlab='Tiempo',ylab=variable,var.unit=unidad,col=colores_pastel,main=names(series_xts[,i]))

dev.off()

this will save a file with 300 dpi called "plotgraph.png" in your working directory