fixes; changed reg to smooth, added loess smoothing in gadfly
This commit is contained in:
parent
7c91d10c79
commit
47f21b1652
File diff suppressed because one or more lines are too long
@ -120,7 +120,7 @@ _seriesDefaults[:fillcolor] = :match
|
||||
_seriesDefaults[:nbins] = 100 # number of bins for heatmaps and hists
|
||||
_seriesDefaults[:heatmap_c] = (0.15, 0.5) # TODO: this should be replaced with a ColorGradient
|
||||
# _seriesDefaults[:fill] = nothing # fills in the area
|
||||
_seriesDefaults[:reg] = false # regression line?
|
||||
_seriesDefaults[:smooth] = false # regression line?
|
||||
_seriesDefaults[:group] = nothing # groupby vector
|
||||
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
|
||||
_seriesDefaults[:z] = nothing # depth for contour, color scale, etc
|
||||
@ -256,7 +256,8 @@ end
|
||||
:fgcolor => :foreground_color,
|
||||
:fg_color => :foreground_color,
|
||||
:foreground => :foreground_color,
|
||||
:regression => :reg,
|
||||
:regression => :smooth,
|
||||
:reg => :smooth,
|
||||
:xlim => :xlims,
|
||||
:xlimit => :xlims,
|
||||
:xlimits => :xlims,
|
||||
|
||||
@ -35,7 +35,7 @@ supportedArgs(::GadflyPackage) = [
|
||||
:nc,
|
||||
:nr,
|
||||
# :pos,
|
||||
:reg,
|
||||
:smooth,
|
||||
:show,
|
||||
:size,
|
||||
:title,
|
||||
@ -334,12 +334,16 @@ function addToGadflyLegend(plt::Plot, d::Dict)
|
||||
|
||||
end
|
||||
|
||||
getGadflySmoothing(smooth::Bool) = smooth ? [Gadfly.Geom.smooth(method=:lm)] : Any[]
|
||||
getGadflySmoothing(smooth::Real) = [Gadfly.Geom.smooth(method=:loess, smoothing=float(smooth))]
|
||||
|
||||
|
||||
function addGadflySeries!(plt::Plot, d::Dict)
|
||||
|
||||
# add a regression line?
|
||||
# TODO: make more flexible
|
||||
smooth = d[:reg] ? [Gadfly.Geom.smooth(method=:lm)] : Any[]
|
||||
# smooth = d[:smooth] ? [Gadfly.Geom.smooth(method=:lm)] : Any[]
|
||||
smooth = getGadflySmoothing(d[:smooth])
|
||||
|
||||
# lines
|
||||
geom = getLineGeom(d)
|
||||
@ -484,7 +488,7 @@ end
|
||||
# append!(gplt.guides, guides)
|
||||
|
||||
# # add a regression line?
|
||||
# if d[:reg]
|
||||
# if d[:smooth]
|
||||
# # TODO: make more flexible
|
||||
# push!(gfargs, Gadfly.Geom.smooth(method=:lm))
|
||||
# # push!(gfargs, Gadfly.Geom.smooth(method=:loess, smoothing=0.95))
|
||||
@ -690,7 +694,7 @@ end
|
||||
# plot one data series
|
||||
function plot!(::GadflyPackage, plt::Plot; kw...)
|
||||
d = Dict(kw)
|
||||
addGadflySeries!(plt.o, d)
|
||||
addGadflySeries!(plt, d)
|
||||
push!(plt.seriesargs, d)
|
||||
plt
|
||||
end
|
||||
|
||||
@ -34,7 +34,7 @@ supportedArgs(::QwtPackage) = [
|
||||
:nc,
|
||||
:nr,
|
||||
:pos,
|
||||
:reg,
|
||||
:smooth,
|
||||
# :ribbon,
|
||||
:show,
|
||||
:size,
|
||||
|
||||
@ -32,7 +32,7 @@ supportedArgs(::[PkgName]Package) = [
|
||||
:nc,
|
||||
:nr,
|
||||
# :pos,
|
||||
:reg,
|
||||
:smooth,
|
||||
# :ribbon,
|
||||
:show,
|
||||
:size,
|
||||
|
||||
@ -57,7 +57,7 @@ supportedArgs(::WinstonPackage) = [
|
||||
# :nc,
|
||||
# :nr,
|
||||
# :pos,
|
||||
:reg,
|
||||
:smooth,
|
||||
# :ribbon,
|
||||
:show,
|
||||
:size,
|
||||
@ -206,7 +206,7 @@ function plot!(::WinstonPackage, plt::Plot; kw...)
|
||||
|
||||
|
||||
# optionally add a regression line
|
||||
d[:reg] && d[:linetype] != :hist && addRegressionLineWinston(d, wplt)
|
||||
d[:smooth] && d[:linetype] != :hist && addRegressionLineWinston(d, wplt)
|
||||
|
||||
push!(plt.seriesargs, d)
|
||||
plt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user