Dear Atakan (and all),

 I tried it, but still got an error :-(. *My code is:*

from pyx import *
from pylab import *
from pyx import text as pyxtext
pyxtext.set(mode='latex')
pyxtext.preamble(r'\usepackage{mathabx}')
x=arange(1,5,0.1)
y=exp(-(x-3.0)**2/(2.0*0.5**2))/sqrt(2.0*pi*0.5**2)
###################### Let's pyx this!
g=graph.graphxy(width=8,y=graph.axis.linear(title=r"Fraction of DM
halos"),x=graph.axis.linear(min=1,title=r"Mass ($10^{11}M_{\sun}$)"))
g.plot(graph.data.values(x=x,y=y),styles=[graph.style.histogram()])
g.writeEPSfile("testhistogram")

* And the error is:*

pyx.text.TexResultError: unhandled TeX response (might be an error)
The expression passed to TeX was:
  \ProcessPyXBox{\setbox0\hbox{$\vcenter{\vrule
width0pt}$}\PyXDimenVShift=\ht0\setbox0\hbox{{\gdef\PyXBoxHAlign{0.50000}\gdef\PyXFlushHAlign{0.50000}\PyXragged{}Mass
($10^{11}M_{\sun}$)}}\lower\PyXDimenVShift\box0%
  }{12}%
  \PyXInput{17}%
After parsing the return message from TeX, the following was left:
  *
  *! Undefined control sequence.
  <argument> ...}\PyXragged {}Mass ($10^{11}M_{\sun
                                                    }$)}}\lower
\PyXDimenVShif...
  <*> }{12}
  (cut after 5 lines, increase errordebug for more output)


2012/9/19 M Atakan Gurkan <[email protected]>

> Sorry replied personally. Now forwarding to the list.
>
> a.
>
> ---------- Forwarded message ----------
> From: M Atakan Gurkan <[email protected]>
> Date: Wed, Sep 19, 2012 at 11:18 PM
> Subject: Re: [PyX-user] How to do the astronomical symbol “\sun” in PyX?
> To: Néstor Espinoza <[email protected]>
>
>
> Dear Néstor,
>
> Your "import *" from pylab is conflicting with pyx.text. You need to
> import that explicitly, e.g.,
> from pyx import *
> from pylab import *
> from pyx import text as pyxtext
>
> pyxtext.set(mode='latex')
> pyxtext.preamble(r'\usepackage{...}')
>
> etc.
>
> I would avoid "from .. import *" all together unless this will require
> too many changes.
>
> cheers,
>
> atakan
>
> On Wed, Sep 19, 2012 at 10:33 PM, Néstor Espinoza
> <[email protected]> wrote:
> > Hello!,
> >
> >  I posted this same question on Stackexchange, but I had no success with
> the
> > answer. I've been trying to put the astronomical symbol of the sun on a
> > graph using PyX, but so for with no success. The code I have is the
> > following:
> >
> >
> > from pyx import *
> >
> >
> >  from pylab import *
> >
> >
> >  x=arange(1,5,0.1)
> >
> >
> >  y=exp(-(x-3.0)**2/(2.0*0.5**2))/sqrt(2.0*pi*0.5**2)
> >
> >
> >  ######################
> >  g=graph.graphxy(width=8,y=graph.axis.linear(title=r"Fraction of DM
> > halos"),x=graph.axis.linear(min=1,title=r"Mass ($10^{11}M_{\sun}$)"))
> >
> >
> >  g.plot(graph.data.values(x=x,y=y),styles=[graph.style.histogram()])
> >
> >
> >  g.writeEPSfile("testhistogram")
> >
> >
> > I tried adding text.set(mode="latex") followed
> > bytext.preamble("\usepackage{mathabx}"), but this doesn't work (because I
> > know this symbol is on the mathabx LaTeX package). Any ideas?
> >
> > --
> > Néstor
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > PyX-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/pyx-user
> >
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user
>



-- 
Néstor
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to