Coloring a graph

Okay, so I am graphing a quadratic formula. I want to fill all the area underneath the function when I used FillColor, it changes the color surrounding the canvas rather than filling the graph itself . Here is my code

#include <vector>
#include <iostream>
#include <stdlib.h>

#include <chrono>
#include <fstream>

//some ROOT includes
#include "TInterpreter.h"
#include "TROOT.h"
#include "TH1F.h"
#include "TH2S.h"
#include "TFile.h"
#include "TCanvas.h"
#include "TPad.h"
#include "TVectorD.h"
#include "TGraph.h"

using std::cin;
using std::cout;
using std::endl;

void vectorGraph()
    std::vector<Double_t> myX, myY;
    auto graph = new TCanvas("quadratic","graph");
    for (int i=0; i<20; i++)
    TGraph* quadGraph = new TGraph(20,,;



_ROOT Version:_ 14.02
_Compiler:_ Not Provided

I try your script. It works as you want.
vectorGraph.pdf (13.4 KB)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.