Does anyone already know what causes the problem with the fill_between and the 
eps output?

/johannes


-------- Original-Nachricht --------
> Datum: Thu, 12 May 2011 17:10:43 +0200
> Von: Johannes Radinger <jradin...@gmx.at>
> An: John Hunter <jdh2...@gmail.com>
> CC: matplotlib-users@lists.sourceforge.net
> Betreff: Re: [Matplotlib-users] eps output and fill_between

> Hello again,
> 
> I tried the script you provided to test the PolyCollection and that works
> fine.
> I am working under Mac OS X 10.6.6 Snow Leopard and use matplotlib 1.0.1.
> 
> That is the script where I fail with eps but not with pdf:
> 
> 
> 
> import matplotlib.pyplot as plt
> import numpy
> from scipy import stats
> 
> p=0.3
> m=0
> s1min=120
> s1max=140
> s2min=1200
> s2max=1600
> 
> x = numpy.arange((s2max*-1.5), (s2max*1.5), 0.2)
> 
> def pdf(x,s1,s2):
>     return p * stats.norm.pdf(x, loc=m, scale=s1) + (1-p) *
> stats.norm.pdf(x, loc=m, scale=s2)
> 
> 
> pdf_min = pdf(x,s1min,s2min)
> pdf_max = pdf(x,s1max,s2max)
> 
> plt.plot(x, pdf_min, x, pdf_max, color="k")
> plt.fill_between(x, pdf_min, pdf_max, color='0.85')
> 
> 
> #plt.show()
> #plt.savefig("testplot.eps")
> plt.savefig("testplot.pdf")
> 
> 
> /Johannes
> 
> Am 12.05.2011 um 15:28 schrieb John Hunter:
> 
> > 
> > 
> > On Thu, May 12, 2011 at 3:42 AM, Johannes Radinger <jradin...@gmx.at>
> wrote:
> > Hello ,
> > 
> > sofar I know how to safe a plot into a *.eps file and it works good,
> > but there is one issue with filled areas between two functions.
> > 
> > When I try to use:
> > plt.fill_between(x, pdf_min, pdf_max, color='0.85')
> > 
> > and I try to open it on my mac I fail. So far as I know
> > is the mac converting the eps internally to pdf to be
> > displayed, but it seems it can't be converted.
> > 
> > If I try to set the output to *.pdf it works perfectly and I can
> > open the file. Something in the combination of fill_between
> > and eps is causing the error. I tried also color="red" but with
> > the same problems.
> > 
> > Is there anything I've to set because I need the output as
> > a working eps.
> > 
> > 
> > under the hool, fill_between uses a PolyCollection.  Below is a simple
> example which uses a PolyCollection directly.  Does this crash when you
> convert eps -> pdf.  If not, maybe we can hone in on what is special about the
> vertices in your fill_between example.  Also, you should give us some
> information about what version of matplotlib and OSX you are running.
> > 
> > 
> > import numpy as np
> > import matplotlib.collections as mcollections
> > import matplotlib.pyplot as plt
> > 
> > theta = np.linspace(0, 2*np.pi, 20)
> > x1 = np.cos(theta)
> > y1 = np.sin(theta)
> > 
> > x2 = x1 + 5
> > y2 = y1 + 5
> > 
> > verts1 = zip(x1, y1)
> > verts2 = zip(x2, y2)
> > 
> > c = mcollections.PolyCollection([verts1, verts2], facecolors=['red',
> 'green'])
> > 
> > ax = plt.subplot(111)
> > ax.add_collection(c)
> > ax.axis([-5, 10, -5, 10])
> > 
> > plt.savefig('test.eps')
> > plt.show()
> > 
> 

-- 
Ihr GMX Postfach immer dabei: die kostenlose GMX Mail App für Android.
Komfortabel, sicher und schnell: www.gmx.de/android

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to