I've been trying to track down some strange behavior I was getting, and I think narrowed it down to some code that I'll paste below. I'm trying to write to .eps files, and when I have usetex=True, something is screwed up with the padding on the left, and eventually the whole image is just white. If I run this script, the 'testA-*.eps' look good, but 'testB-*' does not. The same problem happens even if I remove the ticklabels. Any tips would be appreciated. thanks, Ken ------------------------------------------------ import matplotlib.pyplot as plt import numpy as np from matplotlib import rc fig = plt.figure() ax = fig.add_axes([0,0,1,1],frameon=False) X = np.tile(np.arange(500),(10,1)) # (10,500) shape ax.imshow(X,interpolation='nearest',aspect='auto') def go(name): for d in (1,2,3,4): w = d*5 h = d fig.set_size_inches(w,h) fig.savefig("%s-%d.eps" % (name,d)) rc('text', usetex=False) go("testA") rc('text', usetex=True) go("testB")
ps backend, when usetex=True, uses latex with psfrag package to generate the output (with some extra steps). It seems that the bounding box information is not correctly recovered during this process. I first thought that it would be quite difficult to get this correct, however the attached (relatively simple) patch seems to work fine. Ken, can you try the patch and see if it works? -JJ On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> wrote: > I've been trying to track down some strange behavior I was getting, > and I think narrowed it down to some code that I'll paste below. > > I'm trying to write to .eps files, and when I have usetex=True, > something is screwed up with the padding on the left, and eventually > the whole image is just white. > > If I run this script, the 'testA-*.eps' look good, but 'testB-*' does > not. The same problem happens even if I remove the ticklabels. > > Any tips would be appreciated. > thanks, > Ken > > > > ------------------------------------------------ > import matplotlib.pyplot as plt > import numpy as np > from matplotlib import rc > > fig = plt.figure() > ax = fig.add_axes([0,0,1,1],frameon=False) > > X = np.tile(np.arange(500),(10,1)) # (10,500) shape > > ax.imshow(X,interpolation='nearest',aspect='auto') > > def go(name): > > for d in (1,2,3,4): > > w = d*5 > h = d > > fig.set_size_inches(w,h) > fig.savefig("%s-%d.eps" % (name,d)) > > rc('text', usetex=False) > go("testA") > > rc('text', usetex=True) > go("testB") > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensign option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >
Yeah, that seems to work! thanks a lot, Ken On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> wrote: > ps backend, when usetex=True, uses latex with psfrag package to > generate the output (with some extra steps). > It seems that the bounding box information is not correctly recovered > during this process. > I first thought that it would be quite difficult to get this correct, > however the attached (relatively simple) patch seems to work fine. > > Ken, can you try the patch and see if it works? > > -JJ > > > > > On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> wrote: >> I've been trying to track down some strange behavior I was getting, >> and I think narrowed it down to some code that I'll paste below. >> >> I'm trying to write to .eps files, and when I have usetex=True, >> something is screwed up with the padding on the left, and eventually >> the whole image is just white. >> >> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does >> not. The same problem happens even if I remove the ticklabels. >> >> Any tips would be appreciated. >> thanks, >> Ken >> >> >> >> ------------------------------------------------ >> import matplotlib.pyplot as plt >> import numpy as np >> from matplotlib import rc >> >> fig = plt.figure() >> ax = fig.add_axes([0,0,1,1],frameon=False) >> >> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >> >> ax.imshow(X,interpolation='nearest',aspect='auto') >> >> def go(name): >> >> for d in (1,2,3,4): >> >> w = d*5 >> h = d >> >> fig.set_size_inches(w,h) >> fig.savefig("%s-%d.eps" % (name,d)) >> >> rc('text', usetex=False) >> go("testA") >> >> rc('text', usetex=True) >> go("testB") >> >> ------------------------------------------------------------------------------ >> Crystal Reports - New Free Runtime and 30 Day Trial >> Check out the new simplified licensign option that enables unlimited >> royalty-free distribution of the report engine for externally facing >> server and web deployment. >> http://p.sf.net/sfu/businessobjects >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >
This patch is now committed to the trunk (r7068). -JJ On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> wrote: > Yeah, that seems to work! thanks a lot, > Ken > > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> wrote: >> ps backend, when usetex=True, uses latex with psfrag package to >> generate the output (with some extra steps). >> It seems that the bounding box information is not correctly recovered >> during this process. >> I first thought that it would be quite difficult to get this correct, >> however the attached (relatively simple) patch seems to work fine. >> >> Ken, can you try the patch and see if it works? >> >> -JJ >> >> >> >> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> wrote: >>> I've been trying to track down some strange behavior I was getting, >>> and I think narrowed it down to some code that I'll paste below. >>> >>> I'm trying to write to .eps files, and when I have usetex=True, >>> something is screwed up with the padding on the left, and eventually >>> the whole image is just white. >>> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does >>> not. The same problem happens even if I remove the ticklabels. >>> >>> Any tips would be appreciated. >>> thanks, >>> Ken >>> >>> >>> >>> ------------------------------------------------ >>> import matplotlib.pyplot as plt >>> import numpy as np >>> from matplotlib import rc >>> >>> fig = plt.figure() >>> ax = fig.add_axes([0,0,1,1],frameon=False) >>> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >>> >>> ax.imshow(X,interpolation='nearest',aspect='auto') >>> >>> def go(name): >>> >>> for d in (1,2,3,4): >>> >>> w = d*5 >>> h = d >>> >>> fig.set_size_inches(w,h) >>> fig.savefig("%s-%d.eps" % (name,d)) >>> >>> rc('text', usetex=False) >>> go("testA") >>> >>> rc('text', usetex=True) >>> go("testB") >>> >>> ------------------------------------------------------------------------------ >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> Check out the new simplified licensign option that enables unlimited >>> royalty-free distribution of the report engine for externally facing >>> server and web deployment. >>> http://p.sf.net/sfu/businessobjects >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>> >> >
Hi Jae-Joon, On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...> wrote: > This patch is now committed to the trunk (r7068). > I think these changes have had unintended consequences. I attached a test file I used to inspect the results when I wrote the original code that you recently tried to improve. There are lots of combinations of large and small figures, with usetex and without, and with no distiller, gs distiller, of xpdf (pdftops) distiller. You have to visually inspect all of the ps/eps files that are generated. At one time, all of these files looked acceptable, but that was a couple years ago and I don't remember what version of ghostscript I was using at the time (I'm sure there is a record of it somewhere on this mailing list). WIth r7067, most of the files look fine, a few of the large files (large paper sizes) have problems. With r7068, quite a few examples have problems. Darren > > > On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> wrote: > > Yeah, that seems to work! thanks a lot, > > Ken > > > > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> > wrote: > >> ps backend, when usetex=True, uses latex with psfrag package to > >> generate the output (with some extra steps). > >> It seems that the bounding box information is not correctly recovered > >> during this process. > >> I first thought that it would be quite difficult to get this correct, > >> however the attached (relatively simple) patch seems to work fine. > >> > >> Ken, can you try the patch and see if it works? > >> > >> -JJ > >> > >> > >> > >> > >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> > wrote: > >>> I've been trying to track down some strange behavior I was getting, > >>> and I think narrowed it down to some code that I'll paste below. > >>> > >>> I'm trying to write to .eps files, and when I have usetex=True, > >>> something is screwed up with the padding on the left, and eventually > >>> the whole image is just white. > >>> > >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does > >>> not. The same problem happens even if I remove the ticklabels. > >>> > >>> Any tips would be appreciated. > >>> thanks, > >>> Ken > >>> > >>> > >>> > >>> ------------------------------------------------ > >>> import matplotlib.pyplot as plt > >>> import numpy as np > >>> from matplotlib import rc > >>> > >>> fig = plt.figure() > >>> ax = fig.add_axes([0,0,1,1],frameon=False) > >>> > >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape > >>> > >>> ax.imshow(X,interpolation='nearest',aspect='auto') > >>> > >>> def go(name): > >>> > >>> for d in (1,2,3,4): > >>> > >>> w = d*5 > >>> h = d > >>> > >>> fig.set_size_inches(w,h) > >>> fig.savefig("%s-%d.eps" % (name,d)) > >>> > >>> rc('text', usetex=False) > >>> go("testA") > >>> > >>> rc('text', usetex=True) > >>> go("testB") > >>> > >>> > ------------------------------------------------------------------------------ > >>> Crystal Reports - New Free Runtime and 30 Day Trial > >>> Check out the new simplified licensign option that enables unlimited > >>> royalty-free distribution of the report engine for externally > facing > >>> server and web deployment. > >>> http://p.sf.net/sfu/businessobjects > >>> _______________________________________________ > >>> Matplotlib-devel mailing list > >>> Mat...@li... > >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > >>> > >> > > > > > ------------------------------------------------------------------------------ > > Register Now & Save for Velocity, the Web Performance & Operations > Conference from O'Reilly Media. Velocity features a full day of > expert-led, hands-on workshops and two days of sessions from industry > leaders in dedicated Performance & Operations tracks. Use code vel09scf > and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >
The test file is attached this time. On Wed, Apr 29, 2009 at 3:55 PM, Darren Dale <dsd...@gm...> wrote: > Hi Jae-Joon, > > On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...>wrote: > >> This patch is now committed to the trunk (r7068). >> > > I think these changes have had unintended consequences. I attached a test > file I used to inspect the results when I wrote the original code that you > recently tried to improve. There are lots of combinations of large and small > figures, with usetex and without, and with no distiller, gs distiller, of > xpdf (pdftops) distiller. You have to visually inspect all of the ps/eps > files that are generated. At one time, all of these files looked acceptable, > but that was a couple years ago and I don't remember what version of > ghostscript I was using at the time (I'm sure there is a record of it > somewhere on this mailing list). WIth r7067, most of the files look fine, a > few of the large files (large paper sizes) have problems. With r7068, quite > a few examples have problems. > > Darren > > > >> >> >> On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> wrote: >> > Yeah, that seems to work! thanks a lot, >> > Ken >> > >> > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> >> wrote: >> >> ps backend, when usetex=True, uses latex with psfrag package to >> >> generate the output (with some extra steps). >> >> It seems that the bounding box information is not correctly recovered >> >> during this process. >> >> I first thought that it would be quite difficult to get this correct, >> >> however the attached (relatively simple) patch seems to work fine. >> >> >> >> Ken, can you try the patch and see if it works? >> >> >> >> -JJ >> >> >> >> >> >> >> >> >> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> >> wrote: >> >>> I've been trying to track down some strange behavior I was getting, >> >>> and I think narrowed it down to some code that I'll paste below. >> >>> >> >>> I'm trying to write to .eps files, and when I have usetex=True, >> >>> something is screwed up with the padding on the left, and eventually >> >>> the whole image is just white. >> >>> >> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does >> >>> not. The same problem happens even if I remove the ticklabels. >> >>> >> >>> Any tips would be appreciated. >> >>> thanks, >> >>> Ken >> >>> >> >>> >> >>> >> >>> ------------------------------------------------ >> >>> import matplotlib.pyplot as plt >> >>> import numpy as np >> >>> from matplotlib import rc >> >>> >> >>> fig = plt.figure() >> >>> ax = fig.add_axes([0,0,1,1],frameon=False) >> >>> >> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >> >>> >> >>> ax.imshow(X,interpolation='nearest',aspect='auto') >> >>> >> >>> def go(name): >> >>> >> >>> for d in (1,2,3,4): >> >>> >> >>> w = d*5 >> >>> h = d >> >>> >> >>> fig.set_size_inches(w,h) >> >>> fig.savefig("%s-%d.eps" % (name,d)) >> >>> >> >>> rc('text', usetex=False) >> >>> go("testA") >> >>> >> >>> rc('text', usetex=True) >> >>> go("testB") >> >>> >> >>> >> ------------------------------------------------------------------------------ >> >>> Crystal Reports - New Free Runtime and 30 Day Trial >> >>> Check out the new simplified licensign option that enables unlimited >> >>> royalty-free distribution of the report engine for externally >> facing >> >>> server and web deployment. >> >>> http://p.sf.net/sfu/businessobjects >> >>> _______________________________________________ >> >>> Matplotlib-devel mailing list >> >>> Mat...@li... >> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >>> >> >> >> > >> >> >> ------------------------------------------------------------------------------ >> > > > > >> Register Now & Save for Velocity, the Web Performance & Operations >> Conference from O'Reilly Media. Velocity features a full day of >> expert-led, hands-on workshops and two days of sessions from industry >> leaders in dedicated Performance & Operations tracks. Use code vel09scf >> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> > >
Yes, I'm sorry, I also spoke too soon. I have found problems with this patch - mainly things like it chopping off xlabel, titles, etc, for some examples. I have some major deadlines using this stuff right now, so I don't have time to experiment. But, eventually, I will try to take a look at what is happening. Ken On Wed, Apr 29, 2009 at 3:56 PM, Darren Dale <dsd...@gm...> wrote: > The test file is attached this time. > > On Wed, Apr 29, 2009 at 3:55 PM, Darren Dale <dsd...@gm...> wrote: >> >> Hi Jae-Joon, >> >> On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...> >> wrote: >>> >>> This patch is now committed to the trunk (r7068). >> >> I think these changes have had unintended consequences. I attached a test >> file I used to inspect the results when I wrote the original code that you >> recently tried to improve. There are lots of combinations of large and small >> figures, with usetex and without, and with no distiller, gs distiller, of >> xpdf (pdftops) distiller. You have to visually inspect all of the ps/eps >> files that are generated. At one time, all of these files looked acceptable, >> but that was a couple years ago and I don't remember what version of >> ghostscript I was using at the time (I'm sure there is a record of it >> somewhere on this mailing list). WIth r7067, most of the files look fine, a >> few of the large files (large paper sizes) have problems. With r7068, quite >> a few examples have problems. >> >> Darren >> >> >>> >>> On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> wrote: >>> > Yeah, that seems to work! thanks a lot, >>> > Ken >>> > >>> > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> >>> > wrote: >>> >> ps backend, when usetex=True, uses latex with psfrag package to >>> >> generate the output (with some extra steps). >>> >> It seems that the bounding box information is not correctly recovered >>> >> during this process. >>> >> I first thought that it would be quite difficult to get this correct, >>> >> however the attached (relatively simple) patch seems to work fine. >>> >> >>> >> Ken, can you try the patch and see if it works? >>> >> >>> >> -JJ >>> >> >>> >> >>> >> >>> >> >>> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> >>> >> wrote: >>> >>> I've been trying to track down some strange behavior I was getting, >>> >>> and I think narrowed it down to some code that I'll paste below. >>> >>> >>> >>> I'm trying to write to .eps files, and when I have usetex=True, >>> >>> something is screwed up with the padding on the left, and eventually >>> >>> the whole image is just white. >>> >>> >>> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does >>> >>> not. The same problem happens even if I remove the ticklabels. >>> >>> >>> >>> Any tips would be appreciated. >>> >>> thanks, >>> >>> Ken >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------ >>> >>> import matplotlib.pyplot as plt >>> >>> import numpy as np >>> >>> from matplotlib import rc >>> >>> >>> >>> fig = plt.figure() >>> >>> ax = fig.add_axes([0,0,1,1],frameon=False) >>> >>> >>> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >>> >>> >>> >>> ax.imshow(X,interpolation='nearest',aspect='auto') >>> >>> >>> >>> def go(name): >>> >>> >>> >>> for d in (1,2,3,4): >>> >>> >>> >>> w = d*5 >>> >>> h = d >>> >>> >>> >>> fig.set_size_inches(w,h) >>> >>> fig.savefig("%s-%d.eps" % (name,d)) >>> >>> >>> >>> rc('text', usetex=False) >>> >>> go("testA") >>> >>> >>> >>> rc('text', usetex=True) >>> >>> go("testB") >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> >>> Check out the new simplified licensign option that enables unlimited >>> >>> royalty-free distribution of the report engine for externally >>> >>> facing >>> >>> server and web deployment. >>> >>> http://p.sf.net/sfu/businessobjects >>> >>> _______________________________________________ >>> >>> Matplotlib-devel mailing list >>> >>> Mat...@li... >>> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>> >>> >>> >> >>> > >>> >>> >>> ------------------------------------------------------------------------------ >> >> >> >>> >>> Register Now & Save for Velocity, the Web Performance & Operations >>> Conference from O'Reilly Media. Velocity features a full day of >>> expert-led, hands-on workshops and two days of sessions from industry >>> leaders in dedicated Performance & Operations tracks. Use code vel09scf >>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> > >
On Wed, Apr 29, 2009 at 4:07 PM, Ken Schutte <kts...@gm...> wrote: > Yes, I'm sorry, I also spoke too soon. I have found problems with > this patch - mainly things like it chopping off xlabel, titles, etc, > for some examples. > I'm not sure if these are related with my patch. Please show some example when you have time. Regards, -JJ
Thanks Darren, I believe that my patch only affects eps output with usetex=True, i.e., only those "tex_*.eps" files are affected. I found that my previous patch didn't treated the orientation of the paper correctly. So the bounding box of all the landscape eps outputs are incorrect. This can be easily fixed. Index: lib/matplotlib/backends/backend_ps.py =================================================================== --- lib/matplotlib/backends/backend_ps.py (revision 7071) +++ lib/matplotlib/backends/backend_ps.py (working copy) @@ -1100,8 +1100,11 @@ # set the paper size to the figure size if isEPSF. The # resulting ps file has the given size with correct bounding # box so that there is no need to call 'pstoeps' paperWidth, paperHeight = self.figure.get_size_inches() + if isLandscape: + paperWidth, paperHeight = paperHeight, paperWidth else: temp_papertype = _get_papertype(width, height) if papertype=='auto': Anyhow, after the landscape fix, all eps output looks fine to me. Can you check this? Regards, -JJ On Wed, Apr 29, 2009 at 3:55 PM, Darren Dale <dsd...@gm...> wrote: > Hi Jae-Joon, > > On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...> wrote: >> >> This patch is now committed to the trunk (r7068). > > I think these changes have had unintended consequences. I attached a test > file I used to inspect the results when I wrote the original code that you > recently tried to improve. There are lots of combinations of large and small > figures, with usetex and without, and with no distiller, gs distiller, of > xpdf (pdftops) distiller. You have to visually inspect all of the ps/eps > files that are generated. At one time, all of these files looked acceptable, > but that was a couple years ago and I don't remember what version of > ghostscript I was using at the time (I'm sure there is a record of it > somewhere on this mailing list). WIth r7067, most of the files look fine, a > few of the large files (large paper sizes) have problems. With r7068, quite > a few examples have problems. > > Darren > > >> >> On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> wrote: >> > Yeah, that seems to work! thanks a lot, >> > Ken >> > >> > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> >> > wrote: >> >> ps backend, when usetex=True, uses latex with psfrag package to >> >> generate the output (with some extra steps). >> >> It seems that the bounding box information is not correctly recovered >> >> during this process. >> >> I first thought that it would be quite difficult to get this correct, >> >> however the attached (relatively simple) patch seems to work fine. >> >> >> >> Ken, can you try the patch and see if it works? >> >> >> >> -JJ >> >> >> >> >> >> >> >> >> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> >> >> wrote: >> >>> I've been trying to track down some strange behavior I was getting, >> >>> and I think narrowed it down to some code that I'll paste below. >> >>> >> >>> I'm trying to write to .eps files, and when I have usetex=True, >> >>> something is screwed up with the padding on the left, and eventually >> >>> the whole image is just white. >> >>> >> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does >> >>> not. The same problem happens even if I remove the ticklabels. >> >>> >> >>> Any tips would be appreciated. >> >>> thanks, >> >>> Ken >> >>> >> >>> >> >>> >> >>> ------------------------------------------------ >> >>> import matplotlib.pyplot as plt >> >>> import numpy as np >> >>> from matplotlib import rc >> >>> >> >>> fig = plt.figure() >> >>> ax = fig.add_axes([0,0,1,1],frameon=False) >> >>> >> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >> >>> >> >>> ax.imshow(X,interpolation='nearest',aspect='auto') >> >>> >> >>> def go(name): >> >>> >> >>> for d in (1,2,3,4): >> >>> >> >>> w = d*5 >> >>> h = d >> >>> >> >>> fig.set_size_inches(w,h) >> >>> fig.savefig("%s-%d.eps" % (name,d)) >> >>> >> >>> rc('text', usetex=False) >> >>> go("testA") >> >>> >> >>> rc('text', usetex=True) >> >>> go("testB") >> >>> >> >>> >> >>> ------------------------------------------------------------------------------ >> >>> Crystal Reports - New Free Runtime and 30 Day Trial >> >>> Check out the new simplified licensign option that enables unlimited >> >>> royalty-free distribution of the report engine for externally >> >>> facing >> >>> server and web deployment. >> >>> http://p.sf.net/sfu/businessobjects >> >>> _______________________________________________ >> >>> Matplotlib-devel mailing list >> >>> Mat...@li... >> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >>> >> >> >> > >> >> >> ------------------------------------------------------------------------------ > > > >> >> Register Now & Save for Velocity, the Web Performance & Operations >> Conference from O'Reilly Media. Velocity features a full day of >> expert-led, hands-on workshops and two days of sessions from industry >> leaders in dedicated Performance & Operations tracks. Use code vel09scf >> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > >
Argg, attached a wrong patch. This one should work # set the paper size to the figure size if isEPSF. The # resulting ps file has the given size with correct bounding # box so that there is no need to call 'pstoeps' if isEPSF: paperWidth, paperHeight = self.figure.get_size_inches() + if isLandscape: + paperWidth, paperHeight = paperHeight, paperWidth else: temp_papertype = _get_papertype(width, height) if papertype=='auto': On Wed, Apr 29, 2009 at 5:55 PM, Jae-Joon Lee <lee...@gm...> wrote: > Thanks Darren, > > I believe that my patch only affects eps output with usetex=True, > i.e., only those "tex_*.eps" files are affected. > > I found that my previous patch didn't treated the orientation of the > paper correctly. > So the bounding box of all the landscape eps outputs are incorrect. > This can be easily fixed. > > Index: lib/matplotlib/backends/backend_ps.py > =================================================================== > --- lib/matplotlib/backends/backend_ps.py (revision 7071) > +++ lib/matplotlib/backends/backend_ps.py (working copy) > @@ -1100,8 +1100,11 @@ > # set the paper size to the figure size if isEPSF. The > # resulting ps file has the given size with correct bounding > # box so that there is no need to call 'pstoeps' > paperWidth, paperHeight = self.figure.get_size_inches() > + if isLandscape: > + paperWidth, paperHeight = paperHeight, paperWidth > else: > temp_papertype = _get_papertype(width, height) > if papertype=='auto': > > > > > Anyhow, after the landscape fix, all eps output looks fine to me. > Can you check this? > > Regards, > > -JJ > > > > On Wed, Apr 29, 2009 at 3:55 PM, Darren Dale <dsd...@gm...> wrote: >> Hi Jae-Joon, >> >> On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...> wrote: >>> >>> This patch is now committed to the trunk (r7068). >> >> I think these changes have had unintended consequences. I attached a test >> file I used to inspect the results when I wrote the original code that you >> recently tried to improve. There are lots of combinations of large and small >> figures, with usetex and without, and with no distiller, gs distiller, of >> xpdf (pdftops) distiller. You have to visually inspect all of the ps/eps >> files that are generated. At one time, all of these files looked acceptable, >> but that was a couple years ago and I don't remember what version of >> ghostscript I was using at the time (I'm sure there is a record of it >> somewhere on this mailing list). WIth r7067, most of the files look fine, a >> few of the large files (large paper sizes) have problems. With r7068, quite >> a few examples have problems. >> >> Darren >> >> >>> >>> On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> wrote: >>> > Yeah, that seems to work! thanks a lot, >>> > Ken >>> > >>> > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> >>> > wrote: >>> >> ps backend, when usetex=True, uses latex with psfrag package to >>> >> generate the output (with some extra steps). >>> >> It seems that the bounding box information is not correctly recovered >>> >> during this process. >>> >> I first thought that it would be quite difficult to get this correct, >>> >> however the attached (relatively simple) patch seems to work fine. >>> >> >>> >> Ken, can you try the patch and see if it works? >>> >> >>> >> -JJ >>> >> >>> >> >>> >> >>> >> >>> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> >>> >> wrote: >>> >>> I've been trying to track down some strange behavior I was getting, >>> >>> and I think narrowed it down to some code that I'll paste below. >>> >>> >>> >>> I'm trying to write to .eps files, and when I have usetex=True, >>> >>> something is screwed up with the padding on the left, and eventually >>> >>> the whole image is just white. >>> >>> >>> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does >>> >>> not. The same problem happens even if I remove the ticklabels. >>> >>> >>> >>> Any tips would be appreciated. >>> >>> thanks, >>> >>> Ken >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------ >>> >>> import matplotlib.pyplot as plt >>> >>> import numpy as np >>> >>> from matplotlib import rc >>> >>> >>> >>> fig = plt.figure() >>> >>> ax = fig.add_axes([0,0,1,1],frameon=False) >>> >>> >>> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >>> >>> >>> >>> ax.imshow(X,interpolation='nearest',aspect='auto') >>> >>> >>> >>> def go(name): >>> >>> >>> >>> for d in (1,2,3,4): >>> >>> >>> >>> w = d*5 >>> >>> h = d >>> >>> >>> >>> fig.set_size_inches(w,h) >>> >>> fig.savefig("%s-%d.eps" % (name,d)) >>> >>> >>> >>> rc('text', usetex=False) >>> >>> go("testA") >>> >>> >>> >>> rc('text', usetex=True) >>> >>> go("testB") >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> >>> Check out the new simplified licensign option that enables unlimited >>> >>> royalty-free distribution of the report engine for externally >>> >>> facing >>> >>> server and web deployment. >>> >>> http://p.sf.net/sfu/businessobjects >>> >>> _______________________________________________ >>> >>> Matplotlib-devel mailing list >>> >>> Mat...@li... >>> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>> >>> >>> >> >>> > >>> >>> >>> ------------------------------------------------------------------------------ >> >> >> >>> >>> Register Now & Save for Velocity, the Web Performance & Operations >>> Conference from O'Reilly Media. Velocity features a full day of >>> expert-led, hands-on workshops and two days of sessions from industry >>> leaders in dedicated Performance & Operations tracks. Use code vel09scf >>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >> >
I have to make several attempts before the test script will run to completion, I get errors like: File "/usr/lib64/python2.6/site-packages/matplotlib/dviread.py", line 812, in find_tex_file pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE) File "/usr/lib64/python2.6/subprocess.py", line 595, in __init__ errread, errwrite) File "/usr/lib64/python2.6/subprocess.py", line 1084, in _execute_child data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB OSError: [Errno 4] Interrupted system call Aside from that, the results from this patch look better. Thanks, Darren On Wed, Apr 29, 2009 at 5:57 PM, Jae-Joon Lee <lee...@gm...> wrote: > Argg, attached a wrong patch. This one should work > > # set the paper size to the figure size if isEPSF. The > # resulting ps file has the given size with correct bounding > # box so that there is no need to call 'pstoeps' > if isEPSF: > paperWidth, paperHeight = self.figure.get_size_inches() > + if isLandscape: > + paperWidth, paperHeight = paperHeight, paperWidth > else: > temp_papertype = _get_papertype(width, height) > if papertype=='auto': > > > > On Wed, Apr 29, 2009 at 5:55 PM, Jae-Joon Lee <lee...@gm...> > wrote: > > Thanks Darren, > > > > I believe that my patch only affects eps output with usetex=True, > > i.e., only those "tex_*.eps" files are affected. > > > > I found that my previous patch didn't treated the orientation of the > > paper correctly. > > So the bounding box of all the landscape eps outputs are incorrect. > > This can be easily fixed. > > > > Index: lib/matplotlib/backends/backend_ps.py > > =================================================================== > > --- lib/matplotlib/backends/backend_ps.py (revision 7071) > > +++ lib/matplotlib/backends/backend_ps.py (working copy) > > @@ -1100,8 +1100,11 @@ > > # set the paper size to the figure size if isEPSF. The > > # resulting ps file has the given size with correct bounding > > # box so that there is no need to call 'pstoeps' > > paperWidth, paperHeight = self.figure.get_size_inches() > > + if isLandscape: > > + paperWidth, paperHeight = paperHeight, paperWidth > > else: > > temp_papertype = _get_papertype(width, height) > > if papertype=='auto': > > > > > > > > > > Anyhow, after the landscape fix, all eps output looks fine to me. > > Can you check this? > > > > Regards, > > > > -JJ > > > > > > > > On Wed, Apr 29, 2009 at 3:55 PM, Darren Dale <dsd...@gm...> wrote: > >> Hi Jae-Joon, > >> > >> On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...> > wrote: > >>> > >>> This patch is now committed to the trunk (r7068). > >> > >> I think these changes have had unintended consequences. I attached a > test > >> file I used to inspect the results when I wrote the original code that > you > >> recently tried to improve. There are lots of combinations of large and > small > >> figures, with usetex and without, and with no distiller, gs distiller, > of > >> xpdf (pdftops) distiller. You have to visually inspect all of the ps/eps > >> files that are generated. At one time, all of these files looked > acceptable, > >> but that was a couple years ago and I don't remember what version of > >> ghostscript I was using at the time (I'm sure there is a record of it > >> somewhere on this mailing list). WIth r7067, most of the files look > fine, a > >> few of the large files (large paper sizes) have problems. With r7068, > quite > >> a few examples have problems. > >> > >> Darren > >> > >> > >>> > >>> On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> > wrote: > >>> > Yeah, that seems to work! thanks a lot, > >>> > Ken > >>> > > >>> > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> > >>> > wrote: > >>> >> ps backend, when usetex=True, uses latex with psfrag package to > >>> >> generate the output (with some extra steps). > >>> >> It seems that the bounding box information is not correctly > recovered > >>> >> during this process. > >>> >> I first thought that it would be quite difficult to get this > correct, > >>> >> however the attached (relatively simple) patch seems to work fine. > >>> >> > >>> >> Ken, can you try the patch and see if it works? > >>> >> > >>> >> -JJ > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> > >>> >> wrote: > >>> >>> I've been trying to track down some strange behavior I was getting, > >>> >>> and I think narrowed it down to some code that I'll paste below. > >>> >>> > >>> >>> I'm trying to write to .eps files, and when I have usetex=True, > >>> >>> something is screwed up with the padding on the left, and > eventually > >>> >>> the whole image is just white. > >>> >>> > >>> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' > does > >>> >>> not. The same problem happens even if I remove the ticklabels. > >>> >>> > >>> >>> Any tips would be appreciated. > >>> >>> thanks, > >>> >>> Ken > >>> >>> > >>> >>> > >>> >>> > >>> >>> ------------------------------------------------ > >>> >>> import matplotlib.pyplot as plt > >>> >>> import numpy as np > >>> >>> from matplotlib import rc > >>> >>> > >>> >>> fig = plt.figure() > >>> >>> ax = fig.add_axes([0,0,1,1],frameon=False) > >>> >>> > >>> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape > >>> >>> > >>> >>> ax.imshow(X,interpolation='nearest',aspect='auto') > >>> >>> > >>> >>> def go(name): > >>> >>> > >>> >>> for d in (1,2,3,4): > >>> >>> > >>> >>> w = d*5 > >>> >>> h = d > >>> >>> > >>> >>> fig.set_size_inches(w,h) > >>> >>> fig.savefig("%s-%d.eps" % (name,d)) > >>> >>> > >>> >>> rc('text', usetex=False) > >>> >>> go("testA") > >>> >>> > >>> >>> rc('text', usetex=True) > >>> >>> go("testB") > >>> >>> > >>> >>> > >>> >>> > ------------------------------------------------------------------------------ > >>> >>> Crystal Reports - New Free Runtime and 30 Day Trial > >>> >>> Check out the new simplified licensign option that enables > unlimited > >>> >>> royalty-free distribution of the report engine for externally > >>> >>> facing > >>> >>> server and web deployment. > >>> >>> http://p.sf.net/sfu/businessobjects > >>> >>> _______________________________________________ > >>> >>> Matplotlib-devel mailing list > >>> >>> Mat...@li... > >>> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > >>> >>> > >>> >> > >>> > > >>> > >>> > >>> > ------------------------------------------------------------------------------ > >> > >> > >> > >>> > >>> Register Now & Save for Velocity, the Web Performance & Operations > >>> Conference from O'Reilly Media. Velocity features a full day of > >>> expert-led, hands-on workshops and two days of sessions from industry > >>> leaders in dedicated Performance & Operations tracks. Use code vel09scf > >>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf > >>> _______________________________________________ > >>> Matplotlib-devel mailing list > >>> Mat...@li... > >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > >> > >> > > >
On Thu, Apr 30, 2009 at 11:44 AM, Darren Dale <dsd...@gm...> wrote: > I have to make several attempts before the test script will run to > completion, I get errors like: > > File "/usr/lib64/python2.6/site-packages/matplotlib/dviread.py", line 812, > in find_tex_file > pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE) > File "/usr/lib64/python2.6/subprocess.py", line 595, in __init__ > errread, errwrite) > File "/usr/lib64/python2.6/subprocess.py", line 1084, in _execute_child > data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB > OSError: [Errno 4] Interrupted system call > I don't see such any error and I'm not sure if the error is related with my patch since the ps backend does not use dviread module. Anyhow, I just committed the patch for the landscape mode, so that others can test. I'll revert the changes if they seem to cause more harm than good. Regards, -JJ > Aside from that, the results from this patch look better. Thanks, > Darren > > On Wed, Apr 29, 2009 at 5:57 PM, Jae-Joon Lee <lee...@gm...> wrote: >> >> Argg, attached a wrong patch. This one should work >> >> # set the paper size to the figure size if isEPSF. The >> # resulting ps file has the given size with correct bounding >> # box so that there is no need to call 'pstoeps' >> if isEPSF: >> paperWidth, paperHeight = self.figure.get_size_inches() >> + if isLandscape: >> + paperWidth, paperHeight = paperHeight, paperWidth >> else: >> temp_papertype = _get_papertype(width, height) >> if papertype=='auto': >> >> >> >> On Wed, Apr 29, 2009 at 5:55 PM, Jae-Joon Lee <lee...@gm...> >> wrote: >> > Thanks Darren, >> > >> > I believe that my patch only affects eps output with usetex=True, >> > i.e., only those "tex_*.eps" files are affected. >> > >> > I found that my previous patch didn't treated the orientation of the >> > paper correctly. >> > So the bounding box of all the landscape eps outputs are incorrect. >> > This can be easily fixed. >> > >> > Index: lib/matplotlib/backends/backend_ps.py >> > =================================================================== >> > --- lib/matplotlib/backends/backend_ps.py (revision 7071) >> > +++ lib/matplotlib/backends/backend_ps.py (working copy) >> > @@ -1100,8 +1100,11 @@ >> > # set the paper size to the figure size if isEPSF. The >> > # resulting ps file has the given size with correct bounding >> > # box so that there is no need to call 'pstoeps' >> > paperWidth, paperHeight = self.figure.get_size_inches() >> > + if isLandscape: >> > + paperWidth, paperHeight = paperHeight, paperWidth >> > else: >> > temp_papertype = _get_papertype(width, height) >> > if papertype=='auto': >> > >> > >> > >> > >> > Anyhow, after the landscape fix, all eps output looks fine to me. >> > Can you check this? >> > >> > Regards, >> > >> > -JJ >> > >> > >> > >> > On Wed, Apr 29, 2009 at 3:55 PM, Darren Dale <dsd...@gm...> wrote: >> >> Hi Jae-Joon, >> >> >> >> On Tue, Apr 28, 2009 at 3:49 PM, Jae-Joon Lee <lee...@gm...> >> >> wrote: >> >>> >> >>> This patch is now committed to the trunk (r7068). >> >> >> >> I think these changes have had unintended consequences. I attached a >> >> test >> >> file I used to inspect the results when I wrote the original code that >> >> you >> >> recently tried to improve. There are lots of combinations of large and >> >> small >> >> figures, with usetex and without, and with no distiller, gs distiller, >> >> of >> >> xpdf (pdftops) distiller. You have to visually inspect all of the >> >> ps/eps >> >> files that are generated. At one time, all of these files looked >> >> acceptable, >> >> but that was a couple years ago and I don't remember what version of >> >> ghostscript I was using at the time (I'm sure there is a record of it >> >> somewhere on this mailing list). WIth r7067, most of the files look >> >> fine, a >> >> few of the large files (large paper sizes) have problems. With r7068, >> >> quite >> >> a few examples have problems. >> >> >> >> Darren >> >> >> >> >> >>> >> >>> On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte <kts...@gm...> >> >>> wrote: >> >>> > Yeah, that seems to work! thanks a lot, >> >>> > Ken >> >>> > >> >>> > On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee <lee...@gm...> >> >>> > wrote: >> >>> >> ps backend, when usetex=True, uses latex with psfrag package to >> >>> >> generate the output (with some extra steps). >> >>> >> It seems that the bounding box information is not correctly >> >>> >> recovered >> >>> >> during this process. >> >>> >> I first thought that it would be quite difficult to get this >> >>> >> correct, >> >>> >> however the attached (relatively simple) patch seems to work fine. >> >>> >> >> >>> >> Ken, can you try the patch and see if it works? >> >>> >> >> >>> >> -JJ >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte <kts...@gm...> >> >>> >> wrote: >> >>> >>> I've been trying to track down some strange behavior I was >> >>> >>> getting, >> >>> >>> and I think narrowed it down to some code that I'll paste below. >> >>> >>> >> >>> >>> I'm trying to write to .eps files, and when I have usetex=True, >> >>> >>> something is screwed up with the padding on the left, and >> >>> >>> eventually >> >>> >>> the whole image is just white. >> >>> >>> >> >>> >>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' >> >>> >>> does >> >>> >>> not. The same problem happens even if I remove the ticklabels. >> >>> >>> >> >>> >>> Any tips would be appreciated. >> >>> >>> thanks, >> >>> >>> Ken >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> ------------------------------------------------ >> >>> >>> import matplotlib.pyplot as plt >> >>> >>> import numpy as np >> >>> >>> from matplotlib import rc >> >>> >>> >> >>> >>> fig = plt.figure() >> >>> >>> ax = fig.add_axes([0,0,1,1],frameon=False) >> >>> >>> >> >>> >>> X = np.tile(np.arange(500),(10,1)) # (10,500) shape >> >>> >>> >> >>> >>> ax.imshow(X,interpolation='nearest',aspect='auto') >> >>> >>> >> >>> >>> def go(name): >> >>> >>> >> >>> >>> for d in (1,2,3,4): >> >>> >>> >> >>> >>> w = d*5 >> >>> >>> h = d >> >>> >>> >> >>> >>> fig.set_size_inches(w,h) >> >>> >>> fig.savefig("%s-%d.eps" % (name,d)) >> >>> >>> >> >>> >>> rc('text', usetex=False) >> >>> >>> go("testA") >> >>> >>> >> >>> >>> rc('text', usetex=True) >> >>> >>> go("testB") >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> ------------------------------------------------------------------------------ >> >>> >>> Crystal Reports - New Free Runtime and 30 Day Trial >> >>> >>> Check out the new simplified licensign option that enables >> >>> >>> unlimited >> >>> >>> royalty-free distribution of the report engine for externally >> >>> >>> facing >> >>> >>> server and web deployment. >> >>> >>> http://p.sf.net/sfu/businessobjects >> >>> >>> _______________________________________________ >> >>> >>> Matplotlib-devel mailing list >> >>> >>> Mat...@li... >> >>> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >>> >>> >> >>> >> >> >>> > >> >>> >> >>> >> >>> >> >>> ------------------------------------------------------------------------------ >> >> >> >> >> >> >> >>> >> >>> Register Now & Save for Velocity, the Web Performance & Operations >> >>> Conference from O'Reilly Media. Velocity features a full day of >> >>> expert-led, hands-on workshops and two days of sessions from industry >> >>> leaders in dedicated Performance & Operations tracks. Use code >> >>> vel09scf >> >>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf >> >>> _______________________________________________ >> >>> Matplotlib-devel mailing list >> >>> Mat...@li... >> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >> >> >> >> > > >
Jae-Joon Lee <lee...@gm...> writes: > I don't see such any error and I'm not sure if the error is related > with my patch since the ps backend does not use dviread module. Darren didn't include the complete traceback, but it seems that dviread does get used by TexManager.get_text_width_height_descent unless the text.latex.preview parameter is set. So if preview.sty is available, setting the parameter might help with that particular problem. > On Thu, Apr 30, 2009 at 11:44 AM, Darren Dale <dsd...@gm...> wrote: >> File "/usr/lib64/python2.6/subprocess.py", line 1084, in _execute_child >> data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB >> OSError: [Errno 4] Interrupted system call I thought subprocess.el handled EINTR, but apparently not: http://bugs.python.org/issue1068268 I guess the reason why some people run into this and others don't is that (some) GUI toolkits make use of signals, and the probability of receiving a signal while reading from the subprocess pipe depends on various system-specific details. -- Jouni K. Seppänen http://www.iki.fi/jks