As i suspected there is code to deal with the locale in the main.c of
R, which switches some locale to "" which means they will use this
machine's custom locale instead of "C", but they explicitely do not do
it for LC_NUMERIC

I suspect a

setlocale(LC_NUMERIC,"C") before loading the R library would avoid
those issues, but I do not know the rpy code enough to know if that
should happen in C or in Python, or if it should be fixed on the R
side.

Laurent



2008/11/14 Aurelie Bornot <[EMAIL PROTECTED]>:
>
> Hello,
>
> With these lines before importing rpy, everything goes perfectly well !
>
> import locale
> locale.setlocale(locale.LC_ALL,'C')
>
> Thank you very much for your help Laurent, Barry and Peter  !
> This fix will help me a lot !
>
> Aurélie
>
>
>
> laurent oget a écrit :
>
> Yup, this definitely is broken...
>
> Somehow in the Rpy version of the postscript file the numbers use , instead
> of .
>
> I suspect the problem is linked to the locale, i.e. you are using a
> french version of the operating system, and in french when you print a
> decimal number you should use , instead of .
>
> The root of the problem is probably an R bug, if you feel brave you
> should tell people on the R development mailing list, about it, they
> will probably be amused.
>
> One way to fix this would be to do
>
> import locale
> locale.setlocale(locale.LC_ALL,'C')
>
> I am not sure if you should do it before importing Rpy or before
> calling r.postscript
>
> Another way would be to log out and log back in switching the language
> to english.
>
> and if none of that does work I managed to open your postscript file
> after fixing it with
>
> sed -i s/,/\./g TEST_Rpy.ps
>
> sadly this methode replaces the , with . in the legend too....
>
>
> I am not sure I can think of a way to fix this from within Rpy.
> switching the locale to 'C' each time you import Rpy is a bit rude...
>
> bon courage
>
> Laurent
>
>
>
> 2008/11/13 Aurelie Bornot <[EMAIL PROTECTED]>:
>
>
> Ok
> So I tried the same chart in python/rpy and in R.
>
> Here are the lines I type in python/rpy :
> m = pylab.load("test.data")
> m
> array([[  1.,   2.],
>        [  2.,   3.],
>        [  3.,   4.],
>        [  4.,   5.],
>        [  5.,   6.],
>        [  6.,   7.],
>        [  7.,   8.],
>        [  8.,   9.],
>        [  9.,  10.]])
> r.postscript("TEST_Rpy.ps")
> r.plot(m[:,0],m[:,1])
> r.dev_off()
> {'null device': 1}
>
> And here are the lines I type in R:
> m=read.table("test.data")
> m
>   V1 V2
> 1  1  2
> 2  2  3
> 3  3  4
> 4  4  5
> 5  5  6
> 6  6  7
> 7  7  8
> 8  8  9
> 9  9 10
> postscript("TEST_R.ps")
> plot(m[,1],m[,2])
> dev.off()
> null device
>           1
>
> I join the file test.data and the 2 postscript outputs.
> The 2 postscripts are of the same size but I can't open TEST_Rpy.ps.
> TEST_R.ps is ok for me : I can open it without problem.
>
> Can you see another difference between the two?
>
> Thank you very much for helping !
> Aurélie
>
>
> laurent oget a écrit :
>
> I would try to generate the same chart in rpy and directly in R and
> compare the postscript files. This would give you, and us, an idea of
> what went wrong.
>
> Laurent
>
> 2008/11/13 Aurelie Bornot <[EMAIL PROTECTED]>:
>
>
> Hello Peter,
>
> Thanks for your answer.
> Yes I have tried this in R itself. And everything is OK. It seems that it is
> an rpy problem.
>
> Aurélie
>
> Peter a écrit :
>
> On Thu, Nov 13, 2008 at 3:56 PM, Aurelie Bornot
> <[EMAIL PROTECTED]> wrote:
>
>
> Hello everyone,
>
> I used to create postscripts with rpy without any problem on my old
> computer. This computer was on fedora 7 with python 2.5.1.
> I was given a new computer with fedora 9, python 2.5.1 and 2.8.0, and
> now, all my 'old' scripts for making postscripts or pdf do not work
> anymore...
> Here is a piece of code :
> r.postscript("Effets.ps")
> r.plot(ArrayB,ArrayC)
> r.dev_off()
>
>
> Have you tried doing this in R itself?  Just use any simple R plotting
> example to make a PS and PDF file, and see if those files work.  That
> should tell us if its an rpy problem or not.
>
> Peter
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>
> --
> Please note my new mail adress : <[EMAIL PROTECTED]>
> ---------------------------------------------------------------------------
> Aurelie Bornot
> EBGM, INSERM UMR-S 726, DSIMB team
> INTS
> 6, rue Alexandre Cabanel
> 75739 Paris Cedex 15
> FRANCE
> ---------------------------------------------------------------------------
> Website : http://www.dsimb.inserm.fr/~bornot/
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>
> --
> Please note my new mail adress : <[EMAIL PROTECTED]>
> ---------------------------------------------------------------------------
> Aurelie Bornot
> EBGM, INSERM UMR-S 726, DSIMB team
> INTS
> 6, rue Alexandre Cabanel
> 75739 Paris Cedex 15
> FRANCE
> ---------------------------------------------------------------------------
> Website : http://www.dsimb.inserm.fr/~bornot/
>
> 1 2
> 2 3
> 3 4
> 4 5
> 5 6
> 6 7
> 7 8
> 8 9
> 9 10
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>
> --
> Please note my new mail adress : <[EMAIL PROTECTED]>
> ---------------------------------------------------------------------------
> Aurelie Bornot
> EBGM, INSERM UMR-S 726, DSIMB team
> INTS
> 6, rue Alexandre Cabanel
> 75739 Paris Cedex 15
> FRANCE
> ---------------------------------------------------------------------------
> Website : http://www.dsimb.inserm.fr/~bornot/
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to