CINXE.COM
Statistical charts in R
<!DOCTYPE html> <html> <head> <!-- This page was last built at 2024-11-19 15:59 --> <meta charset="utf-8" /> <link rel="canonical" href="https://plotly.com/r/statistical-charts/" /> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@1,500&display=swap" rel="stylesheet" /> <!-- Media query magic - http://stackoverflow.com/questions/19945658/my-iphone-thinks-its-980px-wide --> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="/all_static/javascripts/algolia/instantsearch.js"></script> <script src="/all_static/javascripts/algolia/polyfill.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script> const theme = localStorage.getItem('theme'); if (theme === "dark-mode") { var root = document.getElementsByTagName('html')[0]; // '0' to assign the first (and only `HTML` tag) root.setAttribute('class', 'dark-mode'); } </script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" crossorigin="anonymous"> <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script> <link href="https://esm.sh/@markprompt/css@0.18.0?css" rel="stylesheet" /> <link href="/all_static/css/markprompt.css" rel="stylesheet" /> <!-- //// Stylesheets --> <!-- Fonts --> <link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic|Ubuntu+Mono:400,700|Asap" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" /> <!-- Main Stylesheets --> <link rel="stylesheet" type="text/css" href="/all_static/css/main.css?version=false" /> <link rel="stylesheet" type="text/css" href="/all_static/css/improve.css?version=2024-11-19-15-59"> <!-- LOCAL DEV STYLESHEET --> <!--<link rel="stylesheet" type="text/css" href="http://api.plotly.dev/all_static/css/main.css">--> <!-- Icon --> <link rel="shortcut icon" href="https://dash.plotly.com/assets/favicon.ico" /> <!-- Google Tags--> <!-- Google Tag Manager Tag --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-N6T2RXG');</script> <!-- META TAGS --> <!-- Capture language --> <!-- Create a title --> <!-- Count number of plots on the page --> <!-- SEO Tags - title, meta_description --> <title> Statistical charts in R </title> <meta name="description" content=Plotly's R graphing library makes interactive, publication-quality graphs online. Examples of how to make statistical charts.> <!-- Bing tags --> <meta name="msvalidate.01" content="D319859A832F9F1D15A7646E2A42150A" /> <!-- Facebook tags --> <meta property="og:title" content= Statistical charts in R /> <meta property="og:type" content="website"/> <meta property="og:image" content="https://images.plot.ly/plotly-documentation/thumbnail/mixed.jpg"> <meta property="og:description" content=Plotly's R graphing library makes interactive, publication-quality graphs online. Examples of how to make statistical charts./> <meta property="og:url" /> <meta property="fb:admins" content="1123751525"/> <meta property="fb:admins" content="22418"/> <!-- twitter tags --> <meta name="twitter:card" content="photo" /> <meta name="twitter:title" content= Statistical charts in R /> <meta name="twitter:url" content="https://plotly.com/r/statistical-charts/"/> <meta name="twitter:description" content=Plotly's R graphing library makes interactive, publication-quality graphs online. Examples of how to make statistical charts./> <meta name="twitter:image" content="https://images.plot.ly/plotly-documentation/thumbnail/mixed.jpg"> <meta name="twitter:site" content="@plotlygraphs"/> </head> <body class="darkmode"> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6T2RXG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <div class="menu-mobile"> <div class="switch-mode"> <div class="icon-dark"></div> <div class="switch"></div> <div class="icon-light"></div> </div> <div class="close-menu"></div> <ul> <li><a style="font-weight: bold;" href="https://community.plotly.com/c/plotly-r-matlab-julia-net/29">Forum</a> </li> <li><a style="font-weight: bold;" href="https://plotly.com/get-pricing/">Pricing</a></li> <li><a style="font-weight: bold;" href="https://dash.plotly.com">Dash</a></li> <!--<li><a style="font-weight: bold;" href="http://plotly.cloud">Dash Cloud</a></li>--> </ul> </div> <div class="header-container"> <header class="header-main --default"> <div class="--wrap"> <div class="--wrap-left"> <div class="-identity"> <a href="https://plotly.com/"><img src="/all_static/images/graphing_library_dark.svg" style="height: 30px;" class="logo-dark"></a> <a href="/graphing-libraries/"><img src="/all_static/images/graphing_library.svg" style="height: 30px;" class="logo-white"></a> </div> </div> <div class="--wrap-right"> <nav class="--nav-meta" role="navigation"> <ul> <li class="languages"> <a class="r"> <div class="icon"></div> R </a> <ul> <li> <a href="https://plotly.com/python/" class="python"> <div class="icon"></div>Python (v5.24.1) </a> </li> <li> <a href="https://plotly.com/r/" class="r"> <div class="icon"></div>R </a> </li> <li> <a href="https://plotly.com/julia/" class="julia"> <div class="icon"></div>Julia </a> </li> <li> <a href="https://plotly.com/javascript/" class="plotly_js"> <div class="icon"></div>Javascript (v2.35.2) </a> </li> <li> <a href="https://plotly.com/ggplot2/" class="ggplot2"> <div class="icon"></div>ggplot2 </a> </li> <li> <a href="https://plotly.com/matlab/" class="matlab"> <div class="icon"></div>MATLAB </a> </li> <li> <a href="https://plotly.com/fsharp/" class="fsharp"> <div class="icon"></div>F# </a> </li> <li> <a href="https://dash.plotly.com/" class="dash"> <div class="icon"></div>Dash </a> </li> </ul> </li> <li><a style="font-weight: bold;" href="https://community.plotly.com/c/plotly-r-matlab-julia-net/29">Forum</a> </li> <li><a style="font-weight: bold;" href="https://plotly.com/get-pricing/">Pricing</a></li> <li><a style="font-weight: bold;" href="https://dash.plotly.com">Dash</a></li> <!--<li><a style="font-weight: bold;" href="http://plotly.cloud">Dash Cloud</a></li>--> <iframe src="https://ghbtns.com/github-btn.html?user=plotly&repo=plotly.R&type=star&count=true&size=large" style="padding-top: 5px;" frameborder="0" scrolling="0" width="160px" height="40px"></iframe> </ul> <div class="switch-mode"> <div class="icon-dark"></div> <div class="switch"></div> <div class="icon-light"></div> </div> </nav> </div> <div class="menu-icon"> <span></span><span></span><span></span> </div> </div> </header> </div> <main class="--page page--single --index"> <div class="--wrap"> <!-- aside - Main Sidebar--> <!-- START OF GGPLOT CUSTOM LAYOUT --> <aside class="--sidebar-container"> <div class="--sidebar-fixed reference" data-spy="affix" id="where"> <div class="brand"> <a href="/graphing-libraries/"><img src="/all_static/images/graphing_library.svg" style="height: 30px;"></a> </div> <button id="modal-button" type="button" data-toggle="modal" data-target="#myModal"> <input id="modal-input" style="border-radius: 5px; width: 100%;" type="text" placeholder=" Search..." readonly /> </button> <details style="color: white;margin-top: 20px;" open > <summary>Quick Reference</summary> <nav class="--sidebar-body watch" id="where"> <ul class="--sidebar-list" style="margin-left: 15px;"> <!-- Getting Started --> <li class="--sidebar-item"> <a href="/r/getting-started" class="js-splash--navigation-item">Getting Started</a> </li> <li class="--sidebar-item"> <a href="/r/is-plotly-free" class="js-splash--navigation-item">Is Plotly Free?</a> </li> <!-- Reference Pages --> <li class="--sidebar-item"> <a href="/r/reference/index/" class="js-splash--navigation-item">Figure Reference</a> </li> <!-- Python Specific --> <!-- JS Specific --> <!-- R Specific --> <li class="--sidebar-item"> <a href="/ggplot2/" class="js-splash--navigation-item">ggplot2 integration</a> </li> <li class="--sidebar-item"> <a href="https://plotly.com/dash" class="js-splash--navigation-item">Dash for R</a> </li> <!-- Python/v3 Index Page Specific --> <!-- User Guides --> <!-- Github Links --> <li class="--sidebar-item"> <a target="_blank" href="https://github.com/plotly/plotly.R" class="js-splash--navigation-item">GitHub</a> </li> <li class="--sidebar-item"> <a target="_blank" href="http://community.plotly.com/" class="js-splash--navigation-item">community.plotly.com</a> </li> </ul> </nav> </details> <!-- Examples start --> <details style="color: white;margin-top: 20px;" open> <summary>Examples</summary> <nav class="--sidebar-body watch" id="where"> <ul class="--sidebar-list" style="margin-left: 15px;"> <li class="--sidebar-item"> <a href="/r/plotly-fundamentals/" class="js-splash--navigation-item">Fundamentals</a> </li> <li class="--sidebar-item"> <a href="/r/basic-charts/" class="js-splash--navigation-item">Basic Charts</a> </li> <li class="--sidebar-item"> <a href="/r/statistical-charts/" class="js-splash--navigation-item">Statistical Charts</a> </li> <li class="--sidebar-item"> <a href="/r/scientific-charts/" class="js-splash--navigation-item">Scientific Charts</a> </li> <li class="--sidebar-item"> <a href="/r/financial-charts/" class="js-splash--navigation-item">Financial Charts</a> </li> <li class="--sidebar-item"> <a href="/r/maps/" class="js-splash--navigation-item">Maps</a> </li> <li class="--sidebar-item"> <a href="/r/ai-ml/" class="js-splash--navigation-item">AI and ML</a> </li> <li class="--sidebar-item"> <a href="/r/3d-charts/" class="js-splash--navigation-item">3D Charts</a> </li> <li class="--sidebar-item"> <a href="/r/subplot-charts/" class="js-splash--navigation-item">Subplots</a> </li> <li class="--sidebar-item"> <a href="/r/#animations" class="js-splash--navigation-item">Animations</a> </li> <li class="--sidebar-item"> <a href="/r/#advanced-options" class="js-splash--navigation-item">Advanced</a> </li> <!-- START OF GGPLOT CUSTOM LAYOUT --> <!-- END OF GGPLOT CUSTOM LAYOUT --> </ul> </nav> </details> </div> <a href="https://go.plotly.com/dash-club?utm_source=Dash+Club+2022&utm_medium=graphing_libraries&utm_content=sidebar" target="_blank"> <img src="https://images.prismic.io/plotly-marketing-website-2/7953022d-73b1-481e-8f6b-9ce9bd80e588_Dash+Club.jpeg?auto=compress,format" style="width: 200px; height: 200px; position: fixed; bottom: 10px; left: 50px" alt="Sign up to Dash Club to get two free cheat sheets as well as tips and tricks, community apps, and deep dives delivered every two month"> </a> </aside> <!-- Main--> <section class="--page-body --tutorial-index"> <div class="nav-breadcrumb-container"> <div> <div class="breadcrumb-nav"> <a href="/r"> R </a> > <a href="/r/statistical-charts">Statistical Charts</a> </div> </div> </div> <!-- Start pulling content --> <header class="--welcome"> <div class="--welcome-body"> <!--div.--wrap-inner--> <div class="--title"> <div class="--body"> <h1>Plotly R Library Statistical Charts</h1> <p>Plotly's R graphing library makes interactive, publication-quality graphs online. Examples of how to make statistical charts.</p> <!-- <div class="db-client-lib"> <label> This page in another language </label> <div class="list-lib-wrap"> <div class="list-lib"> <a href=" /matlab/statistical-charts/" class="list-lib-item matlab"> <div class="item-icon"> </div> <p class="item-language"> MATLAB® </p> </a> <a href=" /julia/statistical-charts/" class="list-lib-item julia"> <div class="item-icon"> </div> <p class="item-language"> Julia </p> </a> <a href=" /ggplot2/statistical-charts/" class="list-lib-item ggplot2"> <div class="item-icon"> </div> <p class="item-language"> ggplot2 </p> </a> <a href=" /fsharp/statistical-charts/" class="list-lib-item fsharp"> <div class="item-icon"> </div> <p class="item-language"> F# </p> </a> <a href=" /csharp/statistical-charts/" class="list-lib-item csharp"> <div class="item-icon"> </div> <p class="item-language"> C# </p> </a> <a href=" /python/statistical-charts/" class="list-lib-item python"> <div class="item-icon"> </div> <p class="item-language"> Python </p> </a> <a href=" /r/statistical-charts/" class="current list-lib-item r"> <div class="item-icon"> </div> <p class="item-language"> R </p> </a> </div> </div> </div> --> <div class="dash-plug"> <p>Deploy R AI Dash apps on private Kubernetes clusters: <a href="/get-pricing/">Pricing</a> | <a href="/get-demo/">Demo</a> | <a href="/dash/">Overview</a> | <a href="/consulting-and-oem/">AI App Services</a> </p> </div> </div> </div> </div> </header> <section class="--tutorial-section" id="statistical-charts"> <header class="--section-header"> </header> <section class="--grid"> <ul class="--grid-list"> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/histogram2d.jpg);" class="--grid-item"> <a href="/r/2D-Histogram/"> <div class="--item-meta"><span>2D Histograms</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/histogram2d.jpg" alt="2D Histograms"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/box.jpg);" class="--grid-item"> <a href="/r/box-plots/"> <div class="--item-meta"><span>Box Plots</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/box.jpg" alt="Box Plots"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/histogram.jpg);" class="--grid-item"> <a href="/r/histograms/"> <div class="--item-meta"><span>Histograms</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/histogram.jpg" alt="Histograms"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/error-bar.jpg);" class="--grid-item"> <a href="/r/error-bars/"> <div class="--item-meta"><span>Error Bars</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/error-bar.jpg" alt="Error Bars"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/violin.jpg);" class="--grid-item"> <a href="/r/violin/"> <div class="--item-meta"><span>Violin Plots</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/violin.jpg" alt="Violin Plots"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/hist2dcontour.png);" class="--grid-item"> <a href="/r/2d-histogram-contour/"> <div class="--item-meta"><span>2D Histogram Contour</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/hist2dcontour.png" alt="2D Histogram Contour"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/splom_image.jpg);" class="--grid-item"> <a href="/r/splom/"> <div class="--item-meta"><span>Splom</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/splom_image.jpg" alt="Splom"> </div> </a> </li> <li style="background-image: url(https://images.plot.ly/plotly-documentation/thumbnail/distplot.jpg);" class="--grid-item"> <a href="/r/distplot/"> <div class="--item-meta"><span>Distplots</span></div> <div class="--item-image"> <span>View Tutorial</span> <img src="https://images.plot.ly/plotly-documentation/thumbnail/distplot.jpg" alt="Distplots"> </div> </a> </li> </ul> </section> </section> <!-- START OF GGPLOT CUSTOM LAYOUT --> <!-- Aesthetics --> <!-- Geoms --> <!-- Faceting --> <!-- Other --> <!-- theme --> <!-- END OF GGPLOT CUSTOM LAYOUT --> <!--End content --> </section> </div> </main> <footer class="--footer-main"> <section class="--footer-top"> <div class="--wrap"> <ul class="--footer-body"> <li class="--footer-column"> <h6 style="color:#119dff" class="--footer-heading">JOIN OUR MAILING LIST</h6>			 <ul> 				 <li> <p class="subscribe-text"> Sign up to stay in the loop with all things Plotly — from Dash Club to product updates, webinars, and more!</p> <a href="https://go.plot.ly/subscription" class="subscribe-button" target="_blank"> Subscribe </a> </li> </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#e763fa" class="--footer-heading">Products</h6>			 <ul> <li><a href="https://plotly.com/dash/" target="_self">Dash</a></li> 				 				 <li><a href="https://plotly.com/consulting-and-oem/" target="_self">Consulting and Training</a></li> </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#636efa" class="--footer-heading">Pricing</h6>			 <ul> <li><a href="https://plotly.com/get-pricing/" target="_self">Enterprise Pricing</a></li> 				 </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#00cc96" class="--footer-heading">About Us</h6>			 <ul> <li><a href="https://plotly.com/careers" target="_self">Careers</a></li> 				 <li><a href="https://plotly.com/resources/" target="_self">Resources</a></li> 				 <li><a href="https://medium.com/@plotlygraphs" target="_self">Blog</a></li> 				 </ul> </li> 		 <li class="--footer-column"> <h6 style="color:#EF553B" class="--footer-heading">Support</h6>			 <ul> <li><a href="https://community.plot.ly/" target="_self">Community Support</a></li> 				 <li><a href="https://plotly.com/graphing-libraries" target="_self">Documentation</a></li> 				 </ul> </li> </ul> </div> </section> <section class="--footer-meta"> <div class="--wrap"> <div class="left"> <article class="--copyright">Copyright © 2024 Plotly. All rights reserved.</article> </div> <div class="right"> <article class="--tos"><a href="https://community.plotly.com/tos" target="_blank">Terms of Service</a> </article> <article class="--privacy"><a href="https://plotly.com/privacy/" target="_blank">Privacy Policy</a> </article> </div> </div> <div id="markprompt" /> </section> </footer> <div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content" id="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <span style="float: left; padding-top:13px; padding-right:10px;"><i class="fa fa-search fa-lg"></i></span> <input id="search-input" class="search-input" type="text" placeholder="" /> </div> <div class="modal-body" id="modal-body"> <div id="search-results" class="search-results"> <div id="primary-search-results" class="primary-search-results"></div> <div id="schema-search-results" class="schema-search-results"></div> </div> </div> </div> </div> </div> <script> window.plotly_doc_language = "r"; </script> <!-- ALGOLIA SEARCH --> <script> window.ALGOLIA_CONFIG = { 'applicationId': '7EK9KHJW8M', 'indexName': 'r_docs', 'apiKey': '4dae07ded6a721de73bde7356eec9280', 'baseurl': '/' } </script> <script id="algolia__template" type="text/template"> <div class="algolia__result"> <a class="algolia__result-link" onClick="$('#myModal').modal('toggle')" href="/{{ permalink }}">{{{ _highlightResult.name.value }}}</a> <div class="algolia__result-text">{{{ _highlightResult.description.value }}}</div> </div> </script> <script id="algolia__secondary-template" type="text/template"> <div class="algolia__secondary-result"> <a class="algolia__result-link" onClick="$('#myModal').modal('toggle')" href="/{{ permalink }}">{{{ _highlightResult.name.value }}}</a> <div class="algolia__result-text">{{{ _highlightResult.description.value }}}</div> </div> </script> <script id="algolia__template--no-results" type="text/template">No results found.</script> <script src="//cdn.jsdelivr.net/hogan.js/3.0.2/hogan.min.js"></script> <script src="/all_static/javascripts/algolia/algolia.js"></script> <!-- Hash offset Script --> <script src="/all_static//javascripts/hash_offset.js"></script> <!-- Image Hover Script --> <script src="/all_static/javascripts/imghover.js"></script> <script src="/all_static/javascripts/improve.js?version=2024-11-19-15-59"></script> <!-- code highlighting --> <!--<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script> <script src="/all_static/javascripts/highlight.line-numbers.js"></script>--> <script src="/all_static/javascripts/highlight/highlight.min.js"></script> <script src="/all_static/javascripts/highlight/julia.min.js"></script> <script src="/all_static/javascripts/highlight.line-numbers.js"></script> </body> </html>