As others have said, you pretty much need to do the plot 2 times, but
if it takes more that one command to create the plot you can use the
dev.copy function to copy what you have just plotted into another
graphics device rather than reissuing all the commands again.
On Sat, Mar 24, 2012 at 9:43 AM
On 24.03.2012 13:11, Igor Sosa Mayor wrote:
apart from the other answers, be aware that you have to 'print' the
graph with
pl<-plot(x)
print(pl)
Which is true for lattice function but not for a base graphics plot().
Uwe Ligges
in case you're using lattice or ggplot2 plots.
On Fri, Mar 2
apart from the other answers, be aware that you have to 'print' the
graph with
pl<-plot(x)
print(pl)
in case you're using lattice or ggplot2 plots.
On Fri, Mar 23, 2012 at 02:40:04PM -0700, casperyc wrote:
> Hi all,
>
> I know how to use pdf() and dev.off() to produce and save a graph.
>
> Ho
you could either define a plotting function which passes your arguments
to plot() two times, with different devices active.
this function plots the given arguments two times:
pl<- function(...){
X11() #or pdf()
plot(...)
# dev.off() if pdf() is used
X11()
1) thats not a function (i'm sure just a mistake)
2) Just add another plot line
myplot <- function(x){
plot(x)
pdf("xplot.pdf")
plot(x)
dev.off()
}
myplot(1:20)
casperyc wrote
>
> Hi all,
>
> I know how to use pdf() and dev.off() to produce and save a graph.
>
> However, wh
Hi all,
I know how to use pdf() and dev.off() to produce and save a graph.
However, when I put them in a function say
myplot(x=1:20){
pdf("xplot.pdf")
plot(x)
dev.off()
}
the function work. But is there a way show the graph in R as well as saving
it to the workspace?
Thanks.
casper
--
6 matches
Mail list logo