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