sciapp / gr

GR framework: a graphics library for visualisation applications
Other
328 stars 55 forks source link

Grid not saved when not exporting to pdf #134

Open bpedersen2 opened 3 years ago

bpedersen2 commented 3 years ago

We observer that a defined grid is not exported unless the format is pdf. ( in gr 1.16 .1 to 1.17.2 as used in nicos)

See also https://forge.frm2.tum.de/redmine/issues/4322

bpedersen2 commented 3 years ago

Details: save is called from an QT InteractiveGrWidget .

jheinen commented 3 years ago

Isn't this issue more about python-gr?

bpedersen2 commented 3 years ago

Yes,, probably

birkenfeld commented 3 years ago

Well, the save is initiated by the python-gr widget, which calls gr.beginprint(filename), self.draw (which is the same code that draws for interactive use) and then gr.endprint()...

birkenfeld commented 3 years ago

We checked with SVG output and saw that the grid lines are present, but their width is set to 0px.

Is the grid line width selected by gr or python-gr?

jheinen commented 3 years ago

@birkenfeld : Could you provide a MWE, or, can you re-produce the behaviour in a simple Python/Julia script?

birkenfeld commented 3 years ago

I will try.

birkenfeld commented 3 years ago

Ok, found the culprit in our code, you can close this.

birkenfeld commented 3 years ago

Well, actually... We do a gr.setlinewidth(0) around drawing; the commit message for that change says "avoid rescaling axis linewidth". So this is probably to work around the issue that sometimes lines would be unbearably wide for large plot sizes.

But still - why does the linewidth of 0 result in visible lines in Qt output but not in SVG/PDF?

jheinen commented 3 years ago

In the underlying backends, the linewidth might be used either as an absolute value or a scale factor. In other words, the value can not be handled in the same manner on different devices (pixel vs. vector graphics). In this case, we could probably use a minimum value instead of 0.

cfelder commented 2 years ago

this has been fixed on NICOS using a minimal line width of 0.1.

imho this can be closed.