Hi! I'm trying to plot a thin line and save it as a png, but looks like with png GR has restriction for minimal thickness.
Code below produces the same result for any linewidth <= 1.0
.
GR.beginprint("test_gr.png")
GR.setlinewidth(0.01)
GR.polyline(x, y)
GR.show()
GR.endprint()
Though the line is definitely thicker than 1 pixel. If I save it to svg, everything works well. Is there any way to fix this?
I was trying to use Ghostscript plugin by adding ENV["GKS_USE_GS_PNG"] = 1
, but it fails with "Ghostscript support not compiled in".
setspace3d
function.
inqtext
works:using GR
selntran(0)
settextfontprec(232, 3)
settextalign(2, 3)
chh = 0.072
for phi in LinRange(0, 2pi, 360)
clearws()
setcharheight(chh)
setcharup(sin(phi), cos(phi))
text(0.5, 0.5, "Hello World")
tbx, tby = inqtext(0.5, 0.5, "Hello World")
fillarea(tbx, tby)
updatews()
end
using GR
hor_align = Dict("Left" => 1, "Center" => 2, "Right" => 3)
vert_align = Dict("Top" => 1, "Cap" => 2, "Half" => 3, "Base" => 4, "Bottom" => 5)
selntran(0)
setcharheight(0.024)
for angle in 0:360
setcharup(sin(-angle * pi/180), cos(-angle * pi/180))
setmarkertype(2)
clearws()
for halign in keys(hor_align)
for valign in keys(vert_align)
settextalign(hor_align[halign], vert_align[valign])
x = -0.1 + hor_align[halign] * 0.3;
y = 1.1 - vert_align[valign] * 0.2;
s = halign * "\n" * valign * "\n" * "third line"
polymarker([x], [y])
text(x, y, s)
tbx, tby = inqtext(x, y, s)
fillarea(tbx, tby)
end
end
updatews()
end
ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder"
(in GR#master), but there are still some issues.
This is probably related to Plots. As a workaround, you can force GR to use GKSTerm as the default output device using the
GKSwstype
environment (in your script or in your shell):ENV["GKSwstype"]="gksqt"
I was using Julia 1.2.0 in Win 10 . and run into the problem that when I plot with GR it show the error message that
GKS: X11 support not compiled in
the command I quote is useful, thanks!