# 2D histogram fit draws to wrong scale

**URL:** <https://root-forum.cern.ch/t/2d-histogram-fit-draws-to-wrong-scale/26369>\
**Category:** ROOT\
**Created:** [September 28, 2017, 6:22pm UTC](https://root-forum.cern.ch/t/2d-histogram-fit-draws-to-wrong-scale/26369 "2017-09-28T18:22:41Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 14, 2018, 4:00am UTC](https://root-forum.cern.ch/t/2d-histogram-fit-draws-to-wrong-scale/26369/13 "2018-04-14T04:00:19Z")

</div>

[There is a report](https://root-forum.cern.ch/t/2d-histogram-draw-scale-still-inconsistent/28678) that scales used by “E” and “SURF0” are inconsistent (when drawn together).  
Indeed, it seems to me that this small macro reproduces this problem (with ROOT 6.12/06 and 6.13/02):

```auto
{
  TFile *w = new TFile("wickes.root");
  TH2F* hm1 = (TH2F*)w->Get("hm1");
  hm1->SetStats(kFALSE);
  TCanvas *c = new TCanvas("c", "c");
  TF2* f1 = new TF2("f1", "(1 + y*([0] + [1]*x + [2]*x^2)) * (1 + y*([0] + [1]*x + [2]*x^2) > 0)", 0, 1, 0, 600);
  // hm1->Fit(f1);
  c->Clear();
  c->Divide(2, 2);
  c->cd(1);
  hm1->Draw("E ");
  c->cd(2);
  hm1->Draw("SURF0 ");
  c->cd(3);
  hm1->Draw("E ");
  hm1->Draw("SURF0 SAME");
  c->cd(4);
  hm1->Draw("SURF0 ");
  hm1->Draw("E SAME");
  c->cd(0);
}

```

Additionally, note also that there is another bug visible … when drawing “E SAME” (the bottom-right pad), the error bars are NOT drawn at all.

---

_[View the full topic](https://root-forum.cern.ch/t/2d-histogram-fit-draws-to-wrong-scale/26369)._
