diff --git a/_episodes/01-introduction.md b/_episodes/01-introduction.md index 55ff24f..a12a773 100644 --- a/_episodes/01-introduction.md +++ b/_episodes/01-introduction.md @@ -38,8 +38,7 @@ plt.show() # Show the figure This code produces the following figure: - -![basic_plot](https://matplotlib.org/3.5.1/_images/sphx_glr_usage_001_2_0x.png) +![basic_plot](https://matplotlib.org/3.5.1/_images/sphx_glr_usage_001_2_0x.png){:width="50%"} > ## Notice > If you look at the plot and the order of the list of numbers you can clearly see that the order of the arguments is of the form @@ -61,7 +60,7 @@ This code produces the following figure: > Both methods allow you to produce a plot like the following *(we will later see how to produce them in more detail)* > > ## See example plot > > -> > ![3linesplot_ver1](../fig/3linesplot_ver2.png) +> > ![3linesplot_ver1](../fig/3linesplot_ver2.png){:width="50%"} > {: .solution} {: .callout} @@ -69,7 +68,7 @@ This code produces the following figure: Now, let's have a deeper look at the components of a Matplotlib figure. -![Names for different parts of a matplotlib plot](https://matplotlib.org/stable/_images/anatomy.png) +![Names for different parts of a matplotlib plot](https://matplotlib.org/stable/_images/anatomy.png){:width="50%"} ## How to work with some of these elements? @@ -256,7 +255,7 @@ hep.style.use("CMS") # string aliases work too and with just this addition we can produce the same plot as before with this new look. -![mplhep-figure](../fig/mplhep_fig.png) +![mplhep-figure](../fig/mplhep_fig.png){:width="50%"} > ## Warning > @@ -293,7 +292,7 @@ ax.errorbar(bin_centers, counts, yerr=np.sqrt(counts), fmt="none") plt.show() ``` -![first histogram](../fig/first_histo.png) +![first histogram](../fig/first_histo.png){:width="50%"} # More information? diff --git a/_episodes/04-higgs-search.md b/_episodes/04-higgs-search.md index 881a08b..b19c58c 100644 --- a/_episodes/04-higgs-search.md +++ b/_episodes/04-higgs-search.md @@ -148,7 +148,7 @@ ax.hist(branches["data_A"]["m4l"]) ~~~ {: .output} -![m4lep_histogram_0]({{ page.root }}/fig/m4lep_histogram_0.png) +![m4lep_histogram_0]({{ page.root }}/fig/m4lep_histogram_0.png){:width="50%"} **Tip:** In the previous plot the numbers in the axis are very small, we can change the font size (and font family) for all the following plots, including in our code: @@ -176,7 +176,7 @@ ax.hist(branches["data_A"]["m4l"]) ~~~ {: .output} -![m4lep_histogram_1]({{ page.root }}/fig/m4lep_histogram_1.png) +![m4lep_histogram_1]({{ page.root }}/fig/m4lep_histogram_1.png){:width="50%"} > ## Exercise > @@ -199,7 +199,7 @@ ax.hist(branches["data_A"]["m4l"]) > > ax.set_ylabel("Events") > > ax.legend() > > ``` -> > ![m4lep_histogram_2_0]({{ page.root }}/fig/m4lep_histogram_2_0.png) +> > ![m4lep_histogram_2_0]({{ page.root }}/fig/m4lep_histogram_2_0.png){:width="50%"} > {: .solution} {: .challenge} @@ -280,7 +280,7 @@ We certainly can visualize this information with Matplotlib making a histogram : > > ax.set_ylabel("Events") > > ax.legend(frameon=False) > > ``` -> > ![cut_histogram_3]({{ page.root }}/fig/cut_histogram_3.png) +> > ![cut_histogram_3]({{ page.root }}/fig/cut_histogram_3.png){:width="50%"} > {: .solution} {: .challenge} @@ -434,7 +434,7 @@ ax_2.tick_params(which="both", direction="in", top=True, right=True, length=6, w ax_2.legend(frameon=False) ``` -![MC_histogram_4]({{ page.root }}/fig/MC_histogram_4.png) +![MC_histogram_4]({{ page.root }}/fig/MC_histogram_4.png){:width="70%"} # Data samples @@ -496,7 +496,7 @@ ax.set_ylim(0, 30) ax.legend(fontsize=18, frameon=False) ``` -![m4lep_histogram_5]({{ page.root }}/fig/m4lep_histogram_5.png) +![m4lep_histogram_5]({{ page.root }}/fig/m4lep_histogram_5.png){:width="50%"} > ## Exercise > > Modify a bit the previous code to include the ticks and text, in the text and axis labels use latex to achieve the final plot. @@ -529,7 +529,7 @@ ax.legend(fontsize=18, frameon=False) ### Final Plot You can see at 125 GeV the component corresponding at the Higgs boson. -![m4lep_histogram_6]({{ page.root }}/fig/m4lep_histogram_6.png) +![m4lep_histogram_6]({{ page.root }}/fig/m4lep_histogram_6.png){:width="50%"} **Bonus**: If you are more curious about other HEP analysis tools, you can take a look at this same example developed with the ROOT framework [here](https://root.cern.ch/doc/v622/df106__HiggsToFourLeptons_8py.html). diff --git a/_episodes/05-mplhep.md b/_episodes/05-mplhep.md index ab72da0..7cdd8bc 100644 --- a/_episodes/05-mplhep.md +++ b/_episodes/05-mplhep.md @@ -64,7 +64,7 @@ fourlep = pd.concat(csvs) In this chapter we will see how to use mplhep commands to make a quality plot. This is our goal -![](../fig/Hto4lep_plot.png) +![](../fig/Hto4lep_plot.png){:width="80%"} ## Let's begin! @@ -130,12 +130,12 @@ fig.show() This would plot the following figure. -![](../fig/zz.png) +![](../fig/zz.png){:width="70%"} > ## Exercise > Plot each of the backgrounds individually. You should have something similar to -> ![](../fig/drellyan.png) -> ![](../fig/ttbar.png) +> ![](../fig/drellyan.png){:width="50%"} +> ![](../fig/ttbar.png){:width="50%"} {: .challenge} ### Stacking histograms and adding the CMS logo. @@ -211,7 +211,7 @@ yerrs = np.sqrt(hist) > >fig.show() >``` -> ![](../fig/background+data.png) +> ![](../fig/background+data.png){:width="80%"} {: .solution} # Putting it all together @@ -248,7 +248,7 @@ ax.set_xlim(rmin, rmax) fig.show() ``` -![](../fig/hzz.png) +![](../fig/hzz.png){:width="70%"} > ## Bonus question: how can something, that seems to have a mass of roughly 125 GeV decay via two Z bosons, with mass over 90 GeV? >Add that graph with all background + data and see how it lines up. @@ -307,7 +307,7 @@ fig.show() >``` {: .solution} -![](../fig/final-plot.png) +![](../fig/final-plot.png){:width="80%"} # Done! We are ready to publish :) diff --git a/_episodes/07-dimuonspectrum.md b/_episodes/07-dimuonspectrum.md index 59ba3b3..9ca08ed 100644 --- a/_episodes/07-dimuonspectrum.md +++ b/_episodes/07-dimuonspectrum.md @@ -180,7 +180,7 @@ ax.set_title("Muon Mass spectrum") plt.show() ``` -![png](../fig/output_15_0.png){: width="560px"} +![png](../fig/output_15_0.png){:width="50%"} Doesn't really look like much. How about we fix that! @@ -197,9 +197,8 @@ Using the code above, zoom in and fix the above plot to help **visually** estima >plt.show() >``` > ->![png](../fig/output_17_0.png){: width="560px" .image-with-shadow } +>![png](../fig/output_17_0.png){: width="50%" .image-with-shadow } {: .solution} -> # Let's make the dimuon spectrum @@ -363,7 +362,7 @@ You could use the `np.logspace()` function for the binning. It helps in returnin >``` {: .solution} -![png](../fig/output_26_0.png){: width="560px"} +![png](../fig/output_26_0.png){:width="50%"} Depending on what you did, you may see hints of particles below $$20 GeV/c^2$$. It is possible you see signs of other particles at even higher energies. Plot your masses over a wide range of values, but then zoom in (change the plotting range) on different mass ranges to see if you can identify these particles. @@ -373,6 +372,7 @@ Image( ) ``` - + +![CMS_HLT_DimuonMass_Inclusive_2017](https://twiki.cern.ch/twiki/pub/CMSPublic/HLTDiMuon2017and2018/CMS_HLT_DimuonMass_Inclusive_2017.png){:width="70%"} {% include links.md %}