Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Normal distribution curve diagram in Latex?

308 views
Skip to first unread message

Bob

unread,
Oct 23, 2005, 4:45:07 PM10/23/05
to
Hi!

This question must have come up a thousand times but I don't find the
answer:
Is there a way to get a diagram of a simple normal distribution curve
in plain LaTeX (i.e. without including an external graphics file)?

Thanks a lot in advance,
Bob

Fabian Kurz

unread,
Oct 23, 2005, 5:17:14 PM10/23/05
to
Bob wrote:
> This question must have come up a thousand times but I don't find the
> answer:
> Is there a way to get a diagram of a simple normal distribution curve
> in plain LaTeX (i.e. without including an external graphics file)?

If a 'thumbsketch' is sufficient, you can quickly do it in the
picture environment:

\documentclass{article}
\begin{document}
\begin{picture}(140,95)
\put(30,10){\vector(0,1){85}}
\put(0,15){\vector(1,0){145}}
\qbezier(0,17)(20,20)(40,35)
\qbezier(40,35)(55,45)(65,45)
\qbezier(65,45)(75,45)(90,35)
\qbezier(90,35)(110,20)(130,17)
\put(130,34){\makebox(0,0)[r]{$\varphi(x)$}}
\put(85,75){\makebox(0,0)[r]{$\Phi(x)$}}
\multiput(45,14)(40,0){2}{\multiput(0,0)(0,4){6}{\line(0,1){2}}}
\multiput(65,14)(0,4){8}{\line(0,1){2}}
\put(45,12){\makebox(0,0)[tc]{$\scriptstyle\mu-\sigma$}}
\put(65,12){\makebox(0,0)[tc]{$\scriptstyle\mu\vphantom{-sigma}$}}
\put(85,12){\makebox(0,0)[tc]{$\scriptstyle\mu+\sigma$}}
\put(138,12){\makebox(0,0)[tc]{$x$}}
\qbezier(0,17)(20,20)(65,55)
\qbezier(65,55)(100,80)(125,80)
\put(29,80){\line(1,0){2}}
\put(27,80){\makebox(0,0)[r]{$1$}}
\end{picture}
\end{document}

[Found this in my lecture notes]

If it has to be mathematically exact, you could export it from
GNUplot into the LaTeX picture environment (which results in a
very big and unreadable file though) or have a look at pst-plot
(see http://tug.org/PSTricks/ for reference).

HTH,
--
Fabian Kurz, DJ1YFK * Dresden, Germany * http://fkurz.net/

Bob

unread,
Oct 23, 2005, 6:34:38 PM10/23/05
to
Thanks Fabian,

this is accurate enough for my purposes.

Best,
Bob

William Park

unread,
Oct 24, 2005, 12:28:54 AM10/24/05
to
Bob <frot...@yahoo.com> wrote:
> Hi!
>
> This question must have come up a thousand times but I don't find the
> answer:
> Is there a way to get a diagram of a simple normal distribution curve
> in plain LaTeX (i.e. without including an external graphics file)?

I use PiCTeX for those kind of thing. It's not strictly LaTeX, but it's
TeX macros.

--
William Park <openge...@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/

Troy Henderson

unread,
Oct 24, 2005, 7:02:14 AM10/24/05
to
Is there some reason that you're against including external graphics?
MetaPost creates graphics that "belong" in (La)TeX files.

R.H. Allen

unread,
Oct 24, 2005, 1:44:29 PM10/24/05
to
Bob wrote:
> Hi!
>
> This question must have come up a thousand times but I don't find the
> answer:
> Is there a way to get a diagram of a simple normal distribution curve
> in plain LaTeX (i.e. without including an external graphics file)?

If you use pstricks, the pst-func package has a \psGauss command that
should fit the bill.

alan

David Lloyd Geering

unread,
Oct 24, 2005, 4:41:58 PM10/24/05
to

Is there anything PSTricks can't do? I use it in just about everything I
typeset.

DG.

Herbert Voss

unread,
Oct 24, 2005, 4:37:15 PM10/24/05
to
David Lloyd Geering wrote:

>> If you use pstricks, the pst-func package has a \psGauss command that
>> should fit the bill.
>>
>> alan
>
>
> Is there anything PSTricks can't do? I use it in just about everything I
> typeset.

I am working on it, but is very difficult to
implement the "coffee-making-part" .... :-)

Herbert


--
http://TeXnik.de/
http://PSTricks.tug.org/
ftp://ftp.dante.de/tex-archive/info/math/voss/mathmode/Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes

Bob

unread,
Oct 25, 2005, 7:50:05 AM10/25/05
to
PSTricks sounds very useful. Could somebody provide an example used for
confidence intervals with normals for lecture notes? That would be very
helpful!

Thanks a million for all your answers,
Bob

Hendrik Maryns

unread,
Oct 25, 2005, 8:25:27 AM10/25/05
to
Bob schreef:

Browse around in http://pstricks.de

--
Hendrik Maryns

==================
www.lieverleven.be
http://aouw.org

Bob

unread,
Oct 25, 2005, 10:14:03 AM10/25/05
to
Thanks Hendrik!

The reason why I am searching for this is that I am doing tutorials for
statistics. The great thing about LaTeX is that it is so easy to write
down formulas. It would be great if I could write down curves equally
easy and manipulate them with a few corrections for the particular
question. I thought if somebody has an example it would be easier to
learn from that because what I would need is the curve and lines in the
diagram, maybe shaded areas. Sometimes there is just some package
exactly doing what you are searching for but finding it is the
problem...

Thanks,
Bob

Morten Høgholm

unread,
Oct 25, 2005, 10:17:00 AM10/25/05
to

Yes, that can be a problem sometimes. I remember what I did some years
ago: Had a complete MiKTeX install and started looking through the
documentation tree...

Fortunately much better alternatives are available today. See
<http://texcatalogue.sarovar.org/bytopic.html> for instance.
--
Morten

greg...@ihc.com

unread,
Oct 25, 2005, 11:34:38 AM10/25/05
to
You might want to look at Sweave
(http://www.ci.tuwien.ac.at/~leisch/Sweave).

This lets you write a document using standard LaTeX, but insert R code
for graphs and analyses. Sweave then replaces all the R code with the
corresponding output (taking care of inserting graphs automatically).

This gives you the convienience of keeping the source all in one file,
the great markup abilities of LaTeX, and the statistical graphs and
functions of R.

Hope this helps,

0 new messages