# Drawing empty TGraph

**URL:** <https://root-forum.cern.ch/t/drawing-empty-tgraph/63749>\
**Category:** Newbie\
**Created:** [June 18, 2025, 9:51am UTC](https://root-forum.cern.ch/t/drawing-empty-tgraph/63749 "2025-06-18T09:51:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phylmath](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/phylmath/32/38400_2.png) [@phylmath](https://root-forum.cern.ch/u/phylmath)\
**Post date:** [June 18, 2025, 9:51am UTC](https://root-forum.cern.ch/t/drawing-empty-tgraph/63749/1 "2025-06-18T09:51:10Z")

</div>

_ROOT Version:_ 6.32.04  
_Platform:_ WSL2 Ubuntu

Hello! I am unable to draw my TGraph. Brief context of the script: I extract histograms from a ROOT file and plot their means with respect to another array. Gist of the code is below.

```auto
// Reading roots
TFile *input_1 = new TFile("study1.root", "READ");
TFile *input_2 = new TFile("study2.root", "READ");
.
.
// Extracting hists
TH1F *hist_1 = (TH1F*)input_1->Get("hist_xx");
TH1F *hist_2 = (TH1F*)input_2->Get("hist_xx");
.
.
// Normalising
hist_1->Scale(1.0/hist_1->Integral());
hist_2->Scale(1.0/hist_2->Integral());
.
.
// Define arrays
double var1[] = {1, 2, 3, 4, 5};
double var2[] = {hist_1->GetMean(), hist_2->GetMean(), ... };

// Define graph
TGraph* graph = new TGraph(sizeof(var1)/sizeof(var1[0]), var1, var2);

// Create canvas
TCanvas* cv = new TCanvas("cv", "Running of var2", 1600, 800);
 
// Draw
graph ->Draw("AP");

}

```

I have checked if the histograms are empty; printing out the arrays gives correct values. Hence, I believe it is something to do with my TGraph handling? Highly appreciate an input. Thank you!

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 18, 2025, 10:40am UTC](https://root-forum.cern.ch/t/drawing-empty-tgraph/63749/2 "2025-06-18T10:40:14Z")

</div>

By default the marker used by the P option is a dot. You might not see because it is small.  
change the marker style with:

```auto
graph->SetMarkerSytle(20);

```

you can also use “ALP” as option to draw a line also.
