[R] using postscript() for multiple individual files
William Dunlap
wdunlap at tibco.com
Sat Jul 19 19:17:48 CEST 2014
Wrap all your calls to plot() with print(). E.g., change
plot(s, type="vectors", idx=1:12, main="")
to
print(plot(s, type="vectors", idx=1:12, main="")
Some plot methods require their output to be printed to display, some
don't. Some help files for plot methods mention this requirement,
some don't.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sat, Jul 19, 2014 at 9:53 AM, Ingo Wardinski <ingo at gfz-potsdam.de> wrote:
> On 07/19/2014 01:25 PM, Duncan Murdoch wrote:
>>
>> On 19/07/2014, 5:41 AM, Ingo Wardinski wrote:
>>>
>>> Hello,
>>> I try to plot some results of an analysis to multiple individual
>>> postscript files, like:
>>> postscript("A1_zonflow.ps",onefile=F)
>>> plot(s, type = "vectors", idx = 1:12,main="")
>>> dev.off()
>>> #
>>> postscript("vectors_paired_zonflow.ps",onefile=F)
>>> plot(s, type = "paired", idx = 1:12,plot.contrib = FALSE,main="")
>>> dev.off()
>>> #
>>> postscript(file="wcor_zonflow.ps",onefile=F);
>>> plot(wcor(s,groups=1:50),scales=list(at=c(10,20,30,40,50)),main="")
>>>
>>> I expect to obtain three individual files, showing the actual graphics.
>>> The three files are generated, but the first two appear to be empty,
>>> only the third file shows the expected graphic.
>>> How can I create three individual (not-empty) postscript files?
>>> I run R version 3.1.1 (2014-07-10) -- "Sock it to Me" on linux
>>
>>
>> You don't give us a reproducible example. When I try something similar,
>> it works for me.
>>
>> My guess would be that the files were produced, but not in the directory
>> you expected.
>>
>> BTW, it doesn't make sense to use onefile=F when you are writing a
>> single page. However, I don't think this would stop it from working.
>>
>> Duncan Murdoch
>
>
> I attached a minimal example below. Note, my problem is not that the three
> individual files are not generated, my problems is that two of these files
> are empty. It seems that only the last plot command is done (I also changed
> the order of the plotting command (plot(vector), plot(vector-paired,
> plot(wcor); plot(wcor), plot(vector),.....)
>
> I run this rscript from a wraping shell-script.
> TIA
> ingo
>
> #!/usr/bin/Rscript
> #_______________________________________________________________________________
> {
> library(Rssa)
> {
> s <- ssa(co2,kind="1d-ssa");
> postscript("vectors.ps")
> plot(s, type = "vectors", idx = 1:12,main="")
> dev.off()
> #
> postscript("vectors_paired.ps")
> plot(s, type = "paired", idx = 1:12,plot.contrib = FALSE,main="")
> dev.off()
>
> postscript(file="wcor.ps");
> plot(wcor(s,groups=1:50),scales=list(at=c(10,20,30,40,50)),main="")
>
> }
> }
> #_______________________________________________________________________________
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list