MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #7820] postscript (eps) / latex / par(mfg=...) / problem! #2405

Closed MichaelChirico closed 4 years ago

MichaelChirico commented 4 years ago

From: dan@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Full_Name: Dan Freak Bolser Version: Version 2.0.0 (2004-10-04) OS: Linux 2.4.20-31.9 (RedHat 9) Submission from: (NULL) (62.253.128.15)

The same problem I am having has been reported here

http://tolstoy.newcastle.edu.au/R/devel/04a/0344.html

Namely that using par(mfg=...) with a postscript (eps) for inclusion with latex makes the figure appear upside down and back to front (flipped)!

Converting the dvi to ps makes matters worse (the eps seems to be broken), however, it appears fine with gv.

Here is (basically) the code I am using...

dat <- read.table("x.dmp", header=1)
t(dat)

t(dat) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CHAINS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 20 23 24 26 28 FREQUENCY 886 792 136 201 16 58 6 21 3 9 3 9 1 4 3 1 1 1 1 1


postscript(

+ "x.eps", + width = 6.0, + height = 6.0, + horizontal = FALSE, + onefile = FALSE, + paper = "special", + )


par(mfg=c(1,1))
par(mar=c(3,4,1,2))
plot(dat,type='b')

par(mfg=c(2,1))
par(mar=c(4,4,0,2))
plot(dat,type='b', log='y')

dev.off()

Including the resulting file in a latex document like this...

begin{figure} \centering \includegraphics[width=\textwidth]{x.eps} \caption[X] { Hello! } \label{xFig} \end{figure}

The result is an upside down (flipped) version of my plot. I tried rotating 180 degrees (based on similar problems people were having on the list), but then it just gets worse (most of the plot is off the page). If I convert the dvi to ps (dvips -Ppdf my.tex.dvi -o my.tex.ps) it gets worse (a tiny speck where the image should be).

After removing the two mfg commands (which I use to add grid lines (not shown for clarity)) everything is fine! Some how mfg is snarling things up.

OK, I just had a brain wave (dont laugh). Here is a diff of the working eps vs the broken eps...

diff broken working

78a79,80

%%Page: 1 1
bp

229c231 < 57.60 43.20 403.20 201.60 cl ---

57.60 57.60 403.20 216.00 cl

417c419 < %%Pages: 0 ---

%%Pages: 1

Does that help anyone debug my problem? Like I said, both look identical via gv, and are 'conceptually' identical in R.

Here are my vitals

Linux 2.4.20-31.9 i686 athlon i386 GNU/Linux R 2.0.0 (2004-10-04). GNU Ghostscript 7.05 (2002-04-22)

Anything else you need?

Please help!


METADATA

MichaelChirico commented 4 years ago

From: Marc Schwartz <MSchwartz@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Just for the sake of linkage and further information, a related post to this bug is on r-devel at:

https://stat.ethz.ch/pipermail/r-devel/2005-April/033016.html

Marc Schwartz


METADATA

MichaelChirico commented 4 years ago

NOTES: This is clearly user error: ?par says mfg must be set after mfcol or mfrow, and the code given correctly gives an error when run.

Marc Schwartz's example is a bug, fixed in 2.3.0.


METADATA

MichaelChirico commented 4 years ago

Audit (from Jitterbug): Wed Apr 27 16:07:17 2005 ripley moved from incoming to Graphics Thu Jan 19 22:06:10 2006 ripley changed notes Thu Jan 19 22:34:51 2006 ripley changed notes Thu Jan 19 21:34:51 2006 ripley moved from Graphics to Graphics-fixed


METADATA