working on various things
This commit is contained in:
parent
d781c437de
commit
0041b034e0
File diff suppressed because one or more lines are too long
@ -190,7 +190,7 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
# Should ensure from this side that colors which are the same are merged together
|
# Should ensure from this side that colors which are the same are merged together
|
||||||
|
|
||||||
push!(gplt.guides[1].labels, d[:label])
|
push!(gplt.guides[1].labels, d[:label])
|
||||||
push!(gplt.guides[1].colors, d[:marker] == :none ? d[:color] : d[:markercolor])
|
push!(gplt.guides[1].colors, first(d[:marker] == :none ? d[:color] : d[:markercolor]))
|
||||||
# println("updated legend: ", gplt.guides)
|
# println("updated legend: ", gplt.guides)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -49,26 +49,38 @@ function updatePlotItems(plt::Plot{ImmersePackage}, d::Dict)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
# real time updates
|
||||||
|
# TODO: generalize this and move as much as possible out of here
|
||||||
|
|
||||||
|
function getImmerseData(plt::Plot{ImmersePackage}, i::Int)
|
||||||
|
gplt = plt.o[2]
|
||||||
|
gplt.layers[end-i+1].mapping
|
||||||
|
end
|
||||||
|
|
||||||
# add a new x/y data point to series i
|
# add a new x/y data point to series i
|
||||||
function Base.push!(plt::Plot{ImmersePackage}, i::Int, x::Real, y::Real)
|
function Base.push!(plt::Plot{ImmersePackage}, i::Int, x::Real, y::Real)
|
||||||
gplt = plt.o[2]
|
data = getImmerseData(plt, i)
|
||||||
data = gplt.layers[end-i+1].mapping
|
|
||||||
data[:x] = extendSeriesData(data[:x], x)
|
data[:x] = extendSeriesData(data[:x], x)
|
||||||
data[:y] = extendSeriesData(data[:y], y)
|
data[:y] = extendSeriesData(data[:y], y)
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
# add a new y, and extend x "naturally"
|
# add a new y, and extend x "naturally" for series i
|
||||||
function Base.push!(plt::Plot{ImmersePackage}, i::Int, y::Real)
|
function Base.push!(plt::Plot{ImmersePackage}, i::Int, y::Real)
|
||||||
gplt = plt.o[2]
|
xdata, ydata = xy(plt, i)
|
||||||
data = gplt.layers[end-i+1].mapping
|
|
||||||
data[:x] = extendSeriesData(data[:x]) # this will only work with a UnitRange{Int}!!!
|
data[:x] = extendSeriesData(data[:x]) # this will only work with a UnitRange{Int}!!!
|
||||||
data[:y] = extendSeriesData(data[:y], y)
|
data[:y] = extendSeriesData(data[:y], y)
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
extendSeriesData(v::UnitRange{Int}) = minimum(v):maximum(v)+1
|
function xy(plt::Plot{ImmersePackage}, i::Int)
|
||||||
extendSeriesData{T<:Real}(v::AVec{T}, z::Real) = (push!(v, convert(T, z)); v)
|
data = getImmerseData(plt, i)
|
||||||
|
data[:x], data[:y]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
@ -139,6 +151,7 @@ function Base.display(::PlotsDisplay, plt::Plot{ImmersePackage})
|
|||||||
end
|
end
|
||||||
|
|
||||||
Immerse.figure(fig.figno; displayfig = false)
|
Immerse.figure(fig.figno; displayfig = false)
|
||||||
|
println("about to display")
|
||||||
display(gplt)
|
display(gplt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -139,6 +139,11 @@ limsType{T<:Real,S<:Real}(lims::Tuple{T,S}) = :limits
|
|||||||
limsType(lims) = :invalid
|
limsType(lims) = :invalid
|
||||||
|
|
||||||
|
|
||||||
|
# used in updating an existing series
|
||||||
|
extendSeriesData(v::UnitRange{Int}) = minimum(v):maximum(v)+1
|
||||||
|
extendSeriesData{T<:Real}(v::AVec{T}, z::Real) = (push!(v, convert(T, z)); v)
|
||||||
|
|
||||||
|
|
||||||
# Some conversion functions
|
# Some conversion functions
|
||||||
# note: I borrowed these conversion constants from Compose.jl's Measure
|
# note: I borrowed these conversion constants from Compose.jl's Measure
|
||||||
const INCH_SCALAR = 25.4
|
const INCH_SCALAR = 25.4
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user