{ "cells": [ { "cell_type": "markdown", "id": "d35f386f", "metadata": {}, "source": [ "# surfaces\n", "\n", "\n", "\n", "\n", "**Author:** Rene Brun \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": "19bbd8c0", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:30.158579Z", "iopub.status.busy": "2026-05-19T20:37:30.158445Z", "iopub.status.idle": "2026-05-19T20:37:30.648926Z", "shell.execute_reply": "2026-05-19T20:37:30.648485Z" } }, "outputs": [], "source": [ "TCanvas *c1 = new TCanvas(\"c1\", \"Surfaces Drawing Options\", 200, 10, 700, 900);\n", "TPaveText *title = new TPaveText(.2, 0.96, .8, .995);\n", "title->AddText(\"Examples of Surface options\");\n", "title->Draw();\n", "\n", "TPad *pad1 = new TPad(\"pad1\", \"Gouraud shading\", 0.03, 0.50, 0.98, 0.95);\n", "TPad *pad2 = new TPad(\"pad2\", \"Color mesh\", 0.03, 0.02, 0.98, 0.48);\n", "pad1->Draw();\n", "pad2->Draw();" ] }, { "cell_type": "markdown", "id": "0d128b1e", "metadata": {}, "source": [ "We generate a 2-D function" ] }, { "cell_type": "code", "execution_count": 2, "id": "c00f044c", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:30.651745Z", "iopub.status.busy": "2026-05-19T20:37:30.651594Z", "iopub.status.idle": "2026-05-19T20:37:30.863199Z", "shell.execute_reply": "2026-05-19T20:37:30.862712Z" } }, "outputs": [], "source": [ "TF2 *f2 = new TF2(\"f2\", \"x**2 + y**2 - x**3 -8*x*y**4\", -1, 1.2, -1.5, 1.5);\n", "f2->SetContour(48);\n", "f2->SetFillColor(45);" ] }, { "cell_type": "markdown", "id": "162d534b", "metadata": {}, "source": [ "Draw this function in pad1 with Gouraud shading option" ] }, { "cell_type": "code", "execution_count": 3, "id": "f5be1381", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:30.867778Z", "iopub.status.busy": "2026-05-19T20:37:30.867644Z", "iopub.status.idle": "2026-05-19T20:37:31.075183Z", "shell.execute_reply": "2026-05-19T20:37:31.074772Z" } }, "outputs": [], "source": [ "pad1->cd();\n", "pad1->SetPhi(-80);\n", "pad1->SetLogz();\n", "f2->Draw(\"surf4\");" ] }, { "cell_type": "markdown", "id": "009779f1", "metadata": {}, "source": [ "Draw this function in pad2 with color mesh option" ] }, { "cell_type": "code", "execution_count": 4, "id": "2365c6ee", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:31.077648Z", "iopub.status.busy": "2026-05-19T20:37:31.077511Z", "iopub.status.idle": "2026-05-19T20:37:31.301405Z", "shell.execute_reply": "2026-05-19T20:37:31.290708Z" } }, "outputs": [], "source": [ "pad2->cd();\n", "pad2->SetTheta(25);\n", "pad2->SetPhi(-110);\n", "pad2->SetLogz();\n", "f2->SetLineWidth(1);\n", "f2->SetLineColor(5);\n", "f2->Draw(\"surf1\");" ] }, { "cell_type": "markdown", "id": "c757d299", "metadata": {}, "source": [ "add axis titles. The titles are set on the intermediate\n", "histogram used for visualisation. We must force this histogram\n", "to be created, then force the redrawing of the two pads" ] }, { "cell_type": "code", "execution_count": 5, "id": "c401f439", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:31.327366Z", "iopub.status.busy": "2026-05-19T20:37:31.327218Z", "iopub.status.idle": "2026-05-19T20:37:31.685525Z", "shell.execute_reply": "2026-05-19T20:37:31.685146Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "