Skip to content

(Web) graphics does not work from PyROOT #14943

Open
@jblomer

Description

@jblomer

Check duplicate issues.

  • Checked for duplicates

Description

When using Python in interactive mode, the web window does not launch properly (see screenshot). It works from a C++ macro. One can also save canvas contents in ROOT batch mode.

image

Reproducer

import ROOT
import numpy as np

def main():
    voltages = np.array([1,2,3], dtype=np.uint32)
    capacitances = np.array([4,5,6], dtype=np.float32)

    #ROOT.gROOT.SetBatch(True)
    df = ROOT.RDF.FromNumpy({'voltages': voltages, 'capacitances': capacitances})
    df = df.Define('inv', '1/(capacitances*capacitances)')

    c = ROOT.TCanvas()
    graph = df.Graph('voltages', 'inv')
    graph.Draw('APL')

    c.SaveAs("graph.pdf")

if __name__ == "__main__":
    main()

Output:

$ python3 -i repro.py 
Info in <THttpEngine::Create>: Starting HTTP server on port 127.0.0.1:9449
Opening in existing browser session.
[102887:102898:0312/160727.268507:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: No such interface “org.freedesktop.portal.FileChooser”
[102887:102898:0312/160727.268546:ERROR:select_file_dialog_linux_portal.cc(285)] Failed to read portal version property
[102887:102887:0312/160727.306050:ERROR:policy_logger.cc(156)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
13986 bytes written to file /home/jakob/Documents/CERN/ROOT/demo/graph.pdf
Info in <ProduceImage>: PDF file graph.pdf with 1 pages has been created
>>> 

ROOT version

master

Installation method

From sources

Operating system

Linux

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions