call Gadfly.get_stroke_vector; added getindex/setindex to qwt

This commit is contained in:
Thomas Breloff 2015-09-25 13:33:06 -04:00
parent a0a0773bd2
commit d4da910f19
3 changed files with 173 additions and 537 deletions

File diff suppressed because one or more lines are too long

View File

@ -90,17 +90,17 @@ function addGadflyFixedLines!(gplt, d::Dict, theme)
end
function getGadflyStrokeVector(linestyle::Symbol)
dash = 12 * Compose.mm
dot = 3 * Compose.mm
gap = 2 * Compose.mm
linestyle == :solid && return nothing
linestyle == :dash && return [dash, gap]
linestyle == :dot && return [dot, gap]
linestyle == :dashdot && return [dash, gap, dot, gap]
linestyle == :dashdotdot && return [dash, gap, dot, gap, dot, gap]
error("unsupported linestyle: ", linestyle)
end
# function getGadflyStrokeVector(linestyle::Symbol)
# dash = 12 * Compose.mm
# dot = 3 * Compose.mm
# gap = 2 * Compose.mm
# linestyle == :solid && return nothing
# linestyle == :dash && return [dash, gap]
# linestyle == :dot && return [dot, gap]
# linestyle == :dashdot && return [dash, gap, dot, gap]
# linestyle == :dashdotdot && return [dash, gap, dot, gap, dot, gap]
# error("unsupported linestyle: ", linestyle)
# end
@ -111,8 +111,8 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
# if my PR isn't present, don't set the line_style
local extra_theme_args
try
Gadfly.getStrokeVector(:solid)
extra_theme_args = [(:line_style, getGadflyStrokeVector(d[:linestyle]))]
extra_theme_args = [(:line_style, Gadfly.get_stroke_vector(d[:linestyle]))]
# extra_theme_args = [(:line_style, getGadflyStrokeVector(d[:linestyle]))]
catch
extra_theme_args = []
end

View File

@ -63,6 +63,24 @@ function updatePlotItems(plt::Plot{QwtPackage}, d::Dict)
haskey(d, :ylabel) && Qwt.ylabel(plt.o, d[:ylabel])
end
# ----------------------------------------------------------------
# accessors for x/y data
function Base.getindex(plt::Plot{QwtPackage}, i::Int)
series = plt.o.lines[i]
series.x, series.y
end
function Base.setindex!(plt::Plot{QwtPackage}, xy::Tuple, i::Integer)
series = plt.o.lines[i]
series.x, series.y = xy
plt
end
# -------------------------------
# savepng(::QwtPackage, plt::PlottingObject, fn::AbstractString, args...) = Qwt.savepng(plt.o, fn)