{
"cells": [
{
"cell_type": "markdown",
"id": "86b7d2c0",
"metadata": {},
"source": [
"# gr105_multigraphpalettecolor\n",
"(Palette Fill Color), PLC (Palette Line Color) and AMC (Palette Marker Color).\n",
"When one of these options is given to TMultiGraph::Draw the TGraphs in the\n",
"TMultiGraph get their color from the current color palette defined by\n",
"gStyle->SetPalette(...). The color is determined according to the number of\n",
"TGraphs.\n",
"\n",
"In this example four graphs are displayed with palette coloring for lines and\n",
"and markers. The color of each graph is picked inside the default palette kBird.\n",
"\n",
"\n",
"\n",
"**Author:** Olivier Couet \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:38 PM."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b123a938",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:38:18.535188Z",
"iopub.status.busy": "2026-05-19T20:38:18.535057Z",
"iopub.status.idle": "2026-05-19T20:38:18.884725Z",
"shell.execute_reply": "2026-05-19T20:38:18.884212Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Info in : created default TCanvas with name c1\n"
]
}
],
"source": [
"auto mg = new TMultiGraph();\n",
"\n",
"auto gr1 = new TGraph(); gr1->SetMarkerStyle(20);\n",
"auto gr2 = new TGraph(); gr2->SetMarkerStyle(21);\n",
"auto gr3 = new TGraph(); gr3->SetMarkerStyle(23);\n",
"auto gr4 = new TGraph(); gr4->SetMarkerStyle(24);\n",
"\n",
"Double_t dx = 6.28/100;\n",
"Double_t x = -3.14;\n",
"\n",
"for (int i=0; i<=100; i++) {\n",
" x = x+dx;\n",
" gr1->SetPoint(i,x,2.*TMath::Sin(x));\n",
" gr2->SetPoint(i,x,TMath::Cos(x));\n",
" gr3->SetPoint(i,x,TMath::Cos(x*x));\n",
" gr4->SetPoint(i,x,TMath::Cos(x*x*x));\n",
"}\n",
"\n",
"mg->Add(gr4,\"PL\");\n",
"mg->Add(gr3,\"PL\");\n",
"mg->Add(gr2,\"*L\");\n",
"mg->Add(gr1,\"PL\");\n",
"\n",
"mg->Draw(\"A pmc plc\");"
]
},
{
"cell_type": "markdown",
"id": "d5177d64",
"metadata": {},
"source": [
"Draw all canvases "
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "1b7edeea",
"metadata": {
"collapsed": false,
"execution": {
"iopub.execute_input": "2026-05-19T20:38:18.886271Z",
"iopub.status.busy": "2026-05-19T20:38:18.886135Z",
"iopub.status.idle": "2026-05-19T20:38:19.098020Z",
"shell.execute_reply": "2026-05-19T20:38:19.097445Z"
}
},
"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
}