linewidth fix; kw macro
This commit is contained in:
parent
548c59719b
commit
c8d6b1fab0
@ -144,8 +144,7 @@ export
|
||||
arcdiagram,
|
||||
chorddiagram,
|
||||
|
||||
@default_kw,
|
||||
@force_kw,
|
||||
@kw,
|
||||
|
||||
translate,
|
||||
translate!,
|
||||
|
||||
@ -734,9 +734,9 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
||||
GR.setlinetype(1)
|
||||
GR.setlinewidth(1)
|
||||
GR.drawrect(px - 0.08, px + w + 0.02, py + dy, py - dy * length(plt.seriesargs))
|
||||
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
||||
i = 0
|
||||
for p in plt.seriesargs
|
||||
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
|
||||
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks]
|
||||
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
||||
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
||||
|
||||
14
src/plot.jl
14
src/plot.jl
@ -149,6 +149,13 @@ function filter_data!(d::KW, idxfilter)
|
||||
end
|
||||
end
|
||||
|
||||
function _replace_linewidth(d::KW)
|
||||
# get a good default linewidth... 0 for surface and heatmaps
|
||||
if get(d, :linewidth, :auto) == :auto
|
||||
d[:linewidth] = (get(d, :linetype, :path) in (:surface,:heatmap,:image) ? 0 : 1)
|
||||
end
|
||||
end
|
||||
|
||||
# no grouping
|
||||
function _add_series(plt::Plot, d::KW, ::Void, args...;
|
||||
idxfilter = nothing,
|
||||
@ -189,11 +196,6 @@ function _add_series(plt::Plot, d::KW, ::Void, args...;
|
||||
delete!(di, k)
|
||||
end
|
||||
|
||||
# get a good default linewidth... 0 for surface and heatmaps
|
||||
if get(di, :linewidth, :auto) == :auto
|
||||
di[:linewidth] = (get(di, :linetype, :path) in (:surface,:heatmap,:image) ? 0 : 1)
|
||||
end
|
||||
|
||||
# merge in plotarg_overrides
|
||||
plotarg_overrides = pop!(di, :plotarg_overrides, nothing)
|
||||
if plotarg_overrides != nothing
|
||||
@ -203,6 +205,8 @@ function _add_series(plt::Plot, d::KW, ::Void, args...;
|
||||
|
||||
dumpdict(di, "Series $i")
|
||||
|
||||
_replace_linewidth(di)
|
||||
|
||||
_add_series(plt.backend, plt, di)
|
||||
end
|
||||
end
|
||||
|
||||
@ -28,13 +28,13 @@ function _apply_recipe(d::KW, args...; issubplot=false, kw...)
|
||||
args
|
||||
end
|
||||
|
||||
macro default_kw(k, v)
|
||||
macro kw(k, v)
|
||||
esc(:(get!(d, $k, $v)))
|
||||
end
|
||||
|
||||
macro force_kw(k, v)
|
||||
esc(:(d[$k] = $v))
|
||||
end
|
||||
# macro force_kw(k, v)
|
||||
# esc(:(d[$k] = $v))
|
||||
# end
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -286,6 +286,7 @@ function _add_series_subplot(subplt::Subplot, d::KW, ::Void, args...;
|
||||
dumpdict(di, "subplot! kwList $i")
|
||||
dumpdict(plt.plotargs, "plt.plotargs before plotting")
|
||||
|
||||
_replace_linewidth(di)
|
||||
_add_series_subplot(plt, di)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user