[Rd] R postscript generation error (lines versus points) (PR#5285)
Paul Murrell
p.murrell at auckland.ac.nz
Mon Nov 24 21:17:09 MET 2003
Hi
Peter Dalgaard wrote:
> Stephen.Harker at spme.monash.edu.au writes:
>
>
>>Full_Name: Stephen Harker
>>Version: 1.80
>>OS: linux (Yellow Dog 3.0 on ppc)
>>Submission from: (NULL) (130.194.13.101)
>>
>>
>>In creating a postscript file from a set of data in which the points are
>>plotted
>>using `points()' and lines drawn using `lines()' I have found since
upgrading
>>from R version 1.4? to 1.8 that the two sets do not coinicide
completely. This
>>is best illustrated by a simple example given below. Here the X11()
output
>>appears correctly. However, the postscript output shows that the
lines and
>>points no
>>longer coincide on the right hand side, whereas the left hand side is
perfect.
>>Output to other devices such as pdf is perfect. Possibly this reflects a
>>different scaling being applied when points() or lines() are selected.
>>
>>One reason I found this is that I use a number of scripts in R to
plot and
>>multiplot data sets from x-ray and neutron powder diffraction
analysis (and
>>Rietveld fitting of this data in particularl). In these points() is
used to
>>plot the data and lines() to plot the refinement from the analysis.
After
>>upgrading I found these were
>>misaligned. The example was created to mimic the problem.
>>
>>%%% Example follows:
>>dtwoth <- seq(from=20,to=80,len=1024)
>>dcount <- rnorm(dtwoth) #
>>
>>postscript(file="R-test2.ps",horizontal=FALSE,
>> pointsize=18, onefile=FALSE,
>> family="Helvetica", paper="a4")
>>
>>plot(dtwoth,dcount,
>> xlim=c(min(dtwoth),max(dtwoth)),ylim=c(min(dcount),max(dcount)),
>> yaxt="n",xaxs="i",yaxs="i",xlab="2theta",ylab="counts",
>> type="n")
>>
>>lines(dtwoth,dcount)
>>points(dtwoth,dcount)
>
>
> [At the current rate, "1.80" would be about 36 years into the future.
> Latest version is 1.8.1.]
>
> I can't reproduce this with 1.8.0 on RedHat 8.0. Are you sure it isn't
> your Postscript viewer that is playing tricks on you??
I can't reproduce this either, but in trying your script I wonder if you
are not properly "finishing" the postscript plot by calling dev.off
before viewing. If I run your script, then view R-test2.ps without
quitting R, the last few points at the right end of the plot are missing
(because the postscript file is not yet complete). If I then quit R
(the postscript file is completed and closed), the postscript output
looks just like the X11 version.
Paul
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-devel
mailing list