# How to display right axis when using vtkChartXY?

**URL:** https://discourse.vtk.org/t/how-to-display-right-axis-when-using-vtkchartxy/14855
**Category:** Support
**Tags:** code
**Created:** [November 12, 2024, 6:54am UTC](https://discourse.vtk.org/t/how-to-display-right-axis-when-using-vtkchartxy/14855 "2024-11-12T06:54:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yiman](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yiman/32/8716_2.png) [@yiman](https://discourse.vtk.org/u/yiman)
#### Post date: [November 12, 2024, 6:54am UTC](https://discourse.vtk.org/t/how-to-display-right-axis-when-using-vtkchartxy/14855/1 "2024-11-12T06:54:22Z")

</div>

Hello everyone. I was wondering how to display right axis of the 2D chart. After test, I found the code like this does not work, left axis still show, and right axis does not appear. code snippet:

```auto
    auto chart = vtkSmartPointer<vtkChartXY>::New();
    chart->GetAxis(vtkAxis::LEFT)->SetVisible(false);
    chart->GetAxis(vtkAxis::RIGHT)->SetVisible(true);

```

---

<div class="post-metadata">

### Author: ![yiman](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yiman/32/8716_2.png) [@yiman](https://discourse.vtk.org/u/yiman)
#### Post date: [November 12, 2024, 6:55am UTC](https://discourse.vtk.org/t/how-to-display-right-axis-when-using-vtkchartxy/14855/2 "2024-11-12T06:55:24Z")

</div>

VTK version: 9.2.0  
OS: Windows 11

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 13, 2024, 12:01am UTC](https://discourse.vtk.org/t/how-to-display-right-axis-when-using-vtkchartxy/14855/3 "2024-11-13T00:01:23Z")

</div>

Hey, this is a bit different than you’re used to. The way to get the extra axes to show up and use them for plots is to set something called a plot corner. Add your plots to the chart as usual and then call

```auto
chart->SetPlotCorner(plot, 1);

```

The default plot corner is `0`, which uses the left and bottom axes. `1` uses bottom and right; `2` uses right and top and `3` uses top and left. I feel like this should have `enum` types.

---

<div class="post-metadata">

### Author: ![yiman](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yiman/32/8716_2.png) [@yiman](https://discourse.vtk.org/u/yiman)
#### Post date: [November 13, 2024, 1:46am UTC](https://discourse.vtk.org/t/how-to-display-right-axis-when-using-vtkchartxy/14855/4 "2024-11-13T01:46:55Z")

</div>

Thanks! Now, it works.
