Home | News | Documentation | Download

Pdf and png produce different images

The following code produces the png and pdf images, screenshots of which are below in the same order. For the pdf, the star marker is reversed, also the lines look much thicker and the dashes have more spacing between them, also the border line and the axis ticks are much thicker. Do you people also get this problem and is this a bug?

import ROOT

graphs = ROOT.TMultiGraph()
canvas = ROOT.TCanvas("c","c",1400,900)

for i in range(5):
    graph = ROOT.TGraph()
    graph.SetPoint(0,3,1+i)
    graph.SetPoint(1,5,1+i)
    graph.SetMarkerStyle(29)
    graph.SetMarkerSize(5)
    graph.SetLineStyle(7)
    graphs.Add(graph, "lp")

graphs.Draw("A")
graphs.GetXaxis().SetLimits(2.5,5.5)

canvas.Modified()
canvas.Update()
canvas.SaveAs("test.png")
canvas.SaveAs("test.pdf")


ROOT Version: 6.19.01
Platform: Ubuntu 18.04
Compiler: gcc 7.4
Python: 3.6.8


Hi,

@couet might know more.

I will check the marker orientation in pdf and ps output

I made a JIRA report: https://sft.its.cern.ch/jira/browse/ROOT-10391

Thanks, and if the line styles and thicknesses would look the same in the pdf and png that would also be great.

Pdf is vector oriented and png is binary. The definition is not the same intrinsically. We tried to do the best matching but you might find it not good enough. There is a parameter to adjust that: https://root.cern/doc/master/classTStyle.html#afd8ef8c007d36f2382436a3b7eeef900

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Now fixed in master. Will be fixed in 6.20