# Cannot combine y+ and rx when drawing TGraph

**URL:** <https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779>\
**Category:** ROOT\
**Created:** [May 8, 2021, 1:06pm UTC](https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779 "2021-05-08T13:06:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LongHoa](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/longhoa/32/25905_2.png) [@LongHoa](https://root-forum.cern.ch/u/LongHoa)\
**Post date:** [May 8, 2021, 1:06pm UTC](https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779/1 "2021-05-08T13:06:53Z")

</div>

Hi,

I would like to draw a TGraph with reverse X axis, and the Y axis is on the right hand side, but it seems that these 2 options doesn’t work together

here is my code:

```auto
#include <stdio.h>

void CodeCpp_TestReverseX()
{
	auto c4 = new TCanvas("c4","c4",200,10,600,400);
	double x[] = {0, 1, 2, 3, 4};
	double y[] = {0, 2, 4, 1, 3};
	double ex[] = {0.1, 0.2, 0.3, 0.4, 0.5};
	double ey[] = {1, 0.5, 1, 0.5, 1};
	TGraphErrors* ge = new TGraphErrors(5, x, y, ex, ey);
	
	ge -> GetYaxis() -> SetTitle("haha");
	
	ge->Draw("ay+rx");
	
	c4 -> SaveAs ("/home/longhoa/ROOT_Work/Task_Test/File_Plot/plotTestREverseX.png");
}

```

And the result plot still have the Y axis on the left  
 ![plotTestREverseX](https://root-forum.cern.ch/uploads/default/original/3X/8/6/86b460bcb65803d8d6d7488fbdf78b3243963d86.png)

Is there any thing I miss, or is there any workaround?

Thank you very much.  
Hoa.

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 8, 2021, 1:31pm UTC](https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779/2 "2021-05-08T13:31:37Z")

</div>

It looks like you’re right. You might want to open a Github issue (see [Report a bug or an issue](https://root-forum.cern.ch/t/report-a-bug-or-an-issue/37176)), and I invite @couet to take a look

---

<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:** [May 10, 2021, 10:59am UTC](https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779/3 "2021-05-10T10:59:57Z")

</div>

It was not implemented. This PR implements it. Thanks for the report.

> <https://github.com/root-project/root/pull/8131/files>
>
> It was requested here:
> https://root-forum.cern.ch/t/cannot-combine-y-and-rx-whe…n-drawing-tgraph/44779

---

<div class="post-metadata">

**Author:** ![LongHoa](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/longhoa/32/25905_2.png) [@LongHoa](https://root-forum.cern.ch/u/LongHoa)\
**Post date:** [May 10, 2021, 12:27pm UTC](https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779/4 "2021-05-10T12:27:18Z")

</div>

Thank you very much.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 24, 2021, 12:28pm UTC](https://root-forum.cern.ch/t/cannot-combine-y-and-rx-when-drawing-tgraph/44779/5 "2021-05-24T12:28:04Z")

</div>

Closed on May 24, 2021, 12:28pm UTC

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