# TCanvas::Print PNG outputs fraction of figure when canvas size is declared

**URL:** <https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011>\
**Category:** ROOT\
**Tags:** graphics\
**Created:** [August 24, 2017, 8:13pm UTC](https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011 "2017-08-24T20:13:21Z")\
**Posts on this page:** 1\
**Showing post:** 19

<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:** [September 13, 2017, 7:52am UTC](https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011/19 "2017-09-13T07:52:26Z")

</div>

I think the problem originates somewhere in [TCanvas::SetWindowSize which sometimes fails in interactive mode](https://root-forum.cern.ch/t/setbatch-causes-different-graphics-output-for-pngs/19682/8), but here’s your own, more than 2 years old, post concerning the second problem:

> [@Print / saveas png draws axis title twice with offset](https://root-forum.cern.ch/t/print-saveas-png-draws-axis-title-twice-with-offset/19142/8):
>
> I can reproduce the effect on Mac with the X11 version using: void png\_double\_x\_axis\_title(){ gStyle-\>SetCanvasDefH(2000); gStyle-\>SetCanvasDefW(1000); TF1 \*fa1 = new TF1("fa1","sin(x)/x",0,10); TCanvas \*c1 = new TCanvas(); fa1-\>Draw(); fa1-\>GetXaxis()-\>SetTitle("X-axis"); fa1-\>GetYaxis()-\>SetTitle("Y-axis"); c1-\>Modified(); c1-\>Update(); c1-\>Print("test1.png"); } It gives me the attached plot.

---

_[View the full topic](https://root-forum.cern.ch/t/tcanvas-print-png-outputs-fraction-of-figure-when-canvas-size-is-declared/26011)._
