{ "cells": [ { "cell_type": "markdown", "id": "6f4058ab", "metadata": {}, "source": [ "# gr013_polar2\n", "See the [TGraphPolar documentation](https://root.cern/doc/master/classTGraphPolar.html)\n", "\n", "Since TGraphPolar is a TGraphErrors, it is painted with\n", "[TGraphPainter](https://root.cern/doc/master/classTGraphPainter.html) options.\n", "\n", "With GetPolargram we retrieve the polar axis to format it; see the\n", "[TGraphPolargram documentation](https://root.cern/doc/master/classTGraphPolargram.html)\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:37 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "e3be6e34", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:00.348470Z", "iopub.status.busy": "2026-05-19T20:38:00.348342Z", "iopub.status.idle": "2026-05-19T20:38:00.738075Z", "shell.execute_reply": "2026-05-19T20:38:00.730652Z" } }, "outputs": [], "source": [ "TCanvas * CPol = new TCanvas(\"CPol\",\"TGraphPolar Example\",500,500);\n", "\n", "Double_t theta[8];\n", "Double_t radius[8];\n", "Double_t etheta[8];\n", "Double_t eradius[8];\n", "\n", "for (int i=0; i<8; i++) {\n", " theta[i] = (i+1)*(TMath::Pi()/4.);\n", " radius[i] = (i+1)*0.05;\n", " etheta[i] = TMath::Pi()/8.;\n", " eradius[i] = 0.05;\n", "}\n", "\n", "TGraphPolar * grP1 = new TGraphPolar(8, theta, radius, etheta, eradius);\n", "grP1->SetTitle(\"\");\n", "\n", "grP1->SetMarkerStyle(20);\n", "grP1->SetMarkerSize(2.);\n", "grP1->SetMarkerColor(4);\n", "grP1->SetLineColor(2);\n", "grP1->SetLineWidth(3);" ] }, { "cell_type": "markdown", "id": "0a379abf", "metadata": {}, "source": [ "Draw with polymarker and errors" ] }, { "cell_type": "code", "execution_count": 2, "id": "90147df8", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:00.748076Z", "iopub.status.busy": "2026-05-19T20:38:00.747893Z", "iopub.status.idle": "2026-05-19T20:38:01.012765Z", "shell.execute_reply": "2026-05-19T20:38:01.000790Z" } }, "outputs": [], "source": [ "grP1->Draw(\"PE\");" ] }, { "cell_type": "markdown", "id": "97264ac3", "metadata": {}, "source": [ "To format the polar axis, we retrieve the TGraphPolargram.\n", "First update the canvas, otherwise GetPolargram returns 0" ] }, { "cell_type": "code", "execution_count": 3, "id": "d3bbe21c", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:01.016983Z", "iopub.status.busy": "2026-05-19T20:38:01.016839Z", "iopub.status.idle": "2026-05-19T20:38:01.224387Z", "shell.execute_reply": "2026-05-19T20:38:01.223754Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "