root icon indicating copy to clipboard operation
root copied to clipboard

Canvas is not displayed on secondary cell executions if `Print` method is used

Open dreykiman opened this issue 1 year ago • 1 comments

Check duplicate issues.

  • [X] Checked for duplicates

Description

TCanvas is not displayed in Jupyter notebook on secondary cell executions if Print method is used in the cell.

First time cell execution Secondary cell executions (note the order execution number)
image image

See discussion here: https://github.com/root-project/root/issues/13631#issuecomment-1941706841

Reproducer

c1 = ROOT.TCanvas("c1","c1",600,400)
c1.Draw()

h1 = ROOT.TH1F("h1","h1",100,-10,10)
h1.FillRandom("gaus",1000)

c1.Print("test.pdf")

ROOT version

6.30/02

Installation method

Arch linux package manager

Operating system

Linux

Additional context

No response

dreykiman avatar Feb 13 '24 15:02 dreykiman

I cannot reproduce problem. Maybe @vepadulano can check.

To get proper drawing, one should do:


h1 = ROOT.TH1F("h1","h1",100,-10,10)
h1.FillRandom("gaus",1000)

c1 = ROOT.TCanvas("c1","c1",600,400)
h1.Draw()
c1.Draw()

c1.Print("test.pdf")

linev avatar May 13 '24 12:05 linev

I guess, one can close problem. %reset -f does not cleanup ROOT, all histograms and canvases remains. If executing correct macro again, one just get warnings about canvas with same name, but drawing works as expected.

linev avatar Jun 13 '24 07:06 linev

Hi @linev, @vepadulano,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot:

github-actions[bot] avatar Jun 14 '24 06:06 github-actions[bot]

Issue with drawing new canvas with same name probably was resolved by https://github.com/root-project/root/pull/15943

linev avatar Jul 10 '24 08:07 linev