<style type="text/css">
    /* Add Social Bookmars Plugin By Aditya Subawa @ www.adityawebs.com */
    ul.aditya-social { list-style:none; margin:15px auto;display:inline-block; }
    ul.aditya-social li { display:inline; float:left; background-repeat:no-repeat; }
    ul.aditya-social li a { display:block; width:48px; height:48px; padding-right:10px; position:relative; text-decoration:none; }
    ul.aditya-social li a strong { font-weight:normal; position:absolute; left:20px; top:-1px; color:#fff; padding:3px; z-index:9999; text-shadow:1px 1px 0 rgba(0, 0, 0, 0.75); background-color:rgba(0, 0, 0, 0.7); -moz-border-radius:3px; -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); -webkit-border-radius:3px; -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); border-radius:3px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);}
    ul.aditya-social li.aditya-facebook { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/facebook.png"); }
    ul.aditya-social li.aditya-twitter { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/twitter.png"); }
    ul.aditya-social li.aditya-stumbleupon { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/stumbleupon.png"); }
    ul.aditya-social li.aditya-digg { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/digg.png"); }
    ul.aditya-social li.aditya-delicious { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/delicious.png"); }
    ul.aditya-social li.aditya-yahoo { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/yahoo.png"); }
    ul.aditya-social li.aditya-reddit { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/reddit.png"); }
    ul.aditya-social li.aditya-technorati { background-image:url("/wp-content/plugins/wp-add-socialbookmarks/images/technorati.png"); }
    #aditya-cssanime:hover li { opacity:0.2; }
    #aditya-cssanime li { -webkit-transition-property: opacity; -webkit-transition-duration: 500ms;-moz-transition-property: opacity; -moz-transition-duration: 500ms; }
    #aditya-cssanime li a strong { opacity:0; -webkit-transition-property: opacity, top; -webkit-transition-duration: 300ms; -moz-transition-property: opacity, top; -moz-transition-duration: 300ms; }
    #aditya-cssanime li:hover { opacity:1; }
    #aditya-cssanime li:hover a strong { opacity:1; top:-10px; }
    /* Add Social Bookmarks Plugins By Aditya Subawa @ www.adityawebs.com */
    </style>

{"id":1202,"date":"2012-12-11T22:08:47","date_gmt":"2012-12-11T22:08:47","guid":{"rendered":"http:\/\/johncanning.net\/wordpress\/?p=1202"},"modified":"2016-02-22T23:29:46","modified_gmt":"2016-02-22T23:29:46","slug":"normal-distribution-curve-in-latex","status":"publish","type":"post","link":"http:\/\/johncanning.net\/wp\/?p=1202","title":{"rendered":"Normal distribution curve in LaTeX"},"content":{"rendered":"<p><span style=\"color: #ff0000;\">Amended: 22 February 2016: There were a couple of errors in the code which I have now fixed. The previous code omitted the need for the xcolor package and the some coding items symbols (notably '\\' were missing).<\/span><br \/>\nI have been searching the internet on how to produce a normal distribution curve in LaTeX with the standard deviations marked. I wasn't able to find exactly what I wanted, but got some good clues <a title=\"Bell curve\" href=\"http:\/\/tex.stackexchange.com\/questions\/43610\/plotting-bell-shaped-curve-in-tikz-pgf\">here<\/a>.\u00a0 This code uses the pgfplots package. The code should work 'as is'.<\/p>\n<table style=\"width: 686px; height: 31px;\" border=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<dl id=\"attachment_1203\">\n<dt><a href=\"http:\/\/johncanning.net\/wp\/wp-content\/uploads\/2012\/12\/normal-distribution-latex.png\"><img loading=\"lazy\" decoding=\"async\" title=\"normal distribution latex\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/uploads\/2012\/12\/normal-distribution-latex.png\" alt=\"Normal distribution diagram in LaTeX (Using Pgfplots package)\" width=\"309\" height=\"265\" \/><\/a><\/dt>\n<\/dl>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code><br \/>\n\\documentclass{article}<br \/>\n\\usepackage{pgfplots}<br \/>\n\\usepackage{amssymb, amsmath}<br \/>\n\\usepackage{tikz}<br \/>\n\\usepackage{xcolor}<br \/>\n\\pgfplotsset{compat=1.7}<br \/>\n\\begin{document}<br \/>\n\\pgfmathdeclarefunction{gauss}{2}{\\pgfmathparse{1\/(#2*sqrt(2*pi))*exp(-((x-#1)^2)\/(2*#2^2))}%<br \/>\n}<br \/>\n\\begin{tikzpicture}<br \/>\n\\begin{axis}[no markers, domain=0:10, samples=100,<br \/>\naxis lines*=left, xlabel=Standard deviations, ylabel=Frequency,,<br \/>\nheight=6cm, width=10cm,<br \/>\nxtick={-3, -2, -1, 0, 1, 2, 3}, ytick=\\empty,<br \/>\nenlargelimits=false, clip=false, axis on top,<br \/>\ngrid = major]<br \/>\n\\addplot [fill=cyan!20, draw=none, domain=-3:3] {gauss(0,1)} \\closedcycle;<br \/>\n\\addplot [fill=orange!20, draw=none, domain=-3:-2] {gauss(0,1)} \\closedcycle;<br \/>\n\\addplot [fill=orange!20, draw=none, domain=2:3] {gauss(0,1)} \\closedcycle;<br \/>\n\\addplot [fill=blue!20, draw=none, domain=-2:-1] {gauss(0,1)} \\closedcycle;<br \/>\n\\addplot [fill=blue!20, draw=none, domain=1:2] {gauss(0,1)} \\closedcycle;<br \/>\n\\addplot[] coordinates {(-1,0.4) (1,0.4)};<br \/>\n\\addplot[] coordinates {(-2,0.3) (2,0.3)};<br \/>\n\\addplot[] coordinates {(-3,0.2) (3,0.2)};<br \/>\n\\node[coordinate, pin={68.2\\%}] at (axis cs: 0, 0.4){};<br \/>\n\\node[coordinate, pin={95\\%}] at (axis cs: 0, 0.3){};<br \/>\n\\node[coordinate, pin={99.7\\%}] at (axis cs: 0, 0.2){};<br \/>\n\\node[coordinate, pin={34.1\\%}] at (axis cs: -0.5, 0){};<br \/>\n\\node[coordinate, pin={34.1\\%}] at (axis cs: 0.5, 0){};<br \/>\n\\node[coordinate, pin={13.6\\%}] at (axis cs: 1.5, 0){};<br \/>\n\\node[coordinate, pin={13.6\\%}] at (axis cs: -1.5, 0){};<br \/>\n\\node[coordinate, pin={2.1\\%}] at (axis cs: 2.5, 0){};<br \/>\n\\node[coordinate, pin={2.1\\%}] at (axis cs: -2.5, 0){};<br \/>\n\\end{axis}<br \/>\n\\end{tikzpicture}<br \/>\n\\end{document}<br \/>\n<\/code><\/p>\n\n\n<ul class=\"aditya-social\" id=\"aditya-cssanime\">\n<li class=\"aditya-twitter\"><a href=\"http:\/\/twitter.com\/share?url=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202&amp;url=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202\" target=\"_blank\" rel=\"nofollow\" title=\"Twitter\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/twitter.png\" alt=\"Twitter\" title=\"Twitter\" \/><\/a><\/li>\n<li class=\"aditya-delicious\"><a href=\"http:\/\/del.icio.us\/post?url=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202&amp;title=Normal+distribution+curve+in+LaTeX\" target=\"_blank\" rel=\"nofollow\" title=\"del.icio.us\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/delicious.png\" alt=\"del.icio.us\" title=\"del.icio.us\" \/><\/a><\/li>\n<li class=\"aditya-digg\"><a href=\"http:\/\/digg.com\/submit?phase=2&amp;url=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202&amp;title=Normal+distribution+curve+in+LaTeX\" target=\"_blank\" rel=\"nofollow\" title=\"Digg\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/digg.png\" alt=\"Digg\" title=\"Digg\" \/><\/a><\/li>\n<li class=\"aditya-facebook\"><a href=\"http:\/\/facebook.com\/sharer.php?u=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202&amp;t=Normal+distribution+curve+in+LaTeX\" target=\"_blank\" rel=\"nofollow\" title=\"Facebook\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/facebook.png\" alt=\"Facebook\" title=\"Facebook\" \/><\/a><\/li>\n<li class=\"aditya-technorati\"><a href=\"http:\/\/technorati.com\/faves?add=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202\" target=\"_blank\" rel=\"nofollow\" title=\"Technorati\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/technorati.png\" alt=\"Technorati\" title=\"Technorati\" \/><\/a><\/li>\n<li class=\"aditya-reddit\"><a href=\"http:\/\/reddit.com\/submit?url=Normal+distribution+curve+in+LaTeX&amp;u=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202\" target=\"_blank\" rel=\"nofollow\" title=\"Reddit\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/reddit.png\" alt=\"Reddit\" title=\"Reddit\" \/><\/a><\/li>\n<li class=\"aditya-yahoo\"><a href=\"http:\/\/buzz.yahoo.com\/submit?submitUrl=Normal+distribution+curve+in+LaTeX&amp;u=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202\" target=\"_blank\" rel=\"nofollow\" title=\"Yahoo Buzz\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/yahoo.png\" alt=\"Yahoo Buzz\" title=\"Yahoo Buzz\" \/><\/a><\/li>\n<li class=\"aditya-stumbleupon\"><a href=\"http:\/\/stumbleupon.com\/submit?url=http%3A%2F%2Fjohncanning.net%2Fwp%2F%3Fp%3D1202&amp;title=Normal+distribution+curve+in+LaTeX&amp;newcomment=Normal+distribution+curve+in+LaTeX\" target=\"_blank\" rel=\"nofollow\" title=\"StumbleUpon\"><img decoding=\"async\" src=\"http:\/\/johncanning.net\/wp\/wp-content\/plugins\/wp-add-social-bookmarks\/images\/stumbleupon.png\" alt=\"StumbleUpon\" title=\"StumbleUpon\" \/><\/a><\/li>\n<\/ul>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Amended: 22 February 2016: There were a couple of errors in the code which I have now fixed. The previous code omitted the need for the xcolor package and the some coding items symbols (notably '\\' were missing). I have been searching the internet on how to produce a normal distribution curve in LaTeX with &hellip; <a href=\"http:\/\/johncanning.net\/wp\/?p=1202\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Normal distribution curve in LaTeX<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,66],"tags":[],"class_list":["post-1202","post","type-post","status-publish","format-standard","hentry","category-latex","category-statistics"],"_links":{"self":[{"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1202"}],"version-history":[{"count":3,"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1202\/revisions"}],"predecessor-version":[{"id":2234,"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1202\/revisions\/2234"}],"wp:attachment":[{"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1202"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/johncanning.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}