# How to redraw Axis and plot borders?

**URL:** <https://root-forum.cern.ch/t/how-to-redraw-axis-and-plot-borders/28252>\
**Category:** Howto\
**Tags:** graphics\
**Created:** [March 9, 2018, 12:00pm UTC](https://root-forum.cern.ch/t/how-to-redraw-axis-and-plot-borders/28252 "2018-03-09T12:00:32Z")\
**Posts on this page:** 1\
**Page:** 1

<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:** [March 9, 2018, 12:00pm UTC](https://root-forum.cern.ch/t/how-to-redraw-axis-and-plot-borders/28252/1 "2018-03-09T12:00:33Z")

</div>

Sometimes, when several plots are drawn in the same pad using the option **SAME** , the axis tick marks and the plot’s border lines might be erased by the front plots. It might be useful to redraw them. The following example shows how to proceed.

```auto
void redrawBorder()
{
   gPad->Update();
   gPad->RedrawAxis();
   TLine l;
   l.DrawLine(gPad->GetUxmin(), gPad->GetUymax(), gPad->GetUxmax(), gPad->GetUymax());
   l.DrawLine(gPad->GetUxmax(), gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax());
}

void redraw()
{
   const int n = 10;

   auto h = new TH2D("h", "", n, 0, 1, n, 0, 1);
   h->SetBit(TH1::kNoStats);
   for (int i=1; i<=n; ++i)
      for (int j=1; j<=n; ++j)
         h->SetBinContent(i, j, 1);

   auto h2 = new TH2D("h2", "", n, 0, 1, n, 0, 1);
   h2->Fill(0.5, 0.5);

   auto c = new TCanvas("c", "c", 0, 0, 600, 300);
   c->Divide(2, 1);

   c->cd(1);
   h2->Draw("col");
   gPad->SetGridy(); gPad->SetGridx();

   c->cd(2);
   h->Draw("col");
   gPad->SetGridy(); gPad->SetGridx();
   redrawBorder();
}

```
