Merge pull request #3644 from t-bltg/marker_log

Fix computing marker coordinates with log scales
This commit is contained in:
t-bltg 2021-07-21 12:09:34 +02:00 committed by GitHub
commit 10ed39cf83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -326,13 +326,15 @@ end
# draw ONE Shape
function gr_draw_marker(series, xi, yi, clims, i, msize, strokewidth, shape::Shape)
sx, sy = coords(shape)
# convert to ndc coords (percentages of window)
GR.selntran(0)
# convert to ndc coords (percentages of window) ...
w, h = get_size(series)
f = msize / (w + h)
xi, yi = GR.wctondc(xi, yi)
xs = xi .+ sx .* f
ys = yi .+ sy .* f
# ... convert back to world coordinates
xs_ys = GR.ndctowc.(xi .+ sx .* f, yi .+ sy .* f)
xs, ys = getindex.(xs_ys, 1), getindex.(xs_ys, 2)
# draw the interior
mc = get_markercolor(series, clims, i)
@ -345,7 +347,6 @@ function gr_draw_marker(series, xi, yi, clims, i, msize, strokewidth, shape::Sha
gr_set_line(strokewidth, :solid, msc, series)
gr_set_transparency(msc, get_markerstrokealpha(series, i))
GR.polyline(xs, ys)
GR.selntran(1)
end
function gr_nominal_size(s)