Quantcast

R versions and PostScript files

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

R versions and PostScript files

pilchat
Dear R users,

I have a desktop computer and a laptop, both of them with Ubuntu Lucid. The
former has R2.10 installed from Ubuntu repositories (this is the most recent
version in the repositories), while the latter has R2.13 from the CRAN
repositories.

I noticed that postscript files generated with R2.10 are "better"  than
files generated with the latest release of R, in particular for plots with
colored areas, such as the output of image or persp. The thing is that my ps
viewer (e.g. gv or evince) is very slow in opening ps files from R2.13,
while it smoothly displays ps files from R2.10, regardless of
"encapsulation".

I think this is related to differences in the way the ps file is generated
by the two versions of R, but I don't know how to go deeper in the matter.

Is there anyone experiencing the same issue? Is there any solution?

Thank you in advance

Cheers

Gaetano

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

ted.harding-3
On 21-Jul-11 07:23:54, pilchat wrote:

> Dear R users,
>
> I have a desktop computer and a laptop, both of them with
> Ubuntu Lucid. The former has R2.10 installed from Ubuntu
> repositories (this is the most recent version in the
> repositories), while the latter has R2.13 from the CRAN
> repositories.
>
> I noticed that postscript files generated with R2.10 are
> "better"  than files generated with the latest release of R,
> in particular for plots with colored areas, such as the
> output of image or persp. The thing is that my ps viewer
> (e.g. gv or evince) is very slow in opening ps files from
> R2.13, while it smoothly displays ps files from R2.10,
> regardless of "encapsulation".
>
> I think this is related to differences in the way the ps
> file is generated by the two versions of R, but I don't
> know how to go deeper in the matter.
>
> Is there anyone experiencing the same issue? Is there any
> solution?
>
> Thank you in advance
>
> Cheers
> Gaetano

Hi Gaetano,
First, to be sure of the nature of the problem:
When you compare the speed of display of a graph generated
by R-2.10 with the speed of display of a graph generated
by R-2.13, are these two graphs created using identical
commands in each version of R? I.e. is it the case that
they should be identical graphs?

If not, then (depending on how you generated them) it might
be that a graph you have generated on R-2.10 consists of
"vector" graphics, while another, generated on R-2.13 consists
of bit-map graphics. Display of a PostScript file consisting
of bit-maps will always be slower that display of a "vector
graphics" file.

Have you tried copying the same PS file from your desktop
to your laptop, or vice versa, in order to compare the speed
of display of the same file on the two different machines?

If you wish, you can send me privately
a) A PS file generated on R-2.10 (desktop)
b) A PS file generated on R-2.13 (laptop) using identical
   commands (i.e. in principle the same)

where the two files exhibit the difference in display speed
which you describe. I will then attempt to diagnise the
problem (please also send the R commands used).

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 21-Jul-11                                       Time: 12:39:00
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

pilchat
Hi Ted,

the two ps files are generated using exactly the same script. For example:

--------------------------
setEPS()
postscript (file="volc.eps",width=5,height=4)
image(volcano)
dev.off()
--------------------------

With R2.10 I get a file with size 182K, while R2.13 gives a file of 186K. I
am sending you the two files privately.

I just want to remark that this is not a hardware issue: I found out the
origin of this problem when I updated the R release on my laptop from 2.10
to 2.13. Before updating, I had no issue.

Thanks

G

On Thu, Jul 21, 2011 at 1:39 PM, Ted Harding <[hidden email]>wrote:

> On 21-Jul-11 07:23:54, pilchat wrote:
> > Dear R users,
> >
> > I have a desktop computer and a laptop, both of them with
> > Ubuntu Lucid. The former has R2.10 installed from Ubuntu
> > repositories (this is the most recent version in the
> > repositories), while the latter has R2.13 from the CRAN
> > repositories.
> >
> > I noticed that postscript files generated with R2.10 are
> > "better"  than files generated with the latest release of R,
> > in particular for plots with colored areas, such as the
> > output of image or persp. The thing is that my ps viewer
> > (e.g. gv or evince) is very slow in opening ps files from
> > R2.13, while it smoothly displays ps files from R2.10,
> > regardless of "encapsulation".
> >
> > I think this is related to differences in the way the ps
> > file is generated by the two versions of R, but I don't
> > know how to go deeper in the matter.
> >
> > Is there anyone experiencing the same issue? Is there any
> > solution?
> >
> > Thank you in advance
> >
> > Cheers
> > Gaetano
>
> Hi Gaetano,
> First, to be sure of the nature of the problem:
> When you compare the speed of display of a graph generated
> by R-2.10 with the speed of display of a graph generated
> by R-2.13, are these two graphs created using identical
> commands in each version of R? I.e. is it the case that
> they should be identical graphs?
>
> If not, then (depending on how you generated them) it might
> be that a graph you have generated on R-2.10 consists of
> "vector" graphics, while another, generated on R-2.13 consists
> of bit-map graphics. Display of a PostScript file consisting
> of bit-maps will always be slower that display of a "vector
> graphics" file.
>
> Have you tried copying the same PS file from your desktop
> to your laptop, or vice versa, in order to compare the speed
> of display of the same file on the two different machines?
>
> If you wish, you can send me privately
> a) A PS file generated on R-2.10 (desktop)
> b) A PS file generated on R-2.13 (laptop) using identical
>   commands (i.e. in principle the same)
>
> where the two files exhibit the difference in display speed
> which you describe. I will then attempt to diagnise the
> problem (please also send the R commands used).
>
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 21-Jul-11                                       Time: 12:39:00
> ------------------------------ XFMail ------------------------------
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Duncan Murdoch-2
In reply to this post by pilchat
On 11-07-21 3:23 AM, pilchat wrote:

> Dear R users,
>
> I have a desktop computer and a laptop, both of them with Ubuntu Lucid. The
> former has R2.10 installed from Ubuntu repositories (this is the most recent
> version in the repositories), while the latter has R2.13 from the CRAN
> repositories.
>
> I noticed that postscript files generated with R2.10 are "better"  than
> files generated with the latest release of R, in particular for plots with
> colored areas, such as the output of image or persp. The thing is that my ps
> viewer (e.g. gv or evince) is very slow in opening ps files from R2.13,
> while it smoothly displays ps files from R2.10, regardless of
> "encapsulation".
>
> I think this is related to differences in the way the ps file is generated
> by the two versions of R, but I don't know how to go deeper in the matter.

Postscript files are mostly text, so you can compare the two files and
see what the differences are.  The NEWS file shows a number of changes
since 2.10.0, but I can't see any that would cause problems for viewers.

Duncan Murdoch

>
> Is there anyone experiencing the same issue? Is there any solution?
>
> Thank you in advance
>
> Cheers
>
> Gaetano
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

ted.harding-3
On 21-Jul-11 13:24:32, Duncan Murdoch wrote:

> On 11-07-21 3:23 AM, pilchat wrote:
>> Dear R users,
>>
>> I have a desktop computer and a laptop, both of them
>> with Ubuntu Lucid. The former has R2.10 installed from
>> Ubuntu repositories (this is the most recent version
>> in the repositories), while the latter has R2.13 from
>> the CRAN repositories.
>>
>> I noticed that postscript files generated with R2.10
>> are "better" than files generated with the latest release
>> of R, in particular for plots with colored areas, such
>> as the output of image or persp. The thing is that my ps
>> viewer (e.g. gv or evince) is very slow in opening ps
>> files from R2.13, while it smoothly displays ps files
>> from R2.10, regardless of "encapsulation".
>>
>> I think this is related to differences in the way the
>> ps file is generated by the two versions of R, but I
>> don't know how to go deeper in the matter.
>
> Postscript files are mostly text, so you can compare the
> two files and > see what the differences are. The NEWS
> file shows a number of changes since 2.10.0, but I can't
> see any that would cause problems for viewers.
>
> Duncan Murdoch
>
>> Is there anyone experiencing the same issue? Is there
>> any solution?
>>
>> Thank you in advance
>>
>> Cheers
>> Gaetano

Gaetano has now sent me two files, generated (as he posted
just now on R-help) by the same commands:

  setEPS()
  postscript (file="volc.eps",width=5,height=4)
  image(volcano)
  dev.off()

on his two machines:

volc2.10.eps generated using R-2.10 on his desktop
  (the EPS file with fast rendering)

volc2.13.eps generated using R-2.13 on his laptop
  (the EPS file with slow rendering)

I have viewed both files on the same machine, and the
result indeed is that while volc2.10.eps renders very
quickly, volc2.13.eps does render very slowly (painting
in by vertical strips which move jerkily from left
to right). I estimate that 'gv volc2.10.eps' does the
rendering in less than 1 second, while 'gv volc2.13.eps'
takes about 18 seconds.

Comparing the two files, I think I have found the reason.

A 'diff' on the two files shows a basic difference in
definitions of a function used in the plotting:

[A] In file volc2.10.eps (the fast one):

  /rgb { setrgbcolor } def

[B] In file volc2.13.eps (the slow one):

  /srgb { [ /CIEBasedABC
            << /DecodeLMN
                 [ { dup 0.03928 le
                          {12.92321 div}
                          {0.055 add 1.055 div 2.4 exp }
                       ifelse
                   } bind dup dup
                 ]
               /MatrixLMN [0.412457 0.212673 0.019334
                           0.357576 0.715152 0.119192
                           0.180437 0.072175 0.950301]
               /WhitePoint [0.9505 1.0 1.0890]
             >>
           ] setcolorspace } def
  /setrgb { srgb setcolor } def


Then [A] volc2.10.eps (the fast one) uses commands like:

  /bg { 1 0 0 rgb } def

while [B] volc2.13.eps (the slow one) uses commands like:

  /bg { 1 0 0 setrgb } def

in each case for exactly the same purpose. Thus [B] the
slow one uses repeatedly (1157 times) a function setrgb
which has much higher overheads (see definition above)
than the function rgb used (1156 times) by [A] the fast one.

So the difference in performance is *definitely* down to
a specific difference in how R-2.13 implements 'postscript()'
compared with R-2.10.

Hoping this is useful!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 21-Jul-11                                       Time: 16:26:33
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Peter Dalgaard-2
This is due to the introduction of sRGB. Since this actually does something (Google for sRGB and you will be approximately as wise as me...), I don't think it is likely to be taken out. You can, however, always edit .ps.prolog. (I would expect that the line

/setrgb { setrgbcolor } def

instead of what is already there would reinstate the old behavior, but no guarantees.
)


On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:

> On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>> On 11-07-21 3:23 AM, pilchat wrote:
>>> Dear R users,
>>>
>>> I have a desktop computer and a laptop, both of them
>>> with Ubuntu Lucid. The former has R2.10 installed from
>>> Ubuntu repositories (this is the most recent version
>>> in the repositories), while the latter has R2.13 from
>>> the CRAN repositories.
>>>
>>> I noticed that postscript files generated with R2.10
>>> are "better" than files generated with the latest release
>>> of R, in particular for plots with colored areas, such
>>> as the output of image or persp. The thing is that my ps
>>> viewer (e.g. gv or evince) is very slow in opening ps
>>> files from R2.13, while it smoothly displays ps files
>>> from R2.10, regardless of "encapsulation".
>>>
>>> I think this is related to differences in the way the
>>> ps file is generated by the two versions of R, but I
>>> don't know how to go deeper in the matter.
>>
>> Postscript files are mostly text, so you can compare the
>> two files and > see what the differences are. The NEWS
>> file shows a number of changes since 2.10.0, but I can't
>> see any that would cause problems for viewers.
>>
>> Duncan Murdoch
>>
>>> Is there anyone experiencing the same issue? Is there
>>> any solution?
>>>
>>> Thank you in advance
>>>
>>> Cheers
>>> Gaetano
>
> Gaetano has now sent me two files, generated (as he posted
> just now on R-help) by the same commands:
>
>  setEPS()
>  postscript (file="volc.eps",width=5,height=4)
>  image(volcano)
>  dev.off()
>
> on his two machines:
>
> volc2.10.eps generated using R-2.10 on his desktop
>  (the EPS file with fast rendering)
>
> volc2.13.eps generated using R-2.13 on his laptop
>  (the EPS file with slow rendering)
>
> I have viewed both files on the same machine, and the
> result indeed is that while volc2.10.eps renders very
> quickly, volc2.13.eps does render very slowly (painting
> in by vertical strips which move jerkily from left
> to right). I estimate that 'gv volc2.10.eps' does the
> rendering in less than 1 second, while 'gv volc2.13.eps'
> takes about 18 seconds.
>
> Comparing the two files, I think I have found the reason.
>
> A 'diff' on the two files shows a basic difference in
> definitions of a function used in the plotting:
>
> [A] In file volc2.10.eps (the fast one):
>
>  /rgb { setrgbcolor } def
>
> [B] In file volc2.13.eps (the slow one):
>
>  /srgb { [ /CIEBasedABC
>            << /DecodeLMN
>                 [ { dup 0.03928 le
>                          {12.92321 div}
>                          {0.055 add 1.055 div 2.4 exp }
>                       ifelse
>                   } bind dup dup
>                 ]
>               /MatrixLMN [0.412457 0.212673 0.019334
>                           0.357576 0.715152 0.119192
>                           0.180437 0.072175 0.950301]
>               /WhitePoint [0.9505 1.0 1.0890]
>>>
>           ] setcolorspace } def
>  /setrgb { srgb setcolor } def
>
>
> Then [A] volc2.10.eps (the fast one) uses commands like:
>
>  /bg { 1 0 0 rgb } def
>
> while [B] volc2.13.eps (the slow one) uses commands like:
>
>  /bg { 1 0 0 setrgb } def
>
> in each case for exactly the same purpose. Thus [B] the
> slow one uses repeatedly (1157 times) a function setrgb
> which has much higher overheads (see definition above)
> than the function rgb used (1156 times) by [A] the fast one.
>
> So the difference in performance is *definitely* down to
> a specific difference in how R-2.13 implements 'postscript()'
> compared with R-2.10.
>
> Hoping this is useful!
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 21-Jul-11                                       Time: 16:26:33
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> [hidden email] 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.

--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

ted.harding-3
Yes, Peter, your suggestion does the trick (at any rate with
Gaetano's files).

I edited his volc2.13.eps (the slow one) as follows (the original
commented out with "%%##") making just the following change:

%%## /setrgb { srgb setcolor } def
/setrgb { setrgbcolor } def
%%## End of editing

(at line 53 of the prologue). The result is a file that produces
exactly the same picture as the other (fast) one, and renders
(to within my perceptual resolution) in exactly the same time,
i.e. just under one second (as opposed to about 18 before).

Thanks, Peter!
Ted.

On 21-Jul-11 18:59:58, peter dalgaard wrote:

> This is due to the introduction of sRGB. Since this actually does
> something (Google for sRGB and you will be approximately as wise as
> me...), I don't think it is likely to be taken out. You can, however,
> always edit .ps.prolog. (I would expect that the line
>
> /setrgb { setrgbcolor } def
>
> instead of what is already there would reinstate the old behavior, but
> no guarantees.
> )
>
>
> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>
>> On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>> Dear R users,
>>>>
>>>> I have a desktop computer and a laptop, both of them
>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>> Ubuntu repositories (this is the most recent version
>>>> in the repositories), while the latter has R2.13 from
>>>> the CRAN repositories.
>>>>
>>>> I noticed that postscript files generated with R2.10
>>>> are "better" than files generated with the latest release
>>>> of R, in particular for plots with colored areas, such
>>>> as the output of image or persp. The thing is that my ps
>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>> files from R2.13, while it smoothly displays ps files
>>>> from R2.10, regardless of "encapsulation".
>>>>
>>>> I think this is related to differences in the way the
>>>> ps file is generated by the two versions of R, but I
>>>> don't know how to go deeper in the matter.
>>>
>>> Postscript files are mostly text, so you can compare the
>>> two files and > see what the differences are. The NEWS
>>> file shows a number of changes since 2.10.0, but I can't
>>> see any that would cause problems for viewers.
>>>
>>> Duncan Murdoch
>>>
>>>> Is there anyone experiencing the same issue? Is there
>>>> any solution?
>>>>
>>>> Thank you in advance
>>>>
>>>> Cheers
>>>> Gaetano
>>
>> Gaetano has now sent me two files, generated (as he posted
>> just now on R-help) by the same commands:
>>
>>  setEPS()
>>  postscript (file="volc.eps",width=5,height=4)
>>  image(volcano)
>>  dev.off()
>>
>> on his two machines:
>>
>> volc2.10.eps generated using R-2.10 on his desktop
>>  (the EPS file with fast rendering)
>>
>> volc2.13.eps generated using R-2.13 on his laptop
>>  (the EPS file with slow rendering)
>>
>> I have viewed both files on the same machine, and the
>> result indeed is that while volc2.10.eps renders very
>> quickly, volc2.13.eps does render very slowly (painting
>> in by vertical strips which move jerkily from left
>> to right). I estimate that 'gv volc2.10.eps' does the
>> rendering in less than 1 second, while 'gv volc2.13.eps'
>> takes about 18 seconds.
>>
>> Comparing the two files, I think I have found the reason.
>>
>> A 'diff' on the two files shows a basic difference in
>> definitions of a function used in the plotting:
>>
>> [A] In file volc2.10.eps (the fast one):
>>
>>  /rgb { setrgbcolor } def
>>
>> [B] In file volc2.13.eps (the slow one):
>>
>>  /srgb { [ /CIEBasedABC
>>            << /DecodeLMN
>>                 [ { dup 0.03928 le
>>                          {12.92321 div}
>>                          {0.055 add 1.055 div 2.4 exp }
>>                       ifelse
>>                   } bind dup dup
>>                 ]
>>               /MatrixLMN [0.412457 0.212673 0.019334
>>                           0.357576 0.715152 0.119192
>>                           0.180437 0.072175 0.950301]
>>               /WhitePoint [0.9505 1.0 1.0890]
>>>>
>>           ] setcolorspace } def
>>  /setrgb { srgb setcolor } def
>>
>>
>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>
>>  /bg { 1 0 0 rgb } def
>>
>> while [B] volc2.13.eps (the slow one) uses commands like:
>>
>>  /bg { 1 0 0 setrgb } def
>>
>> in each case for exactly the same purpose. Thus [B] the
>> slow one uses repeatedly (1157 times) a function setrgb
>> which has much higher overheads (see definition above)
>> than the function rgb used (1156 times) by [A] the fast one.
>>
>> So the difference in performance is *definitely* down to
>> a specific difference in how R-2.13 implements 'postscript()'
>> compared with R-2.10.
>>
>> Hoping this is useful!
>> Ted.
>>
>> --------------------------------------------------------------------
>> E-Mail: (Ted Harding) <[hidden email]>
>> Fax-to-email: +44 (0)870 094 0861
>> Date: 21-Jul-11                                       Time: 16:26:33
>> ------------------------------ XFMail ------------------------------
>>
>> ______________________________________________
>> [hidden email] 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.
>
> --
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: [hidden email]  Priv: [hidden email]
>

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 21-Jul-11                                       Time: 21:13:21
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

pilchat
thank you guys for your reply.

i was sure that it was related to changes in the generation of ps
files with the latest R release.

now the question is: how can i restore the old behavior in R2.13?

thanks

gaetano

On 7/21/11, Ted Harding <[hidden email]> wrote:

> Yes, Peter, your suggestion does the trick (at any rate with
> Gaetano's files).
>
> I edited his volc2.13.eps (the slow one) as follows (the original
> commented out with "%%##") making just the following change:
>
> %%## /setrgb { srgb setcolor } def
> /setrgb { setrgbcolor } def
> %%## End of editing
>
> (at line 53 of the prologue). The result is a file that produces
> exactly the same picture as the other (fast) one, and renders
> (to within my perceptual resolution) in exactly the same time,
> i.e. just under one second (as opposed to about 18 before).
>
> Thanks, Peter!
> Ted.
>
> On 21-Jul-11 18:59:58, peter dalgaard wrote:
>> This is due to the introduction of sRGB. Since this actually does
>> something (Google for sRGB and you will be approximately as wise as
>> me...), I don't think it is likely to be taken out. You can, however,
>> always edit .ps.prolog. (I would expect that the line
>>
>> /setrgb { setrgbcolor } def
>>
>> instead of what is already there would reinstate the old behavior, but
>> no guarantees.
>> )
>>
>>
>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>>
>>> On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>>> Dear R users,
>>>>>
>>>>> I have a desktop computer and a laptop, both of them
>>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>>> Ubuntu repositories (this is the most recent version
>>>>> in the repositories), while the latter has R2.13 from
>>>>> the CRAN repositories.
>>>>>
>>>>> I noticed that postscript files generated with R2.10
>>>>> are "better" than files generated with the latest release
>>>>> of R, in particular for plots with colored areas, such
>>>>> as the output of image or persp. The thing is that my ps
>>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>>> files from R2.13, while it smoothly displays ps files
>>>>> from R2.10, regardless of "encapsulation".
>>>>>
>>>>> I think this is related to differences in the way the
>>>>> ps file is generated by the two versions of R, but I
>>>>> don't know how to go deeper in the matter.
>>>>
>>>> Postscript files are mostly text, so you can compare the
>>>> two files and > see what the differences are. The NEWS
>>>> file shows a number of changes since 2.10.0, but I can't
>>>> see any that would cause problems for viewers.
>>>>
>>>> Duncan Murdoch
>>>>
>>>>> Is there anyone experiencing the same issue? Is there
>>>>> any solution?
>>>>>
>>>>> Thank you in advance
>>>>>
>>>>> Cheers
>>>>> Gaetano
>>>
>>> Gaetano has now sent me two files, generated (as he posted
>>> just now on R-help) by the same commands:
>>>
>>>  setEPS()
>>>  postscript (file="volc.eps",width=5,height=4)
>>>  image(volcano)
>>>  dev.off()
>>>
>>> on his two machines:
>>>
>>> volc2.10.eps generated using R-2.10 on his desktop
>>>  (the EPS file with fast rendering)
>>>
>>> volc2.13.eps generated using R-2.13 on his laptop
>>>  (the EPS file with slow rendering)
>>>
>>> I have viewed both files on the same machine, and the
>>> result indeed is that while volc2.10.eps renders very
>>> quickly, volc2.13.eps does render very slowly (painting
>>> in by vertical strips which move jerkily from left
>>> to right). I estimate that 'gv volc2.10.eps' does the
>>> rendering in less than 1 second, while 'gv volc2.13.eps'
>>> takes about 18 seconds.
>>>
>>> Comparing the two files, I think I have found the reason.
>>>
>>> A 'diff' on the two files shows a basic difference in
>>> definitions of a function used in the plotting:
>>>
>>> [A] In file volc2.10.eps (the fast one):
>>>
>>>  /rgb { setrgbcolor } def
>>>
>>> [B] In file volc2.13.eps (the slow one):
>>>
>>>  /srgb { [ /CIEBasedABC
>>>            << /DecodeLMN
>>>                 [ { dup 0.03928 le
>>>                          {12.92321 div}
>>>                          {0.055 add 1.055 div 2.4 exp }
>>>                       ifelse
>>>                   } bind dup dup
>>>                 ]
>>>               /MatrixLMN [0.412457 0.212673 0.019334
>>>                           0.357576 0.715152 0.119192
>>>                           0.180437 0.072175 0.950301]
>>>               /WhitePoint [0.9505 1.0 1.0890]
>>>>>
>>>           ] setcolorspace } def
>>>  /setrgb { srgb setcolor } def
>>>
>>>
>>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>>
>>>  /bg { 1 0 0 rgb } def
>>>
>>> while [B] volc2.13.eps (the slow one) uses commands like:
>>>
>>>  /bg { 1 0 0 setrgb } def
>>>
>>> in each case for exactly the same purpose. Thus [B] the
>>> slow one uses repeatedly (1157 times) a function setrgb
>>> which has much higher overheads (see definition above)
>>> than the function rgb used (1156 times) by [A] the fast one.
>>>
>>> So the difference in performance is *definitely* down to
>>> a specific difference in how R-2.13 implements 'postscript()'
>>> compared with R-2.10.
>>>
>>> Hoping this is useful!
>>> Ted.
>>>
>>> --------------------------------------------------------------------
>>> E-Mail: (Ted Harding) <[hidden email]>
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 21-Jul-11                                       Time: 16:26:33
>>> ------------------------------ XFMail ------------------------------
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>
>> --
>> Peter Dalgaard
>> Center for Statistics, Copenhagen Business School
>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Email: [hidden email]  Priv: [hidden email]
>>
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 21-Jul-11                                       Time: 21:13:21
> ------------------------------ XFMail ------------------------------
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Duncan Murdoch-2
On 11-07-21 5:17 PM, pilchat wrote:
> thank you guys for your reply.
>
> i was sure that it was related to changes in the generation of ps
> files with the latest R release.
>
> now the question is: how can i restore the old behavior in R2.13?

Peter told you.

Duncan Murdoch

>
> thanks
>
> gaetano
>
> On 7/21/11, Ted Harding<[hidden email]>  wrote:
>> Yes, Peter, your suggestion does the trick (at any rate with
>> Gaetano's files).
>>
>> I edited his volc2.13.eps (the slow one) as follows (the original
>> commented out with "%%##") making just the following change:
>>
>> %%## /setrgb { srgb setcolor } def
>> /setrgb { setrgbcolor } def
>> %%## End of editing
>>
>> (at line 53 of the prologue). The result is a file that produces
>> exactly the same picture as the other (fast) one, and renders
>> (to within my perceptual resolution) in exactly the same time,
>> i.e. just under one second (as opposed to about 18 before).
>>
>> Thanks, Peter!
>> Ted.
>>
>> On 21-Jul-11 18:59:58, peter dalgaard wrote:
>>> This is due to the introduction of sRGB. Since this actually does
>>> something (Google for sRGB and you will be approximately as wise as
>>> me...), I don't think it is likely to be taken out. You can, however,
>>> always edit .ps.prolog. (I would expect that the line
>>>
>>> /setrgb { setrgbcolor } def
>>>
>>> instead of what is already there would reinstate the old behavior, but
>>> no guarantees.
>>> )
>>>
>>>
>>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>>>
>>>> On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>>>> Dear R users,
>>>>>>
>>>>>> I have a desktop computer and a laptop, both of them
>>>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>>>> Ubuntu repositories (this is the most recent version
>>>>>> in the repositories), while the latter has R2.13 from
>>>>>> the CRAN repositories.
>>>>>>
>>>>>> I noticed that postscript files generated with R2.10
>>>>>> are "better" than files generated with the latest release
>>>>>> of R, in particular for plots with colored areas, such
>>>>>> as the output of image or persp. The thing is that my ps
>>>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>>>> files from R2.13, while it smoothly displays ps files
>>>>>> from R2.10, regardless of "encapsulation".
>>>>>>
>>>>>> I think this is related to differences in the way the
>>>>>> ps file is generated by the two versions of R, but I
>>>>>> don't know how to go deeper in the matter.
>>>>>
>>>>> Postscript files are mostly text, so you can compare the
>>>>> two files and>  see what the differences are. The NEWS
>>>>> file shows a number of changes since 2.10.0, but I can't
>>>>> see any that would cause problems for viewers.
>>>>>
>>>>> Duncan Murdoch
>>>>>
>>>>>> Is there anyone experiencing the same issue? Is there
>>>>>> any solution?
>>>>>>
>>>>>> Thank you in advance
>>>>>>
>>>>>> Cheers
>>>>>> Gaetano
>>>>
>>>> Gaetano has now sent me two files, generated (as he posted
>>>> just now on R-help) by the same commands:
>>>>
>>>>   setEPS()
>>>>   postscript (file="volc.eps",width=5,height=4)
>>>>   image(volcano)
>>>>   dev.off()
>>>>
>>>> on his two machines:
>>>>
>>>> volc2.10.eps generated using R-2.10 on his desktop
>>>>   (the EPS file with fast rendering)
>>>>
>>>> volc2.13.eps generated using R-2.13 on his laptop
>>>>   (the EPS file with slow rendering)
>>>>
>>>> I have viewed both files on the same machine, and the
>>>> result indeed is that while volc2.10.eps renders very
>>>> quickly, volc2.13.eps does render very slowly (painting
>>>> in by vertical strips which move jerkily from left
>>>> to right). I estimate that 'gv volc2.10.eps' does the
>>>> rendering in less than 1 second, while 'gv volc2.13.eps'
>>>> takes about 18 seconds.
>>>>
>>>> Comparing the two files, I think I have found the reason.
>>>>
>>>> A 'diff' on the two files shows a basic difference in
>>>> definitions of a function used in the plotting:
>>>>
>>>> [A] In file volc2.10.eps (the fast one):
>>>>
>>>>   /rgb { setrgbcolor } def
>>>>
>>>> [B] In file volc2.13.eps (the slow one):
>>>>
>>>>   /srgb { [ /CIEBasedABC
>>>>             <<  /DecodeLMN
>>>>                  [ { dup 0.03928 le
>>>>                           {12.92321 div}
>>>>                           {0.055 add 1.055 div 2.4 exp }
>>>>                        ifelse
>>>>                    } bind dup dup
>>>>                  ]
>>>>                /MatrixLMN [0.412457 0.212673 0.019334
>>>>                            0.357576 0.715152 0.119192
>>>>                            0.180437 0.072175 0.950301]
>>>>                /WhitePoint [0.9505 1.0 1.0890]
>>>>>>
>>>>            ] setcolorspace } def
>>>>   /setrgb { srgb setcolor } def
>>>>
>>>>
>>>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>>>
>>>>   /bg { 1 0 0 rgb } def
>>>>
>>>> while [B] volc2.13.eps (the slow one) uses commands like:
>>>>
>>>>   /bg { 1 0 0 setrgb } def
>>>>
>>>> in each case for exactly the same purpose. Thus [B] the
>>>> slow one uses repeatedly (1157 times) a function setrgb
>>>> which has much higher overheads (see definition above)
>>>> than the function rgb used (1156 times) by [A] the fast one.
>>>>
>>>> So the difference in performance is *definitely* down to
>>>> a specific difference in how R-2.13 implements 'postscript()'
>>>> compared with R-2.10.
>>>>
>>>> Hoping this is useful!
>>>> Ted.
>>>>
>>>> --------------------------------------------------------------------
>>>> E-Mail: (Ted Harding)<[hidden email]>
>>>> Fax-to-email: +44 (0)870 094 0861
>>>> Date: 21-Jul-11                                       Time: 16:26:33
>>>> ------------------------------ XFMail ------------------------------
>>>>
>>>> ______________________________________________
>>>> [hidden email] 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.
>>>
>>> --
>>> Peter Dalgaard
>>> Center for Statistics, Copenhagen Business School
>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>> Phone: (+45)38153501
>>> Email: [hidden email]  Priv: [hidden email]
>>>
>>
>> --------------------------------------------------------------------
>> E-Mail: (Ted Harding)<[hidden email]>
>> Fax-to-email: +44 (0)870 094 0861
>> Date: 21-Jul-11                                       Time: 21:13:21
>> ------------------------------ XFMail ------------------------------
>>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Rainer M Krug-6
On Fri, Jul 22, 2011 at 12:44 AM, Duncan Murdoch
<[hidden email]>wrote:

> On 11-07-21 5:17 PM, pilchat wrote:
>
>> thank you guys for your reply.
>>
>> i was sure that it was related to changes in the generation of ps
>> files with the latest R release.
>>
>> now the question is: how can i restore the old behavior in R2.13?
>>
>
> Peter told you.
>

True - but editing each file ps won't be an option when creating many ps
files.

A true solution would be to include an optional argument into postscript(),
e.g. sRGB=TRUE, which uses the old implementation if sRGB==FALSE. Otherwise,
I do not think there is an *easy* solution, as postscript calls compiled
code to do the actual work.

Cheers,

Rainer

>
> Duncan Murdoch
>
>
>
>> thanks
>>
>> gaetano
>>
>> On 7/21/11, Ted Harding<ted.harding@wlandres.**net<[hidden email]>>
>>  wrote:
>>
>>> Yes, Peter, your suggestion does the trick (at any rate with
>>> Gaetano's files).
>>>
>>> I edited his volc2.13.eps (the slow one) as follows (the original
>>> commented out with "%%##") making just the following change:
>>>
>>> %%## /setrgb { srgb setcolor } def
>>> /setrgb { setrgbcolor } def
>>> %%## End of editing
>>>
>>> (at line 53 of the prologue). The result is a file that produces
>>> exactly the same picture as the other (fast) one, and renders
>>> (to within my perceptual resolution) in exactly the same time,
>>> i.e. just under one second (as opposed to about 18 before).
>>>
>>> Thanks, Peter!
>>> Ted.
>>>
>>> On 21-Jul-11 18:59:58, peter dalgaard wrote:
>>>
>>>> This is due to the introduction of sRGB. Since this actually does
>>>> something (Google for sRGB and you will be approximately as wise as
>>>> me...), I don't think it is likely to be taken out. You can, however,
>>>> always edit .ps.prolog. (I would expect that the line
>>>>
>>>> /setrgb { setrgbcolor } def
>>>>
>>>> instead of what is already there would reinstate the old behavior, but
>>>> no guarantees.
>>>> )
>>>>
>>>>
>>>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>>>>
>>>>  On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>>>>
>>>>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>>>>
>>>>>>> Dear R users,
>>>>>>>
>>>>>>> I have a desktop computer and a laptop, both of them
>>>>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>>>>> Ubuntu repositories (this is the most recent version
>>>>>>> in the repositories), while the latter has R2.13 from
>>>>>>> the CRAN repositories.
>>>>>>>
>>>>>>> I noticed that postscript files generated with R2.10
>>>>>>> are "better" than files generated with the latest release
>>>>>>> of R, in particular for plots with colored areas, such
>>>>>>> as the output of image or persp. The thing is that my ps
>>>>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>>>>> files from R2.13, while it smoothly displays ps files
>>>>>>> from R2.10, regardless of "encapsulation".
>>>>>>>
>>>>>>> I think this is related to differences in the way the
>>>>>>> ps file is generated by the two versions of R, but I
>>>>>>> don't know how to go deeper in the matter.
>>>>>>>
>>>>>>
>>>>>> Postscript files are mostly text, so you can compare the
>>>>>> two files and>  see what the differences are. The NEWS
>>>>>> file shows a number of changes since 2.10.0, but I can't
>>>>>> see any that would cause problems for viewers.
>>>>>>
>>>>>> Duncan Murdoch
>>>>>>
>>>>>>  Is there anyone experiencing the same issue? Is there
>>>>>>> any solution?
>>>>>>>
>>>>>>> Thank you in advance
>>>>>>>
>>>>>>> Cheers
>>>>>>> Gaetano
>>>>>>>
>>>>>>
>>>>> Gaetano has now sent me two files, generated (as he posted
>>>>> just now on R-help) by the same commands:
>>>>>
>>>>>  setEPS()
>>>>>  postscript (file="volc.eps",width=5,**height=4)
>>>>>  image(volcano)
>>>>>  dev.off()
>>>>>
>>>>> on his two machines:
>>>>>
>>>>> volc2.10.eps generated using R-2.10 on his desktop
>>>>>  (the EPS file with fast rendering)
>>>>>
>>>>> volc2.13.eps generated using R-2.13 on his laptop
>>>>>  (the EPS file with slow rendering)
>>>>>
>>>>> I have viewed both files on the same machine, and the
>>>>> result indeed is that while volc2.10.eps renders very
>>>>> quickly, volc2.13.eps does render very slowly (painting
>>>>> in by vertical strips which move jerkily from left
>>>>> to right). I estimate that 'gv volc2.10.eps' does the
>>>>> rendering in less than 1 second, while 'gv volc2.13.eps'
>>>>> takes about 18 seconds.
>>>>>
>>>>> Comparing the two files, I think I have found the reason.
>>>>>
>>>>> A 'diff' on the two files shows a basic difference in
>>>>> definitions of a function used in the plotting:
>>>>>
>>>>> [A] In file volc2.10.eps (the fast one):
>>>>>
>>>>>  /rgb { setrgbcolor } def
>>>>>
>>>>> [B] In file volc2.13.eps (the slow one):
>>>>>
>>>>>  /srgb { [ /CIEBasedABC
>>>>>            <<  /DecodeLMN
>>>>>                 [ { dup 0.03928 le
>>>>>                          {12.92321 div}
>>>>>                          {0.055 add 1.055 div 2.4 exp }
>>>>>                       ifelse
>>>>>                   } bind dup dup
>>>>>                 ]
>>>>>               /MatrixLMN [0.412457 0.212673 0.019334
>>>>>                           0.357576 0.715152 0.119192
>>>>>                           0.180437 0.072175 0.950301]
>>>>>               /WhitePoint [0.9505 1.0 1.0890]
>>>>>
>>>>>>
>>>>>>>            ] setcolorspace } def
>>>>>  /setrgb { srgb setcolor } def
>>>>>
>>>>>
>>>>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>>>>
>>>>>  /bg { 1 0 0 rgb } def
>>>>>
>>>>> while [B] volc2.13.eps (the slow one) uses commands like:
>>>>>
>>>>>  /bg { 1 0 0 setrgb } def
>>>>>
>>>>> in each case for exactly the same purpose. Thus [B] the
>>>>> slow one uses repeatedly (1157 times) a function setrgb
>>>>> which has much higher overheads (see definition above)
>>>>> than the function rgb used (1156 times) by [A] the fast one.
>>>>>
>>>>> So the difference in performance is *definitely* down to
>>>>> a specific difference in how R-2.13 implements 'postscript()'
>>>>> compared with R-2.10.
>>>>>
>>>>> Hoping this is useful!
>>>>> Ted.
>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> --------
>>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>>> >
>>>>> Fax-to-email: +44 (0)870 094 0861
>>>>> Date: 21-Jul-11                                       Time: 16:26:33
>>>>> ------------------------------ XFMail ------------------------------
>>>>>
>>>>> ______________________________**________________
>>>>> [hidden email] mailing list
>>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>>> --
>>>> Peter Dalgaard
>>>> Center for Statistics, Copenhagen Business School
>>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>>> Phone: (+45)38153501
>>>> Email: [hidden email]  Priv: [hidden email]
>>>>
>>>>
>>> ------------------------------**------------------------------**--------
>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>> >
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 21-Jul-11                                       Time: 21:13:21
>>> ------------------------------ XFMail ------------------------------
>>>
>>>
>> ______________________________**________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________**________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide http://www.R-project.org/**
> posting-guide.html <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

pilchat
I tried with the option sRGB=F in the postscript() command, but I got the
error message "unused argument(s) (sRGB = F)"

I think that Peter's solution is the best one, as it consists, as far as I
understand, in changing the default content of .ps.postscript.

The problem is that I don't know how to do that!!! I am still at the
beginner level with R. PLease, can anyone help me?

Thanks a lot

G

On Fri, Jul 22, 2011 at 9:04 AM, Rainer M Krug <[hidden email]> wrote:

>
>
> On Fri, Jul 22, 2011 at 12:44 AM, Duncan Murdoch <[hidden email]
> > wrote:
>
>> On 11-07-21 5:17 PM, pilchat wrote:
>>
>>> thank you guys for your reply.
>>>
>>> i was sure that it was related to changes in the generation of ps
>>> files with the latest R release.
>>>
>>> now the question is: how can i restore the old behavior in R2.13?
>>>
>>
>> Peter told you.
>>
>
> True - but editing each file ps won't be an option when creating many ps
> files.
>
> A true solution would be to include an optional argument into postscript(),
> e.g. sRGB=TRUE, which uses the old implementation if sRGB==FALSE. Otherwise,
> I do not think there is an *easy* solution, as postscript calls compiled
> code to do the actual work.
>
> Cheers,
>
> Rainer
>
>>
>> Duncan Murdoch
>>
>>
>>
>>> thanks
>>>
>>> gaetano
>>>
>>> On 7/21/11, Ted Harding<ted.harding@wlandres.**net<[hidden email]>>
>>>  wrote:
>>>
>>>> Yes, Peter, your suggestion does the trick (at any rate with
>>>> Gaetano's files).
>>>>
>>>> I edited his volc2.13.eps (the slow one) as follows (the original
>>>> commented out with "%%##") making just the following change:
>>>>
>>>> %%## /setrgb { srgb setcolor } def
>>>> /setrgb { setrgbcolor } def
>>>> %%## End of editing
>>>>
>>>> (at line 53 of the prologue). The result is a file that produces
>>>> exactly the same picture as the other (fast) one, and renders
>>>> (to within my perceptual resolution) in exactly the same time,
>>>> i.e. just under one second (as opposed to about 18 before).
>>>>
>>>> Thanks, Peter!
>>>> Ted.
>>>>
>>>> On 21-Jul-11 18:59:58, peter dalgaard wrote:
>>>>
>>>>> This is due to the introduction of sRGB. Since this actually does
>>>>> something (Google for sRGB and you will be approximately as wise as
>>>>> me...), I don't think it is likely to be taken out. You can, however,
>>>>> always edit .ps.prolog. (I would expect that the line
>>>>>
>>>>> /setrgb { setrgbcolor } def
>>>>>
>>>>> instead of what is already there would reinstate the old behavior, but
>>>>> no guarantees.
>>>>> )
>>>>>
>>>>>
>>>>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>>>>>
>>>>>  On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>>>>>
>>>>>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>>>>>
>>>>>>>> Dear R users,
>>>>>>>>
>>>>>>>> I have a desktop computer and a laptop, both of them
>>>>>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>>>>>> Ubuntu repositories (this is the most recent version
>>>>>>>> in the repositories), while the latter has R2.13 from
>>>>>>>> the CRAN repositories.
>>>>>>>>
>>>>>>>> I noticed that postscript files generated with R2.10
>>>>>>>> are "better" than files generated with the latest release
>>>>>>>> of R, in particular for plots with colored areas, such
>>>>>>>> as the output of image or persp. The thing is that my ps
>>>>>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>>>>>> files from R2.13, while it smoothly displays ps files
>>>>>>>> from R2.10, regardless of "encapsulation".
>>>>>>>>
>>>>>>>> I think this is related to differences in the way the
>>>>>>>> ps file is generated by the two versions of R, but I
>>>>>>>> don't know how to go deeper in the matter.
>>>>>>>>
>>>>>>>
>>>>>>> Postscript files are mostly text, so you can compare the
>>>>>>> two files and>  see what the differences are. The NEWS
>>>>>>> file shows a number of changes since 2.10.0, but I can't
>>>>>>> see any that would cause problems for viewers.
>>>>>>>
>>>>>>> Duncan Murdoch
>>>>>>>
>>>>>>>  Is there anyone experiencing the same issue? Is there
>>>>>>>> any solution?
>>>>>>>>
>>>>>>>> Thank you in advance
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> Gaetano
>>>>>>>>
>>>>>>>
>>>>>> Gaetano has now sent me two files, generated (as he posted
>>>>>> just now on R-help) by the same commands:
>>>>>>
>>>>>>  setEPS()
>>>>>>  postscript (file="volc.eps",width=5,**height=4)
>>>>>>  image(volcano)
>>>>>>  dev.off()
>>>>>>
>>>>>> on his two machines:
>>>>>>
>>>>>> volc2.10.eps generated using R-2.10 on his desktop
>>>>>>  (the EPS file with fast rendering)
>>>>>>
>>>>>> volc2.13.eps generated using R-2.13 on his laptop
>>>>>>  (the EPS file with slow rendering)
>>>>>>
>>>>>> I have viewed both files on the same machine, and the
>>>>>> result indeed is that while volc2.10.eps renders very
>>>>>> quickly, volc2.13.eps does render very slowly (painting
>>>>>> in by vertical strips which move jerkily from left
>>>>>> to right). I estimate that 'gv volc2.10.eps' does the
>>>>>> rendering in less than 1 second, while 'gv volc2.13.eps'
>>>>>> takes about 18 seconds.
>>>>>>
>>>>>> Comparing the two files, I think I have found the reason.
>>>>>>
>>>>>> A 'diff' on the two files shows a basic difference in
>>>>>> definitions of a function used in the plotting:
>>>>>>
>>>>>> [A] In file volc2.10.eps (the fast one):
>>>>>>
>>>>>>  /rgb { setrgbcolor } def
>>>>>>
>>>>>> [B] In file volc2.13.eps (the slow one):
>>>>>>
>>>>>>  /srgb { [ /CIEBasedABC
>>>>>>            <<  /DecodeLMN
>>>>>>                 [ { dup 0.03928 le
>>>>>>                          {12.92321 div}
>>>>>>                          {0.055 add 1.055 div 2.4 exp }
>>>>>>                       ifelse
>>>>>>                   } bind dup dup
>>>>>>                 ]
>>>>>>               /MatrixLMN [0.412457 0.212673 0.019334
>>>>>>                           0.357576 0.715152 0.119192
>>>>>>                           0.180437 0.072175 0.950301]
>>>>>>               /WhitePoint [0.9505 1.0 1.0890]
>>>>>>
>>>>>>>
>>>>>>>>            ] setcolorspace } def
>>>>>>  /setrgb { srgb setcolor } def
>>>>>>
>>>>>>
>>>>>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>>>>>
>>>>>>  /bg { 1 0 0 rgb } def
>>>>>>
>>>>>> while [B] volc2.13.eps (the slow one) uses commands like:
>>>>>>
>>>>>>  /bg { 1 0 0 setrgb } def
>>>>>>
>>>>>> in each case for exactly the same purpose. Thus [B] the
>>>>>> slow one uses repeatedly (1157 times) a function setrgb
>>>>>> which has much higher overheads (see definition above)
>>>>>> than the function rgb used (1156 times) by [A] the fast one.
>>>>>>
>>>>>> So the difference in performance is *definitely* down to
>>>>>> a specific difference in how R-2.13 implements 'postscript()'
>>>>>> compared with R-2.10.
>>>>>>
>>>>>> Hoping this is useful!
>>>>>> Ted.
>>>>>>
>>>>>> ------------------------------**------------------------------**
>>>>>> --------
>>>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>>>> >
>>>>>> Fax-to-email: +44 (0)870 094 0861
>>>>>> Date: 21-Jul-11                                       Time: 16:26:33
>>>>>> ------------------------------ XFMail ------------------------------
>>>>>>
>>>>>> ______________________________**________________
>>>>>> [hidden email] mailing list
>>>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>>> PLEASE do read the posting guide
>>>>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>>
>>>>>
>>>>> --
>>>>> Peter Dalgaard
>>>>> Center for Statistics, Copenhagen Business School
>>>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>>>> Phone: (+45)38153501
>>>>> Email: [hidden email]  Priv: [hidden email]
>>>>>
>>>>>
>>>> ------------------------------**------------------------------**
>>>> --------
>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>> >
>>>> Fax-to-email: +44 (0)870 094 0861
>>>> Date: 21-Jul-11                                       Time: 21:13:21
>>>> ------------------------------ XFMail ------------------------------
>>>>
>>>>
>>> ______________________________**________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> ______________________________**________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
> UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax (F):       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      [hidden email]
>
> Skype:      RMkrug
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Rainer M Krug-6
On Fri, Jul 22, 2011 at 9:55 AM, pilchat <[hidden email]> wrote:

> I tried with the option sRGB=F in the postscript() command, but I got the
> error message "unused argument(s) (sRGB = F)"
>

True - because that option is not there, but to include one wopuld be an
option.


>
> I think that Peter's solution is the best one, as it consists, as far as I
> understand, in changing the default content of .ps.postscript.
>

I am quite sure that he refers to editing the resulting postscript file -
but I might be wrong. As far as I can see, the creation is done in compiled
code, so it would not be that straightforward to change this behavior.


>
> The problem is that I don't know how to do that!!! I am still at the
> beginner level with R. PLease, can anyone help me?


> Thanks a lot
>
> G
>
>
> On Fri, Jul 22, 2011 at 9:04 AM, Rainer M Krug <[hidden email]> wrote:
>
>>
>>
>> On Fri, Jul 22, 2011 at 12:44 AM, Duncan Murdoch <
>> [hidden email]> wrote:
>>
>>> On 11-07-21 5:17 PM, pilchat wrote:
>>>
>>>> thank you guys for your reply.
>>>>
>>>> i was sure that it was related to changes in the generation of ps
>>>> files with the latest R release.
>>>>
>>>> now the question is: how can i restore the old behavior in R2.13?
>>>>
>>>
>>> Peter told you.
>>>
>>
>> True - but editing each file ps won't be an option when creating many ps
>> files.
>>
>> A true solution would be to include an optional argument into
>> postscript(), e.g. sRGB=TRUE, which uses the old implementation if
>> sRGB==FALSE. Otherwise, I do not think there is an *easy* solution, as
>> postscript calls compiled code to do the actual work.
>>
>> Cheers,
>>
>> Rainer
>>
>>>
>>> Duncan Murdoch
>>>
>>>
>>>
>>>> thanks
>>>>
>>>> gaetano
>>>>
>>>> On 7/21/11, Ted Harding<ted.harding@wlandres.**net<[hidden email]>>
>>>>  wrote:
>>>>
>>>>> Yes, Peter, your suggestion does the trick (at any rate with
>>>>> Gaetano's files).
>>>>>
>>>>> I edited his volc2.13.eps (the slow one) as follows (the original
>>>>> commented out with "%%##") making just the following change:
>>>>>
>>>>> %%## /setrgb { srgb setcolor } def
>>>>> /setrgb { setrgbcolor } def
>>>>> %%## End of editing
>>>>>
>>>>> (at line 53 of the prologue). The result is a file that produces
>>>>> exactly the same picture as the other (fast) one, and renders
>>>>> (to within my perceptual resolution) in exactly the same time,
>>>>> i.e. just under one second (as opposed to about 18 before).
>>>>>
>>>>> Thanks, Peter!
>>>>> Ted.
>>>>>
>>>>> On 21-Jul-11 18:59:58, peter dalgaard wrote:
>>>>>
>>>>>> This is due to the introduction of sRGB. Since this actually does
>>>>>> something (Google for sRGB and you will be approximately as wise as
>>>>>> me...), I don't think it is likely to be taken out. You can, however,
>>>>>> always edit .ps.prolog. (I would expect that the line
>>>>>>
>>>>>> /setrgb { setrgbcolor } def
>>>>>>
>>>>>> instead of what is already there would reinstate the old behavior, but
>>>>>> no guarantees.
>>>>>> )
>>>>>>
>>>>>>
>>>>>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>>>>>>
>>>>>>  On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>>>>>>
>>>>>>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>>>>>>
>>>>>>>>> Dear R users,
>>>>>>>>>
>>>>>>>>> I have a desktop computer and a laptop, both of them
>>>>>>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>>>>>>> Ubuntu repositories (this is the most recent version
>>>>>>>>> in the repositories), while the latter has R2.13 from
>>>>>>>>> the CRAN repositories.
>>>>>>>>>
>>>>>>>>> I noticed that postscript files generated with R2.10
>>>>>>>>> are "better" than files generated with the latest release
>>>>>>>>> of R, in particular for plots with colored areas, such
>>>>>>>>> as the output of image or persp. The thing is that my ps
>>>>>>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>>>>>>> files from R2.13, while it smoothly displays ps files
>>>>>>>>> from R2.10, regardless of "encapsulation".
>>>>>>>>>
>>>>>>>>> I think this is related to differences in the way the
>>>>>>>>> ps file is generated by the two versions of R, but I
>>>>>>>>> don't know how to go deeper in the matter.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Postscript files are mostly text, so you can compare the
>>>>>>>> two files and>  see what the differences are. The NEWS
>>>>>>>> file shows a number of changes since 2.10.0, but I can't
>>>>>>>> see any that would cause problems for viewers.
>>>>>>>>
>>>>>>>> Duncan Murdoch
>>>>>>>>
>>>>>>>>  Is there anyone experiencing the same issue? Is there
>>>>>>>>> any solution?
>>>>>>>>>
>>>>>>>>> Thank you in advance
>>>>>>>>>
>>>>>>>>> Cheers
>>>>>>>>> Gaetano
>>>>>>>>>
>>>>>>>>
>>>>>>> Gaetano has now sent me two files, generated (as he posted
>>>>>>> just now on R-help) by the same commands:
>>>>>>>
>>>>>>>  setEPS()
>>>>>>>  postscript (file="volc.eps",width=5,**height=4)
>>>>>>>  image(volcano)
>>>>>>>  dev.off()
>>>>>>>
>>>>>>> on his two machines:
>>>>>>>
>>>>>>> volc2.10.eps generated using R-2.10 on his desktop
>>>>>>>  (the EPS file with fast rendering)
>>>>>>>
>>>>>>> volc2.13.eps generated using R-2.13 on his laptop
>>>>>>>  (the EPS file with slow rendering)
>>>>>>>
>>>>>>> I have viewed both files on the same machine, and the
>>>>>>> result indeed is that while volc2.10.eps renders very
>>>>>>> quickly, volc2.13.eps does render very slowly (painting
>>>>>>> in by vertical strips which move jerkily from left
>>>>>>> to right). I estimate that 'gv volc2.10.eps' does the
>>>>>>> rendering in less than 1 second, while 'gv volc2.13.eps'
>>>>>>> takes about 18 seconds.
>>>>>>>
>>>>>>> Comparing the two files, I think I have found the reason.
>>>>>>>
>>>>>>> A 'diff' on the two files shows a basic difference in
>>>>>>> definitions of a function used in the plotting:
>>>>>>>
>>>>>>> [A] In file volc2.10.eps (the fast one):
>>>>>>>
>>>>>>>  /rgb { setrgbcolor } def
>>>>>>>
>>>>>>> [B] In file volc2.13.eps (the slow one):
>>>>>>>
>>>>>>>  /srgb { [ /CIEBasedABC
>>>>>>>            <<  /DecodeLMN
>>>>>>>                 [ { dup 0.03928 le
>>>>>>>                          {12.92321 div}
>>>>>>>                          {0.055 add 1.055 div 2.4 exp }
>>>>>>>                       ifelse
>>>>>>>                   } bind dup dup
>>>>>>>                 ]
>>>>>>>               /MatrixLMN [0.412457 0.212673 0.019334
>>>>>>>                           0.357576 0.715152 0.119192
>>>>>>>                           0.180437 0.072175 0.950301]
>>>>>>>               /WhitePoint [0.9505 1.0 1.0890]
>>>>>>>
>>>>>>>>
>>>>>>>>>            ] setcolorspace } def
>>>>>>>  /setrgb { srgb setcolor } def
>>>>>>>
>>>>>>>
>>>>>>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>>>>>>
>>>>>>>  /bg { 1 0 0 rgb } def
>>>>>>>
>>>>>>> while [B] volc2.13.eps (the slow one) uses commands like:
>>>>>>>
>>>>>>>  /bg { 1 0 0 setrgb } def
>>>>>>>
>>>>>>> in each case for exactly the same purpose. Thus [B] the
>>>>>>> slow one uses repeatedly (1157 times) a function setrgb
>>>>>>> which has much higher overheads (see definition above)
>>>>>>> than the function rgb used (1156 times) by [A] the fast one.
>>>>>>>
>>>>>>> So the difference in performance is *definitely* down to
>>>>>>> a specific difference in how R-2.13 implements 'postscript()'
>>>>>>> compared with R-2.10.
>>>>>>>
>>>>>>> Hoping this is useful!
>>>>>>> Ted.
>>>>>>>
>>>>>>> ------------------------------**------------------------------**
>>>>>>> --------
>>>>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>>>>> >
>>>>>>> Fax-to-email: +44 (0)870 094 0861
>>>>>>> Date: 21-Jul-11                                       Time: 16:26:33
>>>>>>> ------------------------------ XFMail ------------------------------
>>>>>>>
>>>>>>> ______________________________**________________
>>>>>>> [hidden email] mailing list
>>>>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>>>> PLEASE do read the posting guide
>>>>>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Peter Dalgaard
>>>>>> Center for Statistics, Copenhagen Business School
>>>>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>>>>> Phone: (+45)38153501
>>>>>> Email: [hidden email]  Priv: [hidden email]
>>>>>>
>>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> --------
>>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>>> >
>>>>> Fax-to-email: +44 (0)870 094 0861
>>>>> Date: 21-Jul-11                                       Time: 21:13:21
>>>>> ------------------------------ XFMail ------------------------------
>>>>>
>>>>>
>>>> ______________________________**________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>> PLEASE do read the posting guide http://www.R-project.org/**
>>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>> ______________________________**________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Stellenbosch University
>> South Africa
>>
>> Tel :       +33 - (0)9 53 10 27 44
>> Cell:       +33 - (0)6 85 62 59 98
>> Fax (F):       +33 - (0)9 58 10 27 44
>>
>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>
>> email:      [hidden email]
>>
>> Skype:      RMkrug
>>
>>
>


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Peter Dalgaard-2
In reply to this post by Rainer M Krug-6

On Jul 22, 2011, at 09:04 , Rainer M Krug wrote:

> On Fri, Jul 22, 2011 at 12:44 AM, Duncan Murdoch
> <[hidden email]>wrote:
>
>> On 11-07-21 5:17 PM, pilchat wrote:
>>
>>> thank you guys for your reply.
>>>
>>> i was sure that it was related to changes in the generation of ps
>>> files with the latest R release.
>>>
>>> now the question is: how can i restore the old behavior in R2.13?
>>>
>>
>> Peter told you.
>>
>
> True - but editing each file ps won't be an option when creating many ps
> files.
>

That's not what Peter said.

> A true solution would be to include an optional argument into postscript(),
> e.g. sRGB=TRUE, which uses the old implementation if sRGB==FALSE. Otherwise,
> I do not think there is an *easy* solution, as postscript calls compiled
> code to do the actual work.


The .ps.prolog is not in C code but in an R character vector.

>
> Cheers,
>
> Rainer
>
>>
>> Duncan Murdoch
>>
>>
>>
>>> thanks
>>>
>>> gaetano
>>>
>>> On 7/21/11, Ted Harding<ted.harding@wlandres.**net<[hidden email]>>
>>> wrote:
>>>
>>>> Yes, Peter, your suggestion does the trick (at any rate with
>>>> Gaetano's files).
>>>>
>>>> I edited his volc2.13.eps (the slow one) as follows (the original
>>>> commented out with "%%##") making just the following change:
>>>>
>>>> %%## /setrgb { srgb setcolor } def
>>>> /setrgb { setrgbcolor } def
>>>> %%## End of editing
>>>>
>>>> (at line 53 of the prologue). The result is a file that produces
>>>> exactly the same picture as the other (fast) one, and renders
>>>> (to within my perceptual resolution) in exactly the same time,
>>>> i.e. just under one second (as opposed to about 18 before).
>>>>
>>>> Thanks, Peter!
>>>> Ted.
>>>>
>>>> On 21-Jul-11 18:59:58, peter dalgaard wrote:
>>>>
>>>>> This is due to the introduction of sRGB. Since this actually does
>>>>> something (Google for sRGB and you will be approximately as wise as
>>>>> me...), I don't think it is likely to be taken out. You can, however,
>>>>> always edit .ps.prolog. (I would expect that the line
>>>>>
>>>>> /setrgb { setrgbcolor } def
>>>>>
>>>>> instead of what is already there would reinstate the old behavior, but
>>>>> no guarantees.
>>>>> )
>>>>>
>>>>>
>>>>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
>>>>>
>>>>> On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
>>>>>>
>>>>>>> On 11-07-21 3:23 AM, pilchat wrote:
>>>>>>>
>>>>>>>> Dear R users,
>>>>>>>>
>>>>>>>> I have a desktop computer and a laptop, both of them
>>>>>>>> with Ubuntu Lucid. The former has R2.10 installed from
>>>>>>>> Ubuntu repositories (this is the most recent version
>>>>>>>> in the repositories), while the latter has R2.13 from
>>>>>>>> the CRAN repositories.
>>>>>>>>
>>>>>>>> I noticed that postscript files generated with R2.10
>>>>>>>> are "better" than files generated with the latest release
>>>>>>>> of R, in particular for plots with colored areas, such
>>>>>>>> as the output of image or persp. The thing is that my ps
>>>>>>>> viewer (e.g. gv or evince) is very slow in opening ps
>>>>>>>> files from R2.13, while it smoothly displays ps files
>>>>>>>> from R2.10, regardless of "encapsulation".
>>>>>>>>
>>>>>>>> I think this is related to differences in the way the
>>>>>>>> ps file is generated by the two versions of R, but I
>>>>>>>> don't know how to go deeper in the matter.
>>>>>>>>
>>>>>>>
>>>>>>> Postscript files are mostly text, so you can compare the
>>>>>>> two files and>  see what the differences are. The NEWS
>>>>>>> file shows a number of changes since 2.10.0, but I can't
>>>>>>> see any that would cause problems for viewers.
>>>>>>>
>>>>>>> Duncan Murdoch
>>>>>>>
>>>>>>> Is there anyone experiencing the same issue? Is there
>>>>>>>> any solution?
>>>>>>>>
>>>>>>>> Thank you in advance
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> Gaetano
>>>>>>>>
>>>>>>>
>>>>>> Gaetano has now sent me two files, generated (as he posted
>>>>>> just now on R-help) by the same commands:
>>>>>>
>>>>>> setEPS()
>>>>>> postscript (file="volc.eps",width=5,**height=4)
>>>>>> image(volcano)
>>>>>> dev.off()
>>>>>>
>>>>>> on his two machines:
>>>>>>
>>>>>> volc2.10.eps generated using R-2.10 on his desktop
>>>>>> (the EPS file with fast rendering)
>>>>>>
>>>>>> volc2.13.eps generated using R-2.13 on his laptop
>>>>>> (the EPS file with slow rendering)
>>>>>>
>>>>>> I have viewed both files on the same machine, and the
>>>>>> result indeed is that while volc2.10.eps renders very
>>>>>> quickly, volc2.13.eps does render very slowly (painting
>>>>>> in by vertical strips which move jerkily from left
>>>>>> to right). I estimate that 'gv volc2.10.eps' does the
>>>>>> rendering in less than 1 second, while 'gv volc2.13.eps'
>>>>>> takes about 18 seconds.
>>>>>>
>>>>>> Comparing the two files, I think I have found the reason.
>>>>>>
>>>>>> A 'diff' on the two files shows a basic difference in
>>>>>> definitions of a function used in the plotting:
>>>>>>
>>>>>> [A] In file volc2.10.eps (the fast one):
>>>>>>
>>>>>> /rgb { setrgbcolor } def
>>>>>>
>>>>>> [B] In file volc2.13.eps (the slow one):
>>>>>>
>>>>>> /srgb { [ /CIEBasedABC
>>>>>>           <<  /DecodeLMN
>>>>>>                [ { dup 0.03928 le
>>>>>>                         {12.92321 div}
>>>>>>                         {0.055 add 1.055 div 2.4 exp }
>>>>>>                      ifelse
>>>>>>                  } bind dup dup
>>>>>>                ]
>>>>>>              /MatrixLMN [0.412457 0.212673 0.019334
>>>>>>                          0.357576 0.715152 0.119192
>>>>>>                          0.180437 0.072175 0.950301]
>>>>>>              /WhitePoint [0.9505 1.0 1.0890]
>>>>>>
>>>>>>>
>>>>>>>>           ] setcolorspace } def
>>>>>> /setrgb { srgb setcolor } def
>>>>>>
>>>>>>
>>>>>> Then [A] volc2.10.eps (the fast one) uses commands like:
>>>>>>
>>>>>> /bg { 1 0 0 rgb } def
>>>>>>
>>>>>> while [B] volc2.13.eps (the slow one) uses commands like:
>>>>>>
>>>>>> /bg { 1 0 0 setrgb } def
>>>>>>
>>>>>> in each case for exactly the same purpose. Thus [B] the
>>>>>> slow one uses repeatedly (1157 times) a function setrgb
>>>>>> which has much higher overheads (see definition above)
>>>>>> than the function rgb used (1156 times) by [A] the fast one.
>>>>>>
>>>>>> So the difference in performance is *definitely* down to
>>>>>> a specific difference in how R-2.13 implements 'postscript()'
>>>>>> compared with R-2.10.
>>>>>>
>>>>>> Hoping this is useful!
>>>>>> Ted.
>>>>>>
>>>>>> ------------------------------**------------------------------**
>>>>>> --------
>>>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>>>>>
>>>>>> Fax-to-email: +44 (0)870 094 0861
>>>>>> Date: 21-Jul-11                                       Time: 16:26:33
>>>>>> ------------------------------ XFMail ------------------------------
>>>>>>
>>>>>> ______________________________**________________
>>>>>> [hidden email] mailing list
>>>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>>> PLEASE do read the posting guide
>>>>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>>
>>>>>
>>>>> --
>>>>> Peter Dalgaard
>>>>> Center for Statistics, Copenhagen Business School
>>>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>>>> Phone: (+45)38153501
>>>>> Email: [hidden email]  Priv: [hidden email]
>>>>>
>>>>>
>>>> ------------------------------**------------------------------**--------
>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<[hidden email]>
>>>>>
>>>> Fax-to-email: +44 (0)870 094 0861
>>>> Date: 21-Jul-11                                       Time: 21:13:21
>>>> ------------------------------ XFMail ------------------------------
>>>>
>>>>
>>> ______________________________**________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> ______________________________**________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
> UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax (F):       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      [hidden email]
>
> Skype:      RMkrug
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

ted.harding-3
On 22-Jul-11 08:02:40, peter dalgaard wrote:
> [much snip]
>
> The .ps.prolog is not in C code but in an R character vector.

While '?postscript' says (uder "Details:"):


  Most of the PostScript prologue used is taken from the
  R character vector '.ps.prolog'.  This is marked in the
  output, and can be changed by changing that vector.
  (This is only advisable for PostScript experts: the
  standard version is in ?namespace:grDevices?.)

I have not been able to get my hands on that vector in an
R session. What is the incantation for locating it, please?

With thanks,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 22-Jul-11                                       Time: 10:08:34
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Rainer M Krug-6
In reply to this post by Peter Dalgaard-2
On Fri, Jul 22, 2011 at 10:02 AM, peter dalgaard <[hidden email]> wrote:

>
> On Jul 22, 2011, at 09:04 , Rainer M Krug wrote:
>
> > On Fri, Jul 22, 2011 at 12:44 AM, Duncan Murdoch
> > <[hidden email]>wrote:
> >
> >> On 11-07-21 5:17 PM, pilchat wrote:
> >>
> >>> thank you guys for your reply.
> >>>
> >>> i was sure that it was related to changes in the generation of ps
> >>> files with the latest R release.
> >>>
> >>> now the question is: how can i restore the old behavior in R2.13?
> >>>
> >>
> >> Peter told you.
> >>
> >
> > True - but editing each file ps won't be an option when creating many ps
> > files.
> >
>
> That's not what Peter said.
>

Sincere apologies from Rainer to Peter.


>
> > A true solution would be to include an optional argument into
> postscript(),
> > e.g. sRGB=TRUE, which uses the old implementation if sRGB==FALSE.
> Otherwise,
> > I do not think there is an *easy* solution, as postscript calls compiled
> > code to do the actual work.
>
>
> The .ps.prolog is not in C code but in an R character vector.
>

Rainer should really read the posts properly before replying ....


>
> >
> > Cheers,
> >
> > Rainer
> >
> >>
> >> Duncan Murdoch
> >>
> >>
> >>
> >>> thanks
> >>>
> >>> gaetano
> >>>
> >>> On 7/21/11, Ted Harding<ted.harding@wlandres.**net<
> [hidden email]>>
> >>> wrote:
> >>>
> >>>> Yes, Peter, your suggestion does the trick (at any rate with
> >>>> Gaetano's files).
> >>>>
> >>>> I edited his volc2.13.eps (the slow one) as follows (the original
> >>>> commented out with "%%##") making just the following change:
> >>>>
> >>>> %%## /setrgb { srgb setcolor } def
> >>>> /setrgb { setrgbcolor } def
> >>>> %%## End of editing
> >>>>
> >>>> (at line 53 of the prologue). The result is a file that produces
> >>>> exactly the same picture as the other (fast) one, and renders
> >>>> (to within my perceptual resolution) in exactly the same time,
> >>>> i.e. just under one second (as opposed to about 18 before).
> >>>>
> >>>> Thanks, Peter!
> >>>> Ted.
> >>>>
> >>>> On 21-Jul-11 18:59:58, peter dalgaard wrote:
> >>>>
> >>>>> This is due to the introduction of sRGB. Since this actually does
> >>>>> something (Google for sRGB and you will be approximately as wise as
> >>>>> me...), I don't think it is likely to be taken out. You can, however,
> >>>>> always edit .ps.prolog. (I would expect that the line
> >>>>>
> >>>>> /setrgb { setrgbcolor } def
> >>>>>
> >>>>> instead of what is already there would reinstate the old behavior,
> but
> >>>>> no guarantees.
> >>>>> )
> >>>>>
> >>>>>
> >>>>> On Jul 21, 2011, at 17:26 , (Ted Harding) wrote:
> >>>>>
> >>>>> On 21-Jul-11 13:24:32, Duncan Murdoch wrote:
> >>>>>>
> >>>>>>> On 11-07-21 3:23 AM, pilchat wrote:
> >>>>>>>
> >>>>>>>> Dear R users,
> >>>>>>>>
> >>>>>>>> I have a desktop computer and a laptop, both of them
> >>>>>>>> with Ubuntu Lucid. The former has R2.10 installed from
> >>>>>>>> Ubuntu repositories (this is the most recent version
> >>>>>>>> in the repositories), while the latter has R2.13 from
> >>>>>>>> the CRAN repositories.
> >>>>>>>>
> >>>>>>>> I noticed that postscript files generated with R2.10
> >>>>>>>> are "better" than files generated with the latest release
> >>>>>>>> of R, in particular for plots with colored areas, such
> >>>>>>>> as the output of image or persp. The thing is that my ps
> >>>>>>>> viewer (e.g. gv or evince) is very slow in opening ps
> >>>>>>>> files from R2.13, while it smoothly displays ps files
> >>>>>>>> from R2.10, regardless of "encapsulation".
> >>>>>>>>
> >>>>>>>> I think this is related to differences in the way the
> >>>>>>>> ps file is generated by the two versions of R, but I
> >>>>>>>> don't know how to go deeper in the matter.
> >>>>>>>>
> >>>>>>>
> >>>>>>> Postscript files are mostly text, so you can compare the
> >>>>>>> two files and>  see what the differences are. The NEWS
> >>>>>>> file shows a number of changes since 2.10.0, but I can't
> >>>>>>> see any that would cause problems for viewers.
> >>>>>>>
> >>>>>>> Duncan Murdoch
> >>>>>>>
> >>>>>>> Is there anyone experiencing the same issue? Is there
> >>>>>>>> any solution?
> >>>>>>>>
> >>>>>>>> Thank you in advance
> >>>>>>>>
> >>>>>>>> Cheers
> >>>>>>>> Gaetano
> >>>>>>>>
> >>>>>>>
> >>>>>> Gaetano has now sent me two files, generated (as he posted
> >>>>>> just now on R-help) by the same commands:
> >>>>>>
> >>>>>> setEPS()
> >>>>>> postscript (file="volc.eps",width=5,**height=4)
> >>>>>> image(volcano)
> >>>>>> dev.off()
> >>>>>>
> >>>>>> on his two machines:
> >>>>>>
> >>>>>> volc2.10.eps generated using R-2.10 on his desktop
> >>>>>> (the EPS file with fast rendering)
> >>>>>>
> >>>>>> volc2.13.eps generated using R-2.13 on his laptop
> >>>>>> (the EPS file with slow rendering)
> >>>>>>
> >>>>>> I have viewed both files on the same machine, and the
> >>>>>> result indeed is that while volc2.10.eps renders very
> >>>>>> quickly, volc2.13.eps does render very slowly (painting
> >>>>>> in by vertical strips which move jerkily from left
> >>>>>> to right). I estimate that 'gv volc2.10.eps' does the
> >>>>>> rendering in less than 1 second, while 'gv volc2.13.eps'
> >>>>>> takes about 18 seconds.
> >>>>>>
> >>>>>> Comparing the two files, I think I have found the reason.
> >>>>>>
> >>>>>> A 'diff' on the two files shows a basic difference in
> >>>>>> definitions of a function used in the plotting:
> >>>>>>
> >>>>>> [A] In file volc2.10.eps (the fast one):
> >>>>>>
> >>>>>> /rgb { setrgbcolor } def
> >>>>>>
> >>>>>> [B] In file volc2.13.eps (the slow one):
> >>>>>>
> >>>>>> /srgb { [ /CIEBasedABC
> >>>>>>           <<  /DecodeLMN
> >>>>>>                [ { dup 0.03928 le
> >>>>>>                         {12.92321 div}
> >>>>>>                         {0.055 add 1.055 div 2.4 exp }
> >>>>>>                      ifelse
> >>>>>>                  } bind dup dup
> >>>>>>                ]
> >>>>>>              /MatrixLMN [0.412457 0.212673 0.019334
> >>>>>>                          0.357576 0.715152 0.119192
> >>>>>>                          0.180437 0.072175 0.950301]
> >>>>>>              /WhitePoint [0.9505 1.0 1.0890]
> >>>>>>
> >>>>>>>
> >>>>>>>>           ] setcolorspace } def
> >>>>>> /setrgb { srgb setcolor } def
> >>>>>>
> >>>>>>
> >>>>>> Then [A] volc2.10.eps (the fast one) uses commands like:
> >>>>>>
> >>>>>> /bg { 1 0 0 rgb } def
> >>>>>>
> >>>>>> while [B] volc2.13.eps (the slow one) uses commands like:
> >>>>>>
> >>>>>> /bg { 1 0 0 setrgb } def
> >>>>>>
> >>>>>> in each case for exactly the same purpose. Thus [B] the
> >>>>>> slow one uses repeatedly (1157 times) a function setrgb
> >>>>>> which has much higher overheads (see definition above)
> >>>>>> than the function rgb used (1156 times) by [A] the fast one.
> >>>>>>
> >>>>>> So the difference in performance is *definitely* down to
> >>>>>> a specific difference in how R-2.13 implements 'postscript()'
> >>>>>> compared with R-2.10.
> >>>>>>
> >>>>>> Hoping this is useful!
> >>>>>> Ted.
> >>>>>>
> >>>>>> ------------------------------**------------------------------**
> >>>>>> --------
> >>>>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<
> [hidden email]>
> >>>>>>>
> >>>>>> Fax-to-email: +44 (0)870 094 0861
> >>>>>> Date: 21-Jul-11                                       Time: 16:26:33
> >>>>>> ------------------------------ XFMail ------------------------------
> >>>>>>
> >>>>>> ______________________________**________________
> >>>>>> [hidden email] mailing list
> >>>>>> https://stat.ethz.ch/mailman/**listinfo/r-help<
> https://stat.ethz.ch/mailman/listinfo/r-help>
> >>>>>> PLEASE do read the posting guide
> >>>>>> http://www.R-project.org/**posting-guide.html<
> http://www.R-project.org/posting-guide.html>
> >>>>>> and provide commented, minimal, self-contained, reproducible code.
> >>>>>>
> >>>>>
> >>>>> --
> >>>>> Peter Dalgaard
> >>>>> Center for Statistics, Copenhagen Business School
> >>>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> >>>>> Phone: (+45)38153501
> >>>>> Email: [hidden email]  Priv: [hidden email]
> >>>>>
> >>>>>
> >>>>
> ------------------------------**------------------------------**--------
> >>>> E-Mail: (Ted Harding)<ted.harding@wlandres.**net<
> [hidden email]>
> >>>>>
> >>>> Fax-to-email: +44 (0)870 094 0861
> >>>> Date: 21-Jul-11                                       Time: 21:13:21
> >>>> ------------------------------ XFMail ------------------------------
> >>>>
> >>>>
> >>> ______________________________**________________
> >>> [hidden email] mailing list
> >>> https://stat.ethz.ch/mailman/**listinfo/r-help<
> https://stat.ethz.ch/mailman/listinfo/r-help>
> >>> PLEASE do read the posting guide http://www.R-project.org/**
> >>> posting-guide.html <http://www.R-project.org/posting-guide.html>
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >> ______________________________**________________
> >> [hidden email] mailing list
> >> https://stat.ethz.ch/mailman/**listinfo/r-help<
> https://stat.ethz.ch/mailman/listinfo/r-help>
> >> PLEASE do read the posting guide http://www.R-project.org/**
> >> posting-guide.html <http://www.R-project.org/posting-guide.html>
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> > --
> > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology,
> > UCT), Dipl. Phys. (Germany)
> >
> > Centre of Excellence for Invasion Biology
> > Stellenbosch University
> > South Africa
> >
> > Tel :       +33 - (0)9 53 10 27 44
> > Cell:       +33 - (0)6 85 62 59 98
> > Fax (F):       +33 - (0)9 58 10 27 44
> >
> > Fax (D):    +49 - (0)3 21 21 25 22 44
> >
> > email:      [hidden email]
> >
> > Skype:      RMkrug
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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.
>
> --
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: [hidden email]  Priv: [hidden email]
>
>


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

Peter Dalgaard-2
In reply to this post by ted.harding-3

On Jul 22, 2011, at 11:08 , (Ted Harding) wrote:

> On 22-Jul-11 08:02:40, peter dalgaard wrote:
>> [much snip]
>>
>> The .ps.prolog is not in C code but in an R character vector.
>
> While '?postscript' says (uder "Details:"):
>
>
>  Most of the PostScript prologue used is taken from the
>  R character vector '.ps.prolog'.  This is marked in the
>  output, and can be changed by changing that vector.
>  (This is only advisable for PostScript experts: the
>  standard version is in ?namespace:grDevices?.)
>
> I have not been able to get my hands on that vector in an
> R session. What is the incantation for locating it, please?

grDevices:::.ps.prolog

as in:

.ps.prolog <- grDevices:::.ps.prolog
.ps.prolog[39] <- "/setrgb { setrgbcolor } def"
postscript()
image(volcano)
dev.off()
 

--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

ted.harding-3
On 22-Jul-11 09:20:23, peter dalgaard wrote:

>
> On Jul 22, 2011, at 11:08 , (Ted Harding) wrote:
>
>> On 22-Jul-11 08:02:40, peter dalgaard wrote:
>>> [much snip]
>>>
>>> The .ps.prolog is not in C code but in an R character vector.
>>
>> While '?postscript' says (uder "Details:"):
>>
>>
>>  Most of the PostScript prologue used is taken from the
>>  R character vector '.ps.prolog'.  This is marked in the
>>  output, and can be changed by changing that vector.
>>  (This is only advisable for PostScript experts: the
>>  standard version is in ?namespace:grDevices?.)
>>
>> I have not been able to get my hands on that vector in an
>> R session. What is the incantation for locating it, please?
>
> grDevices:::.ps.prolog
>
> as in:
>
> .ps.prolog <- grDevices:::.ps.prolog
> .ps.prolog[39] <- "/setrgb { setrgbcolor } def"
> postscript()
> image(volcano)
> dev.off()
>
> --
> Peter Dalgaard

Ah, thanks! I wasn't using sufficiently many ":"'s!
Apologies for the fumble.
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 22-Jul-11                                       Time: 10:27:37
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

pilchat
That's great! Thank you all!!

Final question: how can I edit permanently the .ps.prolog? Is the .First()
function an option?

Please, tell me every detail as I am a total dumb!

Many thanks

Gaetano

On Fri, Jul 22, 2011 at 11:27 AM, Ted Harding <[hidden email]>wrote:

> On 22-Jul-11 09:20:23, peter dalgaard wrote:
> >
> > On Jul 22, 2011, at 11:08 , (Ted Harding) wrote:
> >
> >> On 22-Jul-11 08:02:40, peter dalgaard wrote:
> >>> [much snip]
> >>>
> >>> The .ps.prolog is not in C code but in an R character vector.
> >>
> >> While '?postscript' says (uder "Details:"):
> >>
> >>
> >>  Most of the PostScript prologue used is taken from the
> >>  R character vector '.ps.prolog'.  This is marked in the
> >>  output, and can be changed by changing that vector.
> >>  (This is only advisable for PostScript experts: the
> >>  standard version is in ?namespace:grDevices?.)
> >>
> >> I have not been able to get my hands on that vector in an
> >> R session. What is the incantation for locating it, please?
> >
> > grDevices:::.ps.prolog
> >
> > as in:
> >
> > .ps.prolog <- grDevices:::.ps.prolog
> > .ps.prolog[39] <- "/setrgb { setrgbcolor } def"
> > postscript()
> > image(volcano)
> > dev.off()
> >
> > --
> > Peter Dalgaard
>
> Ah, thanks! I wasn't using sufficiently many ":"'s!
> Apologies for the fumble.
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 22-Jul-11                                       Time: 10:27:37
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

James Cloos-3
In reply to this post by ted.harding-3
I suspect that a few s/def/bind def/ on that prologue might improve
things a bit.

The ps R creates freely switches between the sRGB ABC space and
setgray.  That is a good thing; it helps ensure that black will
be just black when sent to a CMYK device.  Without that you can
get CMY black from some devices.  But it does complicate things.

(CMYK devices often use CMY black rather than K black when the
source is RGB black because it is better when printing contone
images, such as photographs.  But it just wastes ink and toner
when printing charts and similar graphics.)

The best improvement would be to have R keep track of the last
colorspace and only run the srgb procedure when switching from
DeviceGray, rather than every time it changes the RGB colour.

The SetColor() function in R/src/library/grDevices/src/devPS.c
looks to be the place to do that.  The Invalidate() function
and the PostScriptDesc struct there also need to track any
such changes.

-JimC
--
James Cloos <[hidden email]>         OpenPGP: 1024D/ED7DAEA6

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R versions and PostScript files

David Smith-4
In reply to this post by pilchat
Another option in this specific case is to use the new useRaster=TRUE
option, which makes the image function generate much more compact and
faster-rendering image plots. This code:

setEPS()
postscript (file="volc.eps",width=5,height=4)
image(volcano,useRaster=TRUE)
dev.off()

in R 2.13 generates a 37Kb file which renders very quickly (compared
to a 193Kb file without using the useRaster=TRUE option).

# David Smith

On Thu, Jul 21, 2011 at 12:23 AM, pilchat <[hidden email]> wrote:

>
> Dear R users,
>
> I have a desktop computer and a laptop, both of them with Ubuntu Lucid. The
> former has R2.10 installed from Ubuntu repositories (this is the most recent
> version in the repositories), while the latter has R2.13 from the CRAN
> repositories.
>
> I noticed that postscript files generated with R2.10 are "better"  than
> files generated with the latest release of R, in particular for plots with
> colored areas, such as the output of image or persp. The thing is that my ps
> viewer (e.g. gv or evince) is very slow in opening ps files from R2.13,
> while it smoothly displays ps files from R2.10, regardless of
> "encapsulation".
>
> I think this is related to differences in the way the ps file is generated
> by the two versions of R, but I don't know how to go deeper in the matter.
>
> Is there anyone experiencing the same issue? Is there any solution?
>
> Thank you in advance
>
> Cheers
>
> Gaetano
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.



--
David M Smith <[hidden email]>
VP of Marketing, Revolution Analytics  http://blog.revolutionanalytics.com
Tel: +1 (650) 646-9523 (Palo Alto, CA, USA)

______________________________________________
[hidden email] 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.
12
Loading...