Please read tips for efficient and successful posting and posting code
_ROOT Version:_6.22/00
Platform: Ubuntu 20.04.1 LTS (WSL2)
Compiler: GNU or GCC
Hello,
I have created a contour plot of the magnetic flux density of an octupole magnet. Now I want to add/draw a circle on the contour plot with the radius r = 0.045 at the center. How do I do that?
#include "TFile.h"
#include "TTree.h"
#include "TCanvas.h"
#include "TH1F.h"
#include <iostream>
using namespace std;
void Contour_Plot(){
const Int_t NCont = 50;
gStyle->SetNumberContours(NCont);
auto g = new TGraph2D("Contour_data.txt","%lg %lg %lg");
g->SetNpx(200);
g->SetNpy(200);
g->SetTitle("Contour plot of the magnetic flux density (T) in the x-y plane");
g->GetHistogram()->GetXaxis()->SetTitle("x (m)");
g->GetHistogram()->GetYaxis()->SetTitle("y (m)");
g->SetLineWidth(1);
g->SetLineStyle(1);
g->Draw("colz cont6 ");
TCanvas *c = new TCanvas("c", "c");
g->Draw("COLZ");
g->GetHistogram()->GetYaxis()->SetRangeUser(-0.07, 0.07);
g->GetHistogram()->GetXaxis()->SetRangeUser(-0.07, 0.07);
c->SetRealAspectRatio();
c->Modified(); c->Update();
}