# Filling a TGraph with strings on axis label

**URL:** <https://root-forum.cern.ch/t/filling-a-tgraph-with-strings-on-axis-label/20401>\
**Category:** ROOT\
**Created:** [January 4, 2016, 12:31am UTC](https://root-forum.cern.ch/t/filling-a-tgraph-with-strings-on-axis-label/20401 "2016-01-04T00:31:40Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [February 3, 2020, 9:09am UTC](https://root-forum.cern.ch/t/filling-a-tgraph-with-strings-on-axis-label/20401/6 "2020-02-03T09:09:24Z")

</div>

I think you made a double posting. See my answer here:

> [@TGraph with string values - string values on X axis won't display](https://root-forum.cern.ch/t/tgraph-with-string-values-string-values-on-x-axis-wont-display/37799):
>
> Hi everyone, I am plotting a graph with double Y axis and string values on the X axis, but along the x axis the values aren’t displayed. It just shows one of them at the end. Any idea how to solve this? void plot(){ std::vector\<Double\_t\> y\_vals; std::vector\<std::string\> x\_labels; std::vector\<Double\_t\> y2\_vals; auto c=new TCanvas(); c-\>SetGrid(); // Fill the vectors here std::ifstream file ("data40K.txt"); if(!file){ cout \<\< "File doesn't exist" \<\< endl; } std::string x; double x2, y, y2; …

---

_[View the full topic](https://root-forum.cern.ch/t/filling-a-tgraph-with-strings-on-axis-label/20401)._
