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 field intensity, but I would like to increase the color intensity, it’s too dark and I can’t see the contour lines that clearly.
#include "TFile.h"
#include "TTree.h"
#include "TCanvas.h"
#include "TH1F.h"
#include <iostream>
using namespace std;
void Contour_Plot(){
const Int_t NRGBs = 5;
const Int_t NCont = 99;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
TGraph2D *g=new TGraph2D("Test_file.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)");
TCanvas *c = new TCanvas("c", "c");
g->Draw("COLZ CONT3");
g->GetHistogram()->GetYaxis()->SetRangeUser(-50.0, 50.0);
g->GetHistogram()->GetXaxis()->SetRangeUser(-50.0, 50.0);
c->SetRealAspectRatio();
c->Modified(); c->Update();
gPad->Update();
}