<!DOCTYPE html>
<html lang="en">






<head>
<meta charset="utf-8">
<title>2d density plot with ggplot2 &#8211; the R Graph Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="This post introduces the concept of 2d density chart and explains how to build it with R and ggplot2. 2d histograms, hexbin charts, 2d distributions and others are considered.">
<meta name="keywords" content="R,ggplot2,tidyverse,Example,Data,Dataviz,Datavisualization,Plot,Chart,Graph,Learning,Caveat,Pitfall,Mistake">
<meta name="author" content="Yan Holtz">

<!-- Control appearance when shared by social media -->
<meta property="og:title" content="2d density plot with ggplot2" />
<meta property="og:image" content="https://github.com/holtzy/R-graph-gallery/raw/master/img/logo/R_single_big.png" />
<meta property="og:description" content="This post introduces the concept of 2d density chart and explains how to build it with R and ggplot2. 2d histograms, hexbin charts, 2d distributions and others are considered." />
<meta property='og:url' content="https://www.r-graph-gallery.com/2d-density-plot-with-ggplot2.html" />
<meta property="og:type" content="website" />

<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom fonts for this template -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

<!-- Custom styles for this template -->
<link href="css/agency.css" rel="stylesheet">

<!-- JQUERY -->
<script src="vendor/jquery/jquery.min.js"></script>

</head>





<body data-spy="scroll" data-target="#myScrollspy" data-offset="1">


<!-- THIS ALLOWS TO INSERT THE MENU -->
<nav class="navbar navbar-expand-lg fixed-top" id="mainNav">
<div class="container">
  <a href="index.html">&larr; R Graph Gallery</a>
  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
    Menu
    <i class="fa fa-bars"></i>
  </button>
  <div class="collapse navbar-collapse" id="navbarResponsive">
    <ul class="navbar-nav text-uppercase ml-auto">
      <li class="nav-item">
        <a class="nav-link" data-toggle="modal" href="#researchModal"><i class="fa fa-search"></i></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-toggle="modal" href="#LogoMenu">Chart types</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Quick
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <p class="menuTitle"><i>Basics</i></p>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/intro_d3js.html">Intro to d3</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/shape.html">Shape</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/basic_datamanipulation.html">Data wrangling</a>
          <p class="menuTitle"><i>Customize</i></p>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/custom_axis.html">Axis</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/custom_color.html">Color</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/custom_theme.html">Themes</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/custom_legend.html">Legend</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/custom_responsive.html">Responsivness</a>
          <p class="menuTitle"><i>Interactivity</i></p>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html">Tooltip</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/interactivity_button.html">Button</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/interactivity_zoom.html">Zoom</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/graph/interactivity_brush.html">Brushing</a>
          <a class="dropdown-item" href="https://www.d3-graph-gallery.com/interactivity.html">Transition</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="../all.html">ALL</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="https://www.r-graph-gallery.com">R</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="https://www.python-graph-gallery.com">Python</a>
      </li>
      <li class="nav-item">
        <a class="nav-link js-scroll-trigger" href="https://www.data-to-viz.com">Data to viz</a>
      </li>
      <li class="nav-item">
        <a class="nav-link js-scroll-trigger" href="https://www.yan-holtz.com">Who am I</a>
      </li>
      <li class="nav-item">
        <a class="nav-link js-scroll-trigger" href="about.html">About</a>
      </li>
    </ul>
  </div>
</div>
</nav>





<!-- Header = Title in big + social media Icon + quick description -->
<header class="masthead">
  <div class="textlanding">
      <center><h1>2d density plot with ggplot2</h1></center>
      <hr class="short_hr">
      <br>
      <ul class="list-inline social-buttons">
        <li class="list-inline-item">
          <a href="https://twitter.com/R_Graph_Gallery">
            <i class="fa fa-twitter"></i>
          </a>
        </li>
        <li class="list-inline-item social-buttons">
          <a href="https://github.com/holtzy">
            <i class="fa fa-github" style="color: white"></i>
          </a>
        </li>
        <li class="list-inline-item social-buttons">
          <a href="https://www.linkedin.com/in/yan-holtz-2477534a/">
            <i class="fa fa-linkedin"></i>
          </a>
        </li>
        <li class="list-inline-item social-buttons">
          <a href="https://www.yan-holtz.com">
            <i class="fa fa-home"></i>
          </a>
        </li>
      </ul>
      <center><p style="max-width: 600px; margin-top: 40px">This post introduces the concept of 2d density chart and explains how to build it with R and ggplot2. 2d histograms, hexbin charts, 2d distributions and others are considered.</p></center>
      <div style="text-align:center">
         <a class="btn btn-secondary btn-xl text-uppercase js-scroll-trigger" href='2d-density-chart.html'>2d density section</a>
         <a class="btn btn-secondary btn-xl text-uppercase js-scroll-trigger" href='https://www.data-to-viz.com/graph/density2d.html'>Data to Viz</a>
      </div>
  </div>
</header>









<!-- STYLE for chart pages but not the rest of tthe website -->
<style>
  img {
    margin-top: 20px;
  }
</style>



<div class="container">
<h1 id="the-issue-with-geom_point">The issue with <code>geom_point()</code></h1>
<hr />
<div class="row">
<div class="col-md-6 col-sm-12 align-self-center">
<p>A <a href="2d-density-chart.html">2d density plot</a> is useful to study the relationship between 2 numeric variables if you have a huge number of points.</p>
<p>To avoid overlapping (as in the scatterplot beside), it divides the plot area in a multitude of small fragment and represents the number of points in this fragment.</p>
<p>There are several types of 2d density plots. Each has its proper <a href="ggplot2.html">ggplot2</a> function. This post describes all of them.</p>
</div>
<div class="col-md-6 col-sm-12">
<p><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode-1.png" width="100%" /></p>
</div>
</div>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Library</span>
<span class="kw">library</span>(tidyverse)
 
<span class="co"># Data</span>
a &lt;-<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">x=</span><span class="kw">rnorm</span>(<span class="dv">20000</span>, <span class="dv">10</span>, <span class="fl">1.9</span>), <span class="dt">y=</span><span class="kw">rnorm</span>(<span class="dv">20000</span>, <span class="dv">10</span>, <span class="fl">1.2</span>) )
b &lt;-<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">x=</span><span class="kw">rnorm</span>(<span class="dv">20000</span>, <span class="fl">14.5</span>, <span class="fl">1.9</span>), <span class="dt">y=</span><span class="kw">rnorm</span>(<span class="dv">20000</span>, <span class="fl">14.5</span>, <span class="fl">1.9</span>) )
c &lt;-<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">x=</span><span class="kw">rnorm</span>(<span class="dv">20000</span>, <span class="fl">9.5</span>, <span class="fl">1.9</span>), <span class="dt">y=</span><span class="kw">rnorm</span>(<span class="dv">20000</span>, <span class="fl">15.5</span>, <span class="fl">1.9</span>) )
data &lt;-<span class="st"> </span><span class="kw">rbind</span>(a,b,c)
 
 
<span class="co"># Basic scatterplot</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">geom_point</span>()</code></pre></div>
<p><br><br></p>
<h1 id="hist">2d Histogram with <code>geom_bin2d()</code></h1>
<hr />
<p><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode2-1.png" width="40%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode2-2.png" width="40%" /></p>
<div class="row">
<div class="col-md-6 col-sm-12 align-self-center">
<p>For 2d histogram, the plot area is divided in a multitude of squares. (It is a 2d version of the classic <a href="histogram.html">histogram</a>). It is called using the <code>geom_bin_2d()</code> function. This function offers a <code>bins</code> argument that controls the number of bins you want to display.</p>
<p><u>Note</u>: If you’re not convinced about the importance of the <code>bins</code> option, read <a href="https://www.data-to-viz.com/caveat/bin_size.html">this</a>.</p>
</div>
<div class="col-md-6 col-sm-12">
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># 2d histogram with default option</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">geom_bin2d</span>() <span class="op">+</span>
<span class="st">  </span><span class="kw">theme_bw</span>()
 
<span class="co"># Bin size control + color palette</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">geom_bin2d</span>(<span class="dt">bins =</span> <span class="dv">70</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_fill_continuous</span>(<span class="dt">type =</span> <span class="st">&quot;viridis&quot;</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">theme_bw</span>()</code></pre></div>
</div>
</div>
<p><br><br></p>
<h1 id="hex">Hexbin chart with <code>geom_hex()</code></h1>
<hr />
<p><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode3-1.png" width="40%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode3-2.png" width="40%" /></p>
<div class="row">
<div class="col-md-6 col-sm-12 align-self-center">
<p>Another alternative is to divide the plot area in a multitude of hexagons: it is thus called a hexbin chart, and is made using the <code>geom_hex()</code> function.</p>
<p>This function provides the <code>bins</code> argument as well, to control the number of division per axis.</p>
</div>
<div class="col-md-6 col-sm-12">
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Hexbin chart with default option</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">geom_hex</span>() <span class="op">+</span>
<span class="st">  </span><span class="kw">theme_bw</span>()
 
<span class="co"># Bin size control + color palette</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">geom_hex</span>(<span class="dt">bins =</span> <span class="dv">70</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_fill_continuous</span>(<span class="dt">type =</span> <span class="st">&quot;viridis&quot;</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">theme_bw</span>()</code></pre></div>
</div>
</div>
<p><br><br></p>
<h1 id="distr">2d distribution with <code>geom_density_2d</code> or <code>stat_density_2d</code></h1>
<hr />
<p><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode4-1.png" width="50%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode4-2.png" width="50%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode4-3.png" width="50%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode4-4.png" width="50%" /></p>
<p>As you can plot a <a href="density.html">density chart</a> instead of a <a href="histogram.html">histogram</a>, it is possible to compute a 2d density and represent it. Several possibilities are offered by <code>ggplot2</code>: you can show the contour of the distribution, or the area, or use the <code>raster</code> function:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Show the contour only</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">geom_density_2d</span>()
 
<span class="co"># Show the area only</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">stat_density_2d</span>(<span class="kw">aes</span>(<span class="dt">fill =</span> ..level..), <span class="dt">geom =</span> <span class="st">&quot;polygon&quot;</span>)
 
<span class="co"># Area + contour</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">stat_density_2d</span>(<span class="kw">aes</span>(<span class="dt">fill =</span> ..level..), <span class="dt">geom =</span> <span class="st">&quot;polygon&quot;</span>, <span class="dt">colour=</span><span class="st">&quot;white&quot;</span>)
 
<span class="co"># Using raster</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">stat_density_2d</span>(<span class="kw">aes</span>(<span class="dt">fill =</span> ..density..), <span class="dt">geom =</span> <span class="st">&quot;raster&quot;</span>, <span class="dt">contour =</span> <span class="ot">FALSE</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_x_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_y_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">theme</span>(
    <span class="dt">legend.position=</span><span class="st">&#39;none&#39;</span>
  )</code></pre></div>
<p><br><br></p>
<h1 id="customize-the-color-palette">Customize the color palette</h1>
<hr />
<p><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode5-1.png" width="33%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode5-2.png" width="33%" /><img src="2d-density-plot-with-ggplot2_files/figure-html/thecode5-3.png" width="33%" /></p>
<p>Whatever you use a 2d histogram, a hexbin chart or a 2d distribution, you can and should custom the colour of your chart. Here is a suggestion using the <code>scale_fill_distiller()</code> function. You can see other methods in the <a href="ggplot2.html">ggplot2 section</a> of the gallery.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Call the palette with a number</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">stat_density_2d</span>(<span class="kw">aes</span>(<span class="dt">fill =</span> ..density..), <span class="dt">geom =</span> <span class="st">&quot;raster&quot;</span>, <span class="dt">contour =</span> <span class="ot">FALSE</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_fill_distiller</span>(<span class="dt">palette=</span><span class="dv">4</span>, <span class="dt">direction=</span><span class="op">-</span><span class="dv">1</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_x_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_y_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">theme</span>(
    <span class="dt">legend.position=</span><span class="st">&#39;none&#39;</span>
  )
 
<span class="co"># The direction argument allows to reverse the palette</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">stat_density_2d</span>(<span class="kw">aes</span>(<span class="dt">fill =</span> ..density..), <span class="dt">geom =</span> <span class="st">&quot;raster&quot;</span>, <span class="dt">contour =</span> <span class="ot">FALSE</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_fill_distiller</span>(<span class="dt">palette=</span><span class="dv">4</span>, <span class="dt">direction=</span><span class="dv">1</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_x_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_y_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">theme</span>(
    <span class="dt">legend.position=</span><span class="st">&#39;none&#39;</span>
  )
 
<span class="co"># You can also call the palette using a name.</span>
<span class="kw">ggplot</span>(data, <span class="kw">aes</span>(<span class="dt">x=</span>x, <span class="dt">y=</span>y) ) <span class="op">+</span>
<span class="st">  </span><span class="kw">stat_density_2d</span>(<span class="kw">aes</span>(<span class="dt">fill =</span> ..density..), <span class="dt">geom =</span> <span class="st">&quot;raster&quot;</span>, <span class="dt">contour =</span> <span class="ot">FALSE</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_fill_distiller</span>(<span class="dt">palette=</span> <span class="st">&quot;Spectral&quot;</span>, <span class="dt">direction=</span><span class="dv">1</span>) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_x_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">scale_y_continuous</span>(<span class="dt">expand =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">0</span>)) <span class="op">+</span>
<span class="st">  </span><span class="kw">theme</span>(
    <span class="dt">legend.position=</span><span class="st">&#39;none&#39;</span>
  )</code></pre></div>
<!-- Close container -->
</div>
<!-- ============================ RELATED SECTION ============================ -->
<section class="bg-light" id="portfolio_landing" style="padding-top: 30px; padding-bottom: 30px; margin-top: 100px;">

<div class="container">

  <p class="mySeryTitle">Related chart types</p>
  <hr>
  <div class="row">
    <div class="col-md-2 col-sm-4 portfolio-item ">
      <a class="portfolio-link"  href="scatter.html">
        <div class="portfolio-hover">
          <div class="portfolio-hover-content">
            <i class="fa fa-plus fa-3x"></i>
          </div>
        </div>
        <img class="img-fluid" src="img/section/ScatterPlot150.png" alt="">
      </a>
      <div class="captionPortfolio">Scatter</div>
    </div>
    <div class="col-md-2 col-sm-4 portfolio-item">
      <a class="portfolio-link"  href="heatmap.html">
        <div class="portfolio-hover">
          <div class="portfolio-hover-content">
            <i class="fa fa-plus fa-3x"></i>
          </div>
        </div>
        <img class="img-fluid" src="img/section/Heatmap150.png" alt="">
      </a>
      <div class="captionPortfolio">Heatmap</div>
    </div>
    <div class="col-md-2 col-sm-4 portfolio-item">
      <a class="portfolio-link"  href="correlogram.html">
        <div class="portfolio-hover">
          <div class="portfolio-hover-content">
            <i class="fa fa-plus fa-3x"></i>
          </div>
        </div>
        <img class="img-fluid" src="img/section/Correlogram150.png" alt="">
      </a>
      <div class="captionPortfolio">Correlogram</div>
    </div>
    <div class="col-md-2 col-sm-4 portfolio-item">
      <a class="portfolio-link"  href="bubble.html">
        <div class="portfolio-hover">
          <div class="portfolio-hover-content">
            <i class="fa fa-plus fa-3x"></i>
          </div>
        </div>
        <img class="img-fluid" src="img/section/BubblePlot150.png" alt="">
      </a>
      <div class="captionPortfolio">Bubble</div>
    </div>
    <div class="col-md-2 col-sm-4 portfolio-item ">
      <a class="portfolio-link"  href="connected-scatterplot.html">
        <div class="portfolio-hover">
          <div class="portfolio-hover-content">
            <i class="fa fa-plus fa-3x"></i>
          </div>
        </div>
        <img class="img-fluid" src="img/section/ScatterConnected150.png" alt="">
      </a>
      <div class="captionPortfolio">Connected scatter</div>
    </div>
    <div class="col-md-2 col-sm-4 portfolio-item show column correlation numonly bigdata">
      <a class="portfolio-link"  href="density2d.html">
        <div class="portfolio-hover">
          <div class="portfolio-hover-content">
            <i class="fa fa-plus fa-3x"></i>
          </div>
        </div>
        <img class="img-fluid" src="img/section/2dDensity150.png" alt="">
      </a>
      <div class="captionPortfolio">Density 2d</div>
    </div>
  </div>

</div>
</section>






<!-- ============================ CONTACT SECTION ============================ -->
<section id="contact" class="bg" style="background-color: white; padding-top: 60px">
  <div class="container">
    <div class="row">
      <div class="col-lg-2 text-center"></div>
      <div class="col-lg-8 text-center">
        <br><br><br>
        <h2 class="section-heading text-uppercase" style="color: black">Contact</h2>
        <p>This document is a work by <a href="https://www.yan-holtz.com">Yan Holtz</a>. Any feedback is highly encouraged. You can fill an issue on <a href="https://github.com/holtzy/D3-graph-gallery/issues">Github</a>, drop me a message on <a href="https://twitter.com/R_Graph_Gallery">Twitter</a>, or send an email pasting <a href="">yan.holtz.data</a> with <a href="">gmail.com</a>.</p>
        <div style="text-align:center">
           <a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="https://github.com/holtzy">Github</a>
           <a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="https://twitter.com/R_Graph_Gallery">Twitter</a>
         </div>
      </div>
    </div>
  </div>
</section>



<!-- ============================ FOOTER SECTION ============================ -->
<footer class="bg-light" id="myFooter">
  <div class="container" >
    <div class="row">
      <div class="col-md-4">
        <span class="copyright">Copyright &copy; the R graph gallery 2018</span>
      </div>
      <div class="col-md-4">
        <ul class="list-inline social-buttons">
          <li class="list-inline-item">
            <a href="https://twitter.com/R_Graph_Gallery">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
          <li class="list-inline-item">
            <a href="https://github.com/holtzy">
              <i class="fa fa-github"></i>
            </a>
          </li>
          <li class="list-inline-item">
            <a href="https://www.linkedin.com/in/yan-holtz-2477534a/">
              <i class="fa fa-linkedin"></i>
            </a>
          </li>
        </ul>
      </div>
      <div class="col-md-4">
        <ul class="list-inline quicklinks">
          <li class="list-inline-item">
            <a href="#">Privacy Policy</a>
          </li>
          <li class="list-inline-item">
            <a href="#">Terms of Use</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</footer>




<script>

// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
  $('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
  bootstrapStylePandocTables();
});


</script>



<!-- ============================ JAVASCRIPT SECTION ============================ -->

<!-- Bootstrap core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- Custom scripts for this template -->
<script src="js/agency.min.js"></script>

</body>
</html>