(rdf-make-histogram)= # Walkthrough: Making Histograms **(10 minutes)** This tutorial is all about making histograms, so let's use `RDataFrame` to make a histogram. Here's an example of making a histogram of `chi2` from the dataframe: :::{code-block} c++ :name: cpp-rdf-hist :caption: RDataFrame - create a histogram (C++) histchi2 = dataframe.Histo1D("chi2"); ::: :::{code-block} python :name: python-rdf-hist :caption: RDataFrame - create a histogram (Python) histchi2 = dataframe.Histo1D("chi2") ::: We've made the histogram. Now let's draw it: :::{code-block} c++ :name: cpp-rdf-draw :caption: RDataFrame - draw a histogram (C++) histchi2->Draw(); ::: :::{code-block} python :name: python-rdf-draw :caption: RDataframe - draw a histogram (Python) histchi2.Draw() ::: Give it a try! What's that? It didn't work? It didn't if you're using a notebook. I'm being sneaky: I counted on you to forget the bit about needing a canvas (either in {ref}`C++ ` or {ref}`Python `). Here's a more complete example: :::{code-block} c++ :name: cpp-rdf-canvas :caption: RDataFrame - drawing a histogram with a canvas (C++) TCanvas canvas; histchi2->Draw(); canvas.Draw(); ::: :::{code-block} python :name: python-rdf-canvas :caption: RDataFrame - drawing a histogram with a canvas (Python) canvas = ROOT.TCanvas() histchi2.Draw() canvas.Draw() ::: :::{tip} While we have to explicitly Draw a canvas, we can re-use a previously-defined canvas (the same way command-line ROOT keeps re-using `c1`). ::: Follow the above examples to make histograms of the other variables in the n-tuple. :::{hint} I will permit you to use copy-and-paste (in a notebook) or the up-arrow key (if you're using the command line) to speed up this task. The fact that I have no way to stop you has nothing to do with it. ::: :::{figure-md} flawed_data-fig :align: center xkcd flawed_data by Randall Munroe :::