Adjust DPI factor for PNG output

This is just a temporary workaround.
In a future version, a corresponding DPI adjustment should be
implemented in GR.
This commit is contained in:
Josef Heinen 2020-01-24 16:04:19 +01:00
parent 312f98e380
commit 45c434b5ed

View File

@ -322,8 +322,7 @@ end
# draw ONE symbol marker # draw ONE symbol marker
function gr_draw_marker(xi, yi, msize::Number, shape::Symbol) function gr_draw_marker(xi, yi, msize::Number, shape::Symbol)
GR.setmarkertype(gr_markertype[shape]) GR.setmarkertype(gr_markertype[shape])
w, h = gr_plot_size GR.setmarkersize(0.3msize)
GR.setmarkersize(0.3msize / ((w + h) * 0.001))
GR.polymarker([xi], [yi]) GR.polymarker([xi], [yi])
end end
@ -354,8 +353,7 @@ end
function gr_set_line(lw, style, c) #, a) function gr_set_line(lw, style, c) #, a)
GR.setlinetype(gr_linetype[style]) GR.setlinetype(gr_linetype[style])
w, h = gr_plot_size GR.setlinewidth(_gr_thickness_scaling[1] * max(0, lw))
GR.setlinewidth(_gr_thickness_scaling[1] * max(0, lw / ((w + h) * 0.001)))
gr_set_linecolor(c) #, a) gr_set_linecolor(c) #, a)
end end
@ -663,7 +661,7 @@ function gr_display(plt::Plot, fmt="")
_gr_thickness_scaling[1] = plt[:thickness_scaling] _gr_thickness_scaling[1] = plt[:thickness_scaling]
dpi_factor = plt[:dpi] / Plots.DPI dpi_factor = plt[:dpi] / Plots.DPI
if fmt == "svg" if fmt == "svg" || fmt == "png"
dpi_factor *= 4 dpi_factor *= 4
end end