{ "cells": [ { "cell_type": "markdown", "id": "a3451a0d", "metadata": {}, "source": [ "# hist049_Graphics_candle_plot\n", "\n", "\n", "\n", "\n", "**Author:** Georg Troska \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:12 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "4a668f3b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:01.809922Z", "iopub.status.busy": "2026-05-19T20:13:01.809798Z", "iopub.status.idle": "2026-05-19T20:13:02.148804Z", "shell.execute_reply": "2026-05-19T20:13:02.148011Z" } }, "outputs": [], "source": [ "gStyle->SetTimeOffset(0);\n", "TDatime dateBegin(2010, 1, 1, 0, 0, 0);\n", "TDatime dateEnd(2011, 1, 1, 0, 0, 0);\n", "\n", "auto h1 = new TH2I(\"h1\", \"Machine A + B\", 12, dateBegin.Convert(), dateEnd.Convert(), 1000, 0, 1000);\n", "auto h2 = new TH2I(\"h2\", \"Machine B\", 12, dateBegin.Convert(), dateEnd.Convert(), 1000, 0, 1000);\n", "\n", "h1->GetXaxis()->SetTimeDisplay(1);\n", "h1->GetXaxis()->SetTimeFormat(\"%d/%m/%y\");\n", "h1->GetXaxis()->SetNdivisions(-6);\n", "h1->GetXaxis()->SetTitle(\"Date [day/month/year]\");\n", "\n", "float Rand;\n", "for (int i = dateBegin.Convert(); i < dateEnd.Convert(); i += 86400 * 30) {\n", " for (int j = 0; j < 1000; j++) {\n", " Rand = gRandom->Gaus(500 + sin(i / 10000000.) * 100, 50);\n", " h1->Fill(i, Rand);\n", " Rand = gRandom->Gaus(500 + sin(i / 11000000.) * 100, 70);\n", " h2->Fill(i, Rand);\n", " }\n", "}\n", "\n", "h1->SetBarWidth(0.4);\n", "h1->SetBarOffset(-0.25);\n", "h1->SetFillColor(kYellow);\n", "h1->SetFillStyle(1001);\n", "\n", "h2->SetBarWidth(0.4);\n", "h2->SetBarOffset(0.25);\n", "h2->SetLineColor(kRed);\n", "h2->SetFillColor(kGreen);\n", "\n", "auto c1 = new TCanvas();\n", "\n", "h1->Draw(\"candle2\");\n", "h2->Draw(\"candle3 same\");\n", "\n", "gPad->BuildLegend(0.78, 0.695, 0.980, 0.935, \"\", \"f\");" ] }, { "cell_type": "markdown", "id": "f2ac807e", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "de144f21", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:13:02.150406Z", "iopub.status.busy": "2026-05-19T20:13:02.150290Z", "iopub.status.idle": "2026-05-19T20:13:02.354899Z", "shell.execute_reply": "2026-05-19T20:13:02.353969Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }