CINXE.COM
Bar charts in MATLAB
<!DOCTYPE html> <html> <head> <!-- This page was last built at 2025-03-21 13:39 --> <meta charset="utf-8" /> <link rel="canonical" href="https://plotly.com/matlab/bar-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" /> <!-- code highlighting --> <!-- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script> <script> hljs.initHighlightingOnLoad(); </script>--> <!-- Mathjax --> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script> <!-- Plotly.js --> <script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script> <!-- //// Stylesheets --> <style> .mcode { border: 1px solid #cfcfcf; border-radius: 2px; background: #f7f7f7; padding: 10px; } </style> <!-- 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=2025-03-21-13-39"> <!-- 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> Bar charts in MATLAB </title> <meta name="description" content="Over 19 examples of Bar Charts including changing color, size, log axes, and more in MATLAB."> <!-- Bing tags --> <meta name="msvalidate.01" content="D319859A832F9F1D15A7646E2A42150A" /> <!-- Facebook tags --> <meta property="og:title" content= Bar charts in MATLAB /> <meta property="og:type" content="website"/> <meta property="og:image" content="https://help.plot.ly/images/twitter-default.png"> <meta property="og:description" content="Over 19 examples of Bar Charts including changing color, size, log axes, and more in MATLAB."/> <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= Bar charts in MATLAB /> <meta name="twitter:url" content="https://plotly.com/matlab/bar-charts/"/> <meta name="twitter:description" content="Over 19 examples of Bar Charts including changing color, size, log axes, and more in MATLAB."/> <meta name="twitter:image" content="https://help.plot.ly/images/twitter-default.png"> <meta name="twitter:site" content="@plotlygraphs"/> </head> <body data-spy="scroll" data-target=".watch" style="position:relative;" 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) --> <!--[if lt IE 10]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <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="matlab"> <div class="icon"></div> MATLAB® </a> <ul> <li> <a href="https://plotly.com/python/" class="python"> <div class="icon"></div>Python (v6.0.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 (v3.0.1) </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_matlab&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> <details style="color: white;margin-top: 20px;" > <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="/matlab/getting-started" class="js-splash--navigation-item">Getting Started</a> </li> <li class="--sidebar-item"> <a href="/matlab/is-plotly-free" class="js-splash--navigation-item">Is Plotly Free?</a> </li> <!-- Reference Pages --> <li class="--sidebar-item"> <a href="/matlab/reference/index/" class="js-splash--navigation-item">Figure Reference</a> </li> <!-- Python Specific --> <!-- JS Specific --> <!-- R Specific --> <!-- Python/v3 Index Page Specific --> <!-- User Guides --> <li class="--sidebar-item"> <a href="/matlab/user-guide/" class="js-splash--navigation-item">User Guide</a> </li> <!-- Github Links --> <li class="--sidebar-item"> <a target="_blank" href="https://github.com/plotly/plotly-graphing-library-for-matlab" 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> <details style="color: white;margin-top: 20px;" open> <summary>On This Page</summary> <nav class="--sidebar-body watch" id="where"> <ul class="--sidebar-list" id="nav_header_insertion_list"></ul> </nav> </details> </div> <a href="https://go.plotly.com/elevate-your-analytics?utm_source=Webinar:%20Dash%20Enterprise%205.7&utm_medium=graphing_libraries&utm_content=sidebar" target="_blank"> <img src="https://images.prismic.io/plotly-marketing-website-2/Z9mL0DiBA97Gimoh_Square_ads.jpg?auto=format,compress" style="width: 200px; height: 200px; position: fixed; bottom: 10px; left: 50px" alt="Sign up for the upcoming webinar: Elevate Your Analytics with Plotly Dash Enterprise 5.7"> </a> </aside> <!-- Main--> <section class="--page-body --tutorial-index --base"> <header class="--welcome"> <div class="--welcome-body"> <!--div.--wrap-inner--> <div class="--title"> <div class="--body"> <div class="nav-breadcrumb-container"> <div> <div class="breadcrumb-nav"> <a href="/matlab"> MATLAB<sup>®</sup> </a> > <a href="/matlab/basic-charts">Basic Charts</a> > <span>Bar Charts</span> </div> </div> <div class="nav-breadcrumb-right"> <div class="--fork"> <a id="forklink" href= "https://github.com/plotly/graphing-library-docs/edit/master/_posts/matlab/md/2021-08-04-bar-charts.md" > <div class="icon"> <svg style="width:20px;height:20px" viewbox="0 0 24 24"> <path fill="#000000" d="M2.6,10.59L8.38,4.8L10.07,6.5C9.83,7.35 10.22,8.28 11,8.73V14.27C10.4,14.61 10,15.26 10,16A2,2 0 0,0 12,18A2,2 0 0,0 14,16C14,15.26 13.6,14.61 13,14.27V9.41L15.07,11.5C15,11.65 15,11.82 15,12A2,2 0 0,0 17,14A2,2 0 0,0 19,12A2,2 0 0,0 17,10C16.82,10 16.65,10 16.5,10.07L13.93,7.5C14.19,6.57 13.71,5.55 12.78,5.16C12.35,5 11.9,4.96 11.5,5.07L9.8,3.38L10.59,2.6C11.37,1.81 12.63,1.81 13.41,2.6L21.4,10.59C22.19,11.37 22.19,12.63 21.4,13.41L13.41,21.4C12.63,22.19 11.37,22.19 10.59,21.4L2.6,13.41C1.81,12.63 1.81,11.37 2.6,10.59Z"> </path> </svg> </div> <span>Suggest an edit to this page</span> </a> </div> </div> </div> <h1> Bar Charts in MATLAB<sup>®</sup> </h1> <p>How to make Bar Charts plots in MATLAB<sup>®</sup> with Plotly. </p> <br> <!-- <div class="db-client-lib"> <label> This page in another language </label> <div class="list-lib-wrap"> <div class="list-lib"> <a href=" /julia/bar-charts/" class="list-lib-item julia"> <div class="item-icon"> </div> <p class="item-language"> Julia </p> </a> <a href=" /matlab/bar-charts/" class="current list-lib-item matlab"> <div class="item-icon"> </div> <p class="item-language"> MATLAB® </p> </a> <a href=" /ggplot2/bar-charts/" class="list-lib-item ggplot2"> <div class="item-icon"> </div> <p class="item-language"> ggplot2 </p> </a> <a href=" /csharp/bar-charts/" class="list-lib-item csharp"> <div class="item-icon"> </div> <p class="item-language"> C# </p> </a> <a href=" /python/bar-charts/" class="list-lib-item python"> <div class="item-icon"> </div> <p class="item-language"> Python </p> </a> <a href=" /fsharp/bar-charts/" class="list-lib-item fsharp"> <div class="item-icon"> </div> <p class="item-language"> F# </p> </a> <a href=" /r/bar-charts/" class="list-lib-item r"> <div class="item-icon"> </div> <p class="item-language"> R </p> </a> <a target="_blank" href="https://plotly.com/chart-studio-help/grouped-bar-chart/" class="list-lib-item studio"> <div class="item-icon"> </div> <p class="item-language"> Studio </p> </a> </div> </div> </div> --> </div> </div> </div> </header> <!-- Start Plotly Basics Section --> <section class="tutorial-content"> <h2>Create Bar Graph</h2> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">75</span> <span class="mi">91</span> <span class="mi">105</span> <span class="mf">123.5</span> <span class="mi">131</span> <span class="mi">150</span> <span class="mi">179</span> <span class="mi">203</span> <span class="mi">226</span> <span class="mi">249</span> <span class="mf">281.5</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-600615" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-600615" )) { Plotly.newPlot("plot-600615", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "y": [75, 91, 105, 123.5, 131, 150, 179, 203, 226, 249, 281.5], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "range": [-0.2, 12.2], "mirror": "ticks", "ticktext": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 50, 100, 150, 200, 250, 300], "range": [0, 300], "mirror": "ticks", "ticktext": ["0", "50", "100", "150", "200", "250", "300"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.0625, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-600615"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Bar Locations</h2> <p>Specify the bar locations along the x-axis. </p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">x</span> <span class="o">=</span> <span class="mi">1900</span><span class="p">:</span><span class="mi">10</span><span class="p">:</span><span class="mi">2000</span><span class="p">;</span> <span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">75</span> <span class="mi">91</span> <span class="mi">105</span> <span class="mf">123.5</span> <span class="mi">131</span> <span class="mi">150</span> <span class="mi">179</span> <span class="mi">203</span> <span class="mi">226</span> <span class="mi">249</span> <span class="mf">281.5</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-789563" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-789563" )) { Plotly.newPlot("plot-789563", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000], "y": [75, 91, 105, 123.5, 131, 150, 179, 203, 226, 249, 281.5], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000], "range": [1888, 2012], "mirror": "ticks", "ticktext": ["1900", "1910", "1920", "1930", "1940", "1950", "1960", "1970", "1980", "1990", "2000"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 50, 100, 150, 200, 250, 300], "range": [0, 300], "mirror": "ticks", "ticktext": ["0", "50", "100", "150", "200", "250", "300"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.0625, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-789563"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Bar Width</h2> <p>Set the width of each bar to 40 percent of the total space available for each bar. </p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">75</span> <span class="mi">91</span> <span class="mi">105</span> <span class="mf">123.5</span> <span class="mi">131</span> <span class="mi">150</span> <span class="mi">179</span> <span class="mi">203</span> <span class="mi">226</span> <span class="mi">249</span> <span class="mf">281.5</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="mf">0.4</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-973015" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-973015" )) { Plotly.newPlot("plot-973015", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "y": [75, 91, 105, 123.5, 131, 150, 179, 203, 226, 249, 281.5], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "range": [0, 12], "mirror": "ticks", "ticktext": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 50, 100, 150, 200, 250, 300], "range": [0, 300], "mirror": "ticks", "ticktext": ["0", "50", "100", "150", "200", "250", "300"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.6, "bargap": 0.0625, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-973015"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Display Groups of Bars</h2> <p>Display four groups of three bars.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">;</span> <span class="mi">2</span> <span class="mi">5</span> <span class="mi">6</span><span class="p">;</span> <span class="mi">2</span> <span class="mi">8</span> <span class="mi">9</span><span class="p">;</span> <span class="mi">2</span> <span class="mi">11</span> <span class="mi">12</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-1129694" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-1129694" )) { Plotly.newPlot("plot-1129694", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4], "y": [2, 2, 2, 2], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4], "y": [2, 5, 8, 11], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4], "y": [3, 6, 9, 12], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4], "range": [0.511111111111111, 4.48888888888889], "mirror": "ticks", "ticktext": ["1", "2", "3", "4"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 2, 4, 6, 8, 10, 12], "range": [0, 12], "mirror": "ticks", "ticktext": ["0", "2", "4", "6", "8", "10", "12"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.1875, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-1129694"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Display Stacked Bars</h2> <p>Display one bar for each row of the matrix. The height of each bar is the sum of the elements in the row.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">;</span> <span class="mi">2</span> <span class="mi">5</span> <span class="mi">6</span><span class="p">;</span> <span class="mi">2</span> <span class="mi">8</span> <span class="mi">9</span><span class="p">;</span> <span class="mi">2</span> <span class="mi">11</span> <span class="mi">12</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="s1">'stacked'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-1280337" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-1280337" )) { Plotly.newPlot("plot-1280337", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4], "y": [2, 2, 2, 2], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4], "y": [2, 5, 8, 11], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4], "y": [3, 6, 9, 12], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4], "range": [-0.2, 5.2], "mirror": "ticks", "ticktext": ["1", "2", "3", "4"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 5, 10, 15, 20, 25], "range": [0, 25], "mirror": "ticks", "ticktext": ["0", "5", "10", "15", "20", "25"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.1875, "barmode": "relative", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-1280337"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">measles</span> <span class="o">=</span> <span class="p">[</span><span class="mi">38556</span> <span class="mi">24472</span> <span class="mi">14556</span> <span class="mi">18060</span> <span class="mi">19549</span> <span class="mi">8122</span> <span class="mi">28541</span> <span class="mi">7880</span> <span class="mi">3283</span> <span class="mi">4135</span> <span class="mi">7953</span> <span class="mi">1884</span><span class="p">]</span><span class="o">'</span><span class="p">;</span> <span class="n">mumps</span> <span class="o">=</span> <span class="p">[</span><span class="mi">20178</span> <span class="mi">23536</span> <span class="mi">34561</span> <span class="mi">37395</span> <span class="mi">36072</span> <span class="mi">32237</span> <span class="mi">18597</span> <span class="mi">9408</span> <span class="mi">6005</span> <span class="mi">6268</span> <span class="mi">8963</span> <span class="mi">13882</span><span class="p">]</span><span class="o">'</span><span class="p">;</span> <span class="n">chickenPox</span> <span class="o">=</span> <span class="p">[</span><span class="mi">37140</span> <span class="mi">32169</span> <span class="mi">37533</span> <span class="mi">39103</span> <span class="mi">33244</span> <span class="mi">23269</span> <span class="mi">16737</span> <span class="mi">5411</span> <span class="mi">3435</span> <span class="mi">6052</span> <span class="mi">12825</span> <span class="mi">23332</span><span class="p">]</span><span class="o">'</span><span class="p">;</span> <span class="n">fig</span> <span class="o">=</span> <span class="nb">figure</span><span class="p">;</span> <span class="nb">bar</span><span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="mi">12</span><span class="p">,</span> <span class="p">[</span><span class="n">measles</span> <span class="n">mumps</span> <span class="n">chickenPox</span><span class="p">],</span> <span class="mf">0.5</span><span class="p">,</span> <span class="s1">'stack'</span><span class="p">);</span> <span class="nb">axis</span><span class="p">([</span><span class="mi">0</span> <span class="mi">13</span> <span class="mi">0</span> <span class="mi">100000</span><span class="p">]);</span> <span class="nb">title</span><span class="p">(</span><span class="s1">'Childhood diseases by month'</span><span class="p">);</span> <span class="nb">xlabel</span><span class="p">(</span><span class="s1">'Month'</span><span class="p">);</span> <span class="nb">ylabel</span><span class="p">(</span><span class="s1">'Cases (in thousands)'</span><span class="p">);</span> <span class="nb">legend</span><span class="p">(</span><span class="s1">'Measles'</span><span class="p">,</span> <span class="s1">'Mumps'</span><span class="p">,</span> <span class="s1">'Chicken pox'</span><span class="p">);</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-1434919" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-1434919" )) { Plotly.newPlot("plot-1434919", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "Measles", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "y": [38556, 24472, 14556, 18060, 19549, 8122, 28541, 7880, 3283, 4135, 7953, 1884], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "Mumps", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "y": [20178, 23536, 34561, 37395, 36072, 32237, 18597, 9408, 6005, 6268, 8963, 13882], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "Chicken pox", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "y": [37140, 32169, 37533, 39103, 33244, 23269, 16737, 5411, 3435, 6052, 12825, 23332], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": true, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b>Childhood diseases by month<\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"text": "x10^4", "xref": "x1", "yref": "y1", "xanchor": "left", "yanchor": "bottom", "font": {"size": 10, "color": "rgb(38.250000,38.250000,38.250000)", "family": "Arial, sans-serif"}, "showarrow": false, "x": 0, "y": 100000}], "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "range": [0, 13], "mirror": "ticks", "ticktext": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], "title": "Month", "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000], "range": [0, 100000], "mirror": "ticks", "ticktext": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], "title": "Cases (in thousands)", "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.5, "bargap": 0.1875, "barmode": "relative", "legend": {"x": 0.717857142857143, "xref": "paper", "xanchor": "left", "y": 0.80952380952381, "yref": "paper", "yanchor": "bottom", "traceorder": "normal", "borderwidth": 0.5, "bordercolor": "rgb(38.25,38.25,38.25)", "bgcolor": "rgb(255,255,255)", "font": {"size": 9, "family": "Arial, sans-serif", "color": "rgb(0,0,0_)"}}}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-1434919"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Display Stacked Bars with Negative Data</h2> <p>Define <code>x</code> as a vector of three year values. Define <code>y</code> as a matrix that contains a combination of negative and positive values. Display the values in a bar graph.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1980</span> <span class="mi">1990</span> <span class="mi">2000</span><span class="p">];</span> <span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">15</span> <span class="mi">20</span> <span class="o">-</span><span class="mi">5</span><span class="p">;</span> <span class="mi">10</span> <span class="o">-</span><span class="mi">17</span> <span class="mi">21</span><span class="p">;</span> <span class="o">-</span><span class="mi">10</span> <span class="mi">5</span> <span class="mi">15</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="s1">'stacked'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-1577964" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-1577964" )) { Plotly.newPlot("plot-1577964", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1980, 1990, 2000], "y": [15, 10, -10], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1980, 1990, 2000], "y": [20, -17, 5], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1980, 1990, 2000], "y": [-5, 21, 15], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1980, 1990, 2000], "range": [1968, 2012], "mirror": "ticks", "ticktext": ["1980", "1990", "2000"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [-20, -10, 0, 10, 20, 30, 40], "range": [-20, 40], "mirror": "ticks", "ticktext": ["-20", "-10", "0", "10", "20", "30", "40"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.1875, "barmode": "relative", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-1577964"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Categorical Data</h2> <p>One way to indicate categories for your bars is to specify <code>X</code> as a categorical array. The <code>bar</code> function uses a sorted list of the categories, so the bars might display in a different order than you expect. To preserve the order, call the <code>reordercats</code> function.</p> <p>Define <code>X</code> as categorical array, and call the <code>reordercats</code> function to specify the order for the bars. Then define <code>Y</code> as a vector of bar heights and display the bar graph.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">X</span> <span class="o">=</span> <span class="nb">categorical</span><span class="p">({</span><span class="s1">'Small'</span><span class="p">,</span><span class="s1">'Medium'</span><span class="p">,</span><span class="s1">'Large'</span><span class="p">,</span><span class="s1">'Extra Large'</span><span class="p">});</span> <span class="n">X</span> <span class="o">=</span> <span class="nb">reordercats</span><span class="p">(</span><span class="n">X</span><span class="p">,{</span><span class="s1">'Small'</span><span class="p">,</span><span class="s1">'Medium'</span><span class="p">,</span><span class="s1">'Large'</span><span class="p">,</span><span class="s1">'Extra Large'</span><span class="p">});</span> <span class="n">Y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">10</span> <span class="mi">21</span> <span class="mi">33</span> <span class="mi">52</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">X</span><span class="p">,</span><span class="n">Y</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-1726423" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-1726423" )) { Plotly.newPlot("plot-1726423", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": ["Small", "Medium", "Large", "Extra Large"], "y": [10, 21, 33, 52], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": true, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "category", "showticklabels": true, "tickmode": "array", "mirror": "ticks", "ticktext": ["Small", "Medium", "Large", "Extra Large"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1", "autotick": true}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 10, 20, 30, 40, 50, 60], "range": [0, 60], "mirror": "ticks", "ticktext": ["0", "10", "20", "30", "40", "50", "60"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.0625, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-1726423"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Labels at the Ends of Bars</h2> <p>Define <code>vals</code> as a matrix containing the values of two data sets. Display the values in a bar graph and specify an output argument. Since there are two data sets, <code>bar</code> returns a vector containing two <code>Bar</code> objects.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">];</span> <span class="n">vals</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">3</span> <span class="mi">6</span><span class="p">;</span> <span class="mi">11</span> <span class="mi">23</span> <span class="mi">26</span><span class="p">];</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">vals</span><span class="p">);</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-1893552" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-1893552" )) { Plotly.newPlot("plot-1893552", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [2, 3, 6], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [11, 23, 26], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3], "range": [0.514285714285714, 3.48571428571429], "mirror": "ticks", "ticktext": ["1", "2", "3"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 5, 10, 15, 20, 25, 30], "range": [0, 30], "mirror": "ticks", "ticktext": ["0", "5", "10", "15", "20", "25", "30"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.125, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-1893552"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Display the values at the tips of the first series of bars. Get the coordinates of the tips of the bars by getting the <code>XEndPoints</code> and <code>YEndPoints</code> properties of the first <code>Bar</code> object. Pass those coordinates to the <code>text</code> function, and specify the vertical and horizontal alignment so that the values are centered above the tips of the bars.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">];</span> <span class="n">vals</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">3</span> <span class="mi">6</span><span class="p">;</span> <span class="mi">11</span> <span class="mi">23</span> <span class="mi">26</span><span class="p">];</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">vals</span><span class="p">);</span> <span class="n">xtips1</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">XEndPoints</span><span class="p">;</span> <span class="n">ytips1</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">YEndPoints</span><span class="p">;</span> <span class="n">labels1</span> <span class="o">=</span> <span class="nb">string</span><span class="p">(</span><span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">YData</span><span class="p">);</span> <span class="nb">text</span><span class="p">(</span><span class="n">xtips1</span><span class="p">,</span><span class="n">ytips1</span><span class="p">,</span><span class="n">labels1</span><span class="p">,</span><span class="s1">'HorizontalAlignment'</span><span class="p">,</span><span class="s1">'center'</span><span class="p">,</span><span class="k">...</span> <span class="s1">'VerticalAlignment'</span><span class="p">,</span><span class="s1">'bottom'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-2041974" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2041974" )) { Plotly.newPlot("plot-2041974", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [2, 3, 6], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [11, 23, 26], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3], "range": [0.514285714285714, 3.48571428571429], "mirror": "ticks", "ticktext": ["1", "2", "3"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 5, 10, 15, 20, 25, 30], "range": [0, 30], "mirror": "ticks", "ticktext": ["0", "5", "10", "15", "20", "25", "30"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.125, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "6", "x": 2.85714285714286, "y": 6, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "3", "x": 1.85714285714286, "y": 3, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "2", "x": 0.857142857142857, "y": 2, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2041974"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Next, display the values above the tips of the second series of bars.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">];</span> <span class="n">vals</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">3</span> <span class="mi">6</span><span class="p">;</span> <span class="mi">11</span> <span class="mi">23</span> <span class="mi">26</span><span class="p">];</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">vals</span><span class="p">);</span> <span class="n">xtips1</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">XEndPoints</span><span class="p">;</span> <span class="n">ytips1</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">YEndPoints</span><span class="p">;</span> <span class="n">labels1</span> <span class="o">=</span> <span class="nb">string</span><span class="p">(</span><span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">YData</span><span class="p">);</span> <span class="nb">text</span><span class="p">(</span><span class="n">xtips1</span><span class="p">,</span><span class="n">ytips1</span><span class="p">,</span><span class="n">labels1</span><span class="p">,</span><span class="s1">'HorizontalAlignment'</span><span class="p">,</span><span class="s1">'center'</span><span class="p">,</span><span class="k">...</span> <span class="s1">'VerticalAlignment'</span><span class="p">,</span><span class="s1">'bottom'</span><span class="p">)</span> <span class="n">xtips2</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">XEndPoints</span><span class="p">;</span> <span class="n">ytips2</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">YEndPoints</span><span class="p">;</span> <span class="n">labels2</span> <span class="o">=</span> <span class="nb">string</span><span class="p">(</span><span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">YData</span><span class="p">);</span> <span class="nb">text</span><span class="p">(</span><span class="n">xtips2</span><span class="p">,</span><span class="n">ytips2</span><span class="p">,</span><span class="n">labels2</span><span class="p">,</span><span class="s1">'HorizontalAlignment'</span><span class="p">,</span><span class="s1">'center'</span><span class="p">,</span><span class="k">...</span> <span class="s1">'VerticalAlignment'</span><span class="p">,</span><span class="s1">'bottom'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-2182976" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2182976" )) { Plotly.newPlot("plot-2182976", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [2, 3, 6], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [11, 23, 26], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3], "range": [0.514285714285714, 3.48571428571429], "mirror": "ticks", "ticktext": ["1", "2", "3"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 5, 10, 15, 20, 25, 30], "range": [0, 30], "mirror": "ticks", "ticktext": ["0", "5", "10", "15", "20", "25", "30"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.125, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "26", "x": 3.14285714285714, "y": 26, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "23", "x": 2.14285714285714, "y": 23, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "11", "x": 1.14285714285714, "y": 11, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "6", "x": 2.85714285714286, "y": 6, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "3", "x": 1.85714285714286, "y": 3, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "x1", "yref": "y1", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "2", "x": 0.857142857142857, "y": 2, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 10}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2182976"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Axes for Bar Graph</h2> <p>Starting in R2019b, you can display a tiling of bar graphs using the <code>tiledlayout</code> and <code>nexttile</code> functions. Call the <code>tiledlayout</code> function to create a 2-by-1 tiled chart layout. Call the <code>nexttile</code> function to create the axes objects <code>ax1</code> and <code>ax2</code>. Display a bar graph in the top axes. In the bottom axes, display a stacked bar graph of the same data.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">;</span> <span class="mi">4</span> <span class="mi">5</span> <span class="mi">6</span><span class="p">];</span> <span class="n">tiledlayout</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span> <span class="c1">% Top bar graph</span> <span class="n">ax1</span> <span class="o">=</span> <span class="n">nexttile</span><span class="p">;</span> <span class="nb">bar</span><span class="p">(</span><span class="n">ax1</span><span class="p">,</span><span class="n">y</span><span class="p">)</span> <span class="c1">% Bottom bar graph</span> <span class="n">ax2</span> <span class="o">=</span> <span class="n">nexttile</span><span class="p">;</span> <span class="nb">bar</span><span class="p">(</span><span class="n">ax2</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="s1">'stacked'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-2316680" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2316680" )) { Plotly.newPlot("plot-2316680", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2], "y": [1, 4], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2], "y": [2, 5], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2], "y": [3, 6], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x2", "yaxis": "y2", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2], "y": [1, 4], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x2", "yaxis": "y2", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2], "y": [2, 5], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x2", "yaxis": "y2", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2], "y": [3, 6], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2], "range": [0.511111111111111, 2.48888888888889], "mirror": "ticks", "ticktext": ["1", "2"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.5875, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 1, 2, 3, 4, 5, 6], "range": [0, 6], "mirror": "ticks", "ticktext": ["0", "1", "2", "3", "4", "5", "6"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.5875, 0.925], "anchor": "x1"}, "xaxis2": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2], "range": [-0.2, 3.2], "mirror": "ticks", "ticktext": ["1", "2"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y2"}, "scene2": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.4475]}}, "yaxis2": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 5, 10, 15], "range": [0, 15], "mirror": "ticks", "ticktext": ["0", "5", "10", "15"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.4475], "anchor": "x2"}, "bargroupgap": 0.2, "bargap": 0.375, "barmode": "relative", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.4575, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}, {"showarrow": false, "xref": "paper", "yref": "paper", "align": "center", "xanchor": "center", "yanchor": "bottom", "text": "", "x": 0.5, "y": 0.95, "font": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 15.6, "family": "Arial, sans-serif"}, "textangle": 0}], "title": "<b><b><\/b><\/b>", "titlefont": {"color": "rgba(0,0,0,0)"}}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2316680"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Bar Color</h2> <p>Create a bar graph using red bars. </p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">75</span> <span class="mi">91</span> <span class="mi">105</span> <span class="mf">123.5</span> <span class="mi">131</span> <span class="mi">150</span> <span class="mi">179</span> <span class="mi">203</span> <span class="mi">226</span> <span class="mi">249</span> <span class="mf">281.5</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="s1">'r'</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-2458345" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2458345" )) { Plotly.newPlot("plot-2458345", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "y": [75, 91, 105, 123.5, 131, 150, 179, 203, 226, 249, 281.5], "marker": {"color": "rgb(255,0,0)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "range": [-0.2, 12.2], "mirror": "ticks", "ticktext": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 50, 100, 150, 200, 250, 300], "range": [0, 300], "mirror": "ticks", "ticktext": ["0", "50", "100", "150", "200", "250", "300"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.0625, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2458345"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Specify Bar and Outline Colors</h2> <p>Set the bar interior color and outline color using RGB triplets. Set the width of the bar outline.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">75</span> <span class="mi">91</span> <span class="mi">105</span> <span class="mf">123.5</span> <span class="mi">131</span> <span class="mi">150</span> <span class="mi">179</span> <span class="mi">203</span> <span class="mi">226</span> <span class="mi">249</span> <span class="mf">281.5</span><span class="p">];</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="s1">'FaceColor'</span><span class="p">,[</span><span class="mi">0</span> <span class="o">.</span><span class="mi">5</span> <span class="o">.</span><span class="mi">5</span><span class="p">],</span><span class="s1">'EdgeColor'</span><span class="p">,[</span><span class="mi">0</span> <span class="o">.</span><span class="mi">9</span> <span class="o">.</span><span class="mi">9</span><span class="p">],</span><span class="s1">'LineWidth'</span><span class="p">,</span><span class="mf">1.5</span><span class="p">)</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-2605934" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2605934" )) { Plotly.newPlot("plot-2605934", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "y": [75, 91, 105, 123.5, 131, 150, 179, 203, 226, 249, 281.5], "marker": {"color": "rgb(0,127.5,127.5)", "line": {"color": "rgb(0,229.5,229.5)", "width": 1.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "range": [-0.2, 12.2], "mirror": "ticks", "ticktext": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 50, 100, 150, 200, 250, 300], "range": [0, 300], "mirror": "ticks", "ticktext": ["0", "50", "100", "150", "200", "250", "300"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.0625, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2605934"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Control Individual Bar Colors</h2> <p>Control individual bar colors using the <code>CData</code> property of the <code>Bar</code> object. </p> <p>Create a bar chart and assign the <code>Bar</code> object to a variable. Set the <code>FaceColor</code> property of the <code>Bar</code> object to <code>'flat'</code> so that the chart uses the colors defined in the <code>CData</code> property. By default, the <code>CData</code> property is prepopulated with a matrix of the default RGB color values. To change a particular color, change the corresponding row in the matrix. For example, change the color of the second bar. </p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="nb">rand</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">1</span><span class="p">));</span> <span class="n">b</span><span class="o">.</span><span class="n">FaceColor</span> <span class="o">=</span> <span class="s1">'flat'</span><span class="p">;</span> <span class="n">b</span><span class="o">.</span><span class="n">CData</span><span class="p">(</span><span class="mi">2</span><span class="p">,:)</span> <span class="o">=</span> <span class="p">[</span><span class="o">.</span><span class="mi">5</span> <span class="mi">0</span> <span class="o">.</span><span class="mi">5</span><span class="p">];</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <pre class="code-output"> Index in position 1 exceeds array bounds. We had trouble parsing the bar object. This trace might not render properly. </pre> <div id="plot-2750157" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2750157" )) { Plotly.newPlot("plot-2750157", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "y": [0.167253545494722, 0.861980478702072, 0.989872153631504, 0.514423456505704, 0.884281023126955, 0.588026055308497, 0.154752348656045, 0.199862822857452, 0.406954837138907, 0.748705718215691]}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "range": [-0.2, 11.2], "mirror": "ticks", "ticktext": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1], "range": [0, 1], "mirror": "ticks", "ticktext": ["0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2750157"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Bar Chart with Colormap Colors</h2> <p>Create a bar chart that uses colormap colors by setting the <code>FaceColor</code> property to <code>'flat'</code>. Then set the <code>CData</code> property for each <code>Bar</code> object to an integer.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">3</span> <span class="mi">5</span><span class="p">;</span> <span class="mi">3</span> <span class="mi">2</span> <span class="mi">7</span><span class="p">;</span> <span class="mi">3</span> <span class="mi">4</span> <span class="mi">2</span><span class="p">];</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="s1">'FaceColor'</span><span class="p">,</span><span class="s1">'flat'</span><span class="p">);</span> <span class="k">for</span> <span class="n">k</span> <span class="o">=</span> <span class="mi">1</span><span class="p">:</span><span class="nb">size</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="n">b</span><span class="p">(</span><span class="n">k</span><span class="p">)</span><span class="o">.</span><span class="n">CData</span> <span class="o">=</span> <span class="n">k</span><span class="p">;</span> <span class="k">end</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-2903496" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-2903496" )) { Plotly.newPlot("plot-2903496", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [1, 3, 3], "marker": {"color": "rgb(61.761,38.352,168.3765)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [3, 2, 4], "marker": {"color": "rgb(16.269,189.873,185.946)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [5, 7, 2], "marker": {"color": "rgb(249.1095,250.8945,20.5275)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3], "range": [0.511111111111111, 3.48888888888889], "mirror": "ticks", "ticktext": ["1", "2", "3"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 1, 2, 3, 4, 5, 6, 7], "range": [0, 7], "mirror": "ticks", "ticktext": ["0", "1", "2", "3", "4", "5", "6", "7"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.1875, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-2903496"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <h2>Customize One Series in Grouped or Stacked Bars</h2> <p>Create matrix <code>y</code>, where each column is a series of data. Call the <code>bar</code> function to display the data in a bar graph, and specify an output argument. The output is a vector of three <code>Bar</code> objects, where each object corresponds to a different series. This is true whether the bars are grouped or stacked.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">10</span> <span class="mi">15</span> <span class="mi">20</span><span class="p">;</span> <span class="mi">30</span> <span class="mi">35</span> <span class="mi">40</span><span class="p">;</span> <span class="mi">50</span> <span class="mi">55</span> <span class="mi">62</span><span class="p">];</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">);</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-3046378" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-3046378" )) { Plotly.newPlot("plot-3046378", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [10, 30, 50], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [15, 35, 55], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [20, 40, 62], "marker": {"color": "rgb(236.895,176.97,31.875)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3], "range": [0.511111111111111, 3.48888888888889], "mirror": "ticks", "ticktext": ["1", "2", "3"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 10, 20, 30, 40, 50, 60, 70], "range": [0, 70], "mirror": "ticks", "ticktext": ["0", "10", "20", "30", "40", "50", "60", "70"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.1875, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-3046378"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <p>Make the third series of bars green.</p> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mi">10</span> <span class="mi">15</span> <span class="mi">20</span><span class="p">;</span> <span class="mi">30</span> <span class="mi">35</span> <span class="mi">40</span><span class="p">;</span> <span class="mi">50</span> <span class="mi">55</span> <span class="mi">62</span><span class="p">];</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">bar</span><span class="p">(</span><span class="n">y</span><span class="p">);</span> <span class="n">b</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">FaceColor</span> <span class="o">=</span> <span class="p">[</span><span class="o">.</span><span class="mi">2</span> <span class="o">.</span><span class="mi">6</span> <span class="o">.</span><span class="mi">5</span><span class="p">];</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-3189489" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-3189489" )) { Plotly.newPlot("plot-3189489", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [10, 30, 50], "marker": {"color": "rgb(0,113.985,188.955)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [15, 35, 55], "marker": {"color": "rgb(216.75,82.875,24.99)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1, 2, 3], "y": [20, 40, 62], "marker": {"color": "rgb(51,153,127.5)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1, 2, 3], "range": [0.511111111111111, 3.48888888888889], "mirror": "ticks", "ticktext": ["1", "2", "3"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 10, 20, 30, 40, 50, 60, 70], "range": [0, 70], "mirror": "ticks", "ticktext": ["0", "10", "20", "30", "40", "50", "60", "70"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": 0.2, "bargap": 0.1875, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-3189489"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> <div class="highlight"><pre><code class="language-matlab" data-lang="matlab"><span class="n">x</span> <span class="o">=</span> <span class="mi">1900</span><span class="p">:</span><span class="mi">10</span><span class="p">:</span><span class="mi">2000</span><span class="p">;</span> <span class="n">y1</span> <span class="o">=</span> <span class="p">[</span><span class="mf">75.99</span><span class="p">,</span><span class="mf">91.92</span><span class="p">,</span><span class="mf">105.71</span><span class="p">,</span><span class="k">...</span> <span class="mf">123.23</span><span class="p">,</span><span class="mf">131.69</span><span class="p">,</span><span class="k">...</span> <span class="mf">150.67</span><span class="p">,</span><span class="mf">179.33</span><span class="p">,</span><span class="mf">203.12</span><span class="p">,</span><span class="k">...</span> <span class="mf">226.55</span><span class="p">,</span><span class="mf">249.63</span><span class="p">,</span><span class="mf">281.42</span><span class="p">];</span> <span class="n">y2</span> <span class="o">=</span> <span class="p">[</span><span class="mf">55.2</span><span class="p">,</span><span class="mf">61.972</span><span class="p">,</span><span class="mf">65.71</span><span class="p">,</span><span class="k">...</span> <span class="mf">76.23</span><span class="p">,</span><span class="mf">87.669</span><span class="p">,</span><span class="k">...</span> <span class="mf">91.7</span><span class="p">,</span><span class="mf">103.23</span><span class="p">,</span><span class="mf">124.21</span><span class="p">,</span><span class="k">...</span> <span class="mf">130.55</span><span class="p">,</span><span class="mf">135.63</span><span class="p">,</span><span class="mf">145.22</span><span class="p">];</span> <span class="n">fig</span> <span class="o">=</span> <span class="nb">figure</span><span class="p">(</span><span class="s1">'Color'</span><span class="p">,</span><span class="s1">'w'</span><span class="p">);</span> <span class="nb">bar</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="p">[</span><span class="n">y1</span><span class="s1">' y2'</span><span class="p">],</span><span class="s1">'grouped'</span><span class="p">);</span> <span class="n">ax</span> <span class="o">=</span> <span class="nb">get</span><span class="p">(</span><span class="nb">gca</span><span class="p">);</span> <span class="nb">cat</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">Children</span><span class="p">;</span> <span class="nb">set</span><span class="p">(</span><span class="nb">cat</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span><span class="s1">'FaceColor'</span><span class="p">,[</span><span class="mi">145</span> <span class="mi">25</span> <span class="mi">206</span><span class="p">]/</span><span class="mi">255</span><span class="p">,</span><span class="s1">'BarWidth'</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> <span class="nb">set</span><span class="p">(</span><span class="nb">cat</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span><span class="s1">'FaceColor'</span><span class="p">,[</span><span class="mi">45</span> <span class="mi">125</span> <span class="mi">206</span><span class="p">]/</span><span class="mi">255</span><span class="p">,</span><span class="s1">'BarWidth'</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> <span class="nb">set</span><span class="p">(</span><span class="nb">gca</span><span class="p">,</span><span class="s1">'box'</span><span class="p">,</span><span class="s1">'off'</span><span class="p">);</span> <span class="n">fig2plotly</span><span class="p">(</span><span class="nb">gcf</span><span class="p">);</span> </code></pre></div> <div id="plot-3330716" class="plotly-graph-div js-plotly-plot"></div> <script type = "text/javascript" > require(["plotly"], function(Plotly) { window.PLOTLYENV = window.PLOTLYENV || {}; if (document.getElementById("plot-3330716" )) { Plotly.newPlot("plot-3330716", {"data": [{"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000], "y": [75.99, 91.92, 105.71, 123.23, 131.69, 150.67, 179.33, 203.12, 226.55, 249.63, 281.42], "marker": {"color": "rgb(145,25,206)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}, {"xaxis": "x1", "yaxis": "y1", "type": "bar", "name": "", "visible": true, "orientation": "v", "x": [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000], "y": [55.2, 61.972, 65.71, 76.23, 87.669, 91.7, 103.23, 124.21, 130.55, 135.63, 145.22], "marker": {"color": "rgb(45,125,206)", "line": {"color": "rgb(0,0,0)", "width": 0.5, "dash": "solid"}}, "showlegend": true}], "layout": {"autosize": false, "margin": {"pad": 0, "l": 0, "r": 0, "b": 0, "t": 0}, "showlegend": false, "width": 840, "height": 630, "paper_bgcolor": "rgb(255,255,255)", "hovermode": "closest", "xaxis1": {"side": "bottom", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000], "range": [1893.42857142857, 2006.57142857143], "mirror": false, "ticktext": ["1900", "1910", "1920", "1930", "1940", "1950", "1960", "1970", "1980", "1990", "2000"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.13, 0.905], "anchor": "y1"}, "scene1": {"domain": {"x": [0.13, 0.905], "y": [0.11, 0.925]}}, "yaxis1": {"side": "left", "zeroline": false, "autorange": false, "linecolor": "rgb(38.250000,38.250000,38.250000)", "linewidth": 1, "exponentformat": "none", "tickfont": {"size": 10, "family": "Arial, sans-serif", "color": "rgb(38.250000,38.250000,38.250000)"}, "ticklen": 6.51, "tickcolor": "rgb(38.250000,38.250000,38.250000)", "tickwidth": 1, "tickangle": -0, "ticks": "inside", "showgrid": false, "gridcolor": "rgba(38.250000,,38.250000,38.250000,0.150000)", "type": "linear", "showticklabels": true, "tickmode": "array", "tickvals": [0, 50, 100, 150, 200, 250, 300], "range": [0, 300], "mirror": false, "ticktext": ["0", "50", "100", "150", "200", "250", "300"], "titlefont": {"color": "rgb(38.250000,38.250000,38.250000)", "size": 11, "family": "Arial, sans-serif"}, "showline": true, "domain": [0.11, 0.925], "anchor": "x1"}, "bargroupgap": -1, "bargap": 0.125, "barmode": "group", "annotations": [{"showarrow": false, "xref": "paper", "yref": "paper", "xanchor": "center", "align": "center", "yanchor": "bottom", "text": "<b><b><\/b><\/b>", "x": 0.5175, "y": 0.935, "font": {"color": "rgb(0,0,0)", "family": "Arial, sans-serif", "size": 11}, "bordercolor": "rgba(0,0,0,0)", "textangle": 0, "borderwidth": 0.5, "borderpad": 3}]}, "frames": []} , {"responsive": true} ).then(function() { var gd = document.getElementById("plot-3330716"); var x = new MutationObserver(function(mutations, observer) { { var display = window.getComputedStyle(gd).display; if (!display || display === 'none') { { console.log([gd, 'removed!']); Plotly.purge(gd); observer.disconnect(); } } } }); // Listen for the removal of the full notebook cells var notebookContainer = gd.closest('#notebook-container'); if (notebookContainer) { { x.observe(notebookContainer, { childList: true }); } } // Listen for the clearing of the current output cell var outputEl = gd.closest('.output'); if (outputEl) { { x.observe(outputEl, { childList: true }); } } }) }; }); </script> </section> <!--End Plotly Basics Section--> </section> </div> </main> <script> var array = []; $('.tutorial-content :header:not(h6)').each(function (i, e) { var item = $(e); var itemText = item.text(); var hash = itemText.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/^-+|-+$/g, '').toLowerCase(); item.attr("id", hash); array.push({text: itemText, tag: item.prop("tagName"), hash: hash}); }); $("#nav_header_insertion_list").html(array.map(function(entry) { var text = entry.text.replace(/[^a-z0-9\s\.:\-\?\!\(\))]/gi, ''); if(entry.tag.toLowerCase() < "h4"){ return('<li class="--sidebar-item"><a href="#' + entry.hash + '">' + text + '</a></li>'); } else { return('<li class="--sidebar-item"><a href="#' + entry.hash + '">' + text + '</a></li>'); } }).join("")); //$(".tutorial-content :header:not(h6)").append( "\<div class=\"icon copy\" data-tooltip=\"Click to copy direct link\"><svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\"/> </svg> </div>"); </script> <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 © 2025 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 = "matlab"; </script> <!-- ALGOLIA SEARCH --> <script> window.ALGOLIA_CONFIG = { 'applicationId': '7EK9KHJW8M', 'indexName': 'matlab_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=2025-03-21-13-39"></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>