fixed empty plots

This commit is contained in:
Thomas Breloff 2015-10-21 21:30:05 -04:00
parent 9fcc3cdc24
commit 5a68003d16
6 changed files with 247 additions and 120 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -2,71 +2,11 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Recompiling stale cache file /home/tom/.julia/lib/v0.4/OnlineStats.ji for module OnlineStats.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.544174 seconds (2.08 M allocations: 156.080 MB, 2.81% gc time)\n",
"\n",
"\n",
"\n",
"maxabs(β - coef(o)) for\n",
"\n",
"glm: 0.006636741266573876\n",
"sgd: NaN\n",
"proxgrad: 0.010237129356885588\n",
"rda: 1.4318993623506318\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Base.FloatingPoint is deprecated, use AbstractFloat instead.\n",
" likely near /home/tom/.julia/v0.4/Qwt/src/widgets.jl:5\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:13\n",
"WARNING: Base.Uint32 is deprecated, use UInt32 instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:13\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:13\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:18\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:18\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:21\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:21\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:45\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:120\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:191\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:274\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:336\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:338\n",
"WARNING: Base.String is deprecated, use AbstractString instead.\n",
" likely near /home/tom/.julia/v0.4/Glob/src/Glob.jl:346\n"
]
}
],
"source": [ "source": [
"using Plots, DataFrames, OnlineStats, OnlineAI\n", "using Plots, DataFrames, OnlineStats, OnlineAI\n",
"default(size=(500,300))\n", "default(size=(500,300))\n",
@ -77,35 +17,21 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"scrolled": false
}, },
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"(xmeta,ymeta) = (nothing,nothing)" "(xmeta,ymeta) = (nothing,nothing)\n"
]
},
{
"ename": "BoundsError",
"evalue": "BoundsError: attempt to access 0-element Array{Any,1}\n at index [0]",
"output_type": "error",
"traceback": [
"BoundsError: attempt to access 0-element Array{Any,1}\n at index [0]",
""
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
] ]
} }
], ],
"source": [ "source": [
"p = plot(10)" "using Plots; gadfly()\n",
"p = plot(10);"
] ]
}, },
{ {

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,9 @@ end
function Base.setindex!(plt::Plot{ImmersePackage}, xy::Tuple, i::Integer) function Base.setindex!(plt::Plot{ImmersePackage}, xy::Tuple, i::Integer)
for mapping in getGadflyMappings(plt, i) for mapping in getGadflyMappings(plt, i)
# @show "before",i xy mapping[:x] mapping[:y]
mapping[:x], mapping[:y] = xy mapping[:x], mapping[:y] = xy
# @show "after",i xy mapping[:x] mapping[:y]
end end
plt plt
end end

View File

@ -111,7 +111,7 @@ function plot!(plt::Plot, args...; kw...)
kwList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...) kwList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...)
# if we were able to extract guide information from the series inputs, then update the plot # if we were able to extract guide information from the series inputs, then update the plot
@show xmeta, ymeta # @show xmeta, ymeta
updateDictWithMeta(d, plt.initargs, xmeta, true) updateDictWithMeta(d, plt.initargs, xmeta, true)
updateDictWithMeta(d, plt.initargs, ymeta, false) updateDictWithMeta(d, plt.initargs, ymeta, false)
@ -225,7 +225,7 @@ typealias FuncOrFuncs @compat(Union{Function, AVec{Function}})
convertToAnyVector(v::@compat(Void); kw...) = Any[nothing], nothing convertToAnyVector(v::@compat(Void); kw...) = Any[nothing], nothing
# fixed number of blank series # fixed number of blank series
convertToAnyVector(n::Integer; kw...) = Any[zero(0) for i in 1:n], nothing convertToAnyVector(n::Integer; kw...) = Any[zeros(0) for i in 1:n], nothing
# numeric vector # numeric vector
convertToAnyVector{T<:Real}(v::AVec{T}; kw...) = Any[v], nothing convertToAnyVector{T<:Real}(v::AVec{T}; kw...) = Any[v], nothing

View File

@ -290,7 +290,9 @@ end
# used in updating an existing series # used in updating an existing series
extendUnitRange(v::UnitRange{Int}, n::Int = 1) = minimum(v):maximum(v)+n extendUnitRange(v::UnitRange{Int}, n::Int = 1) = isempty(v) ? (1:n) : (minimum(v):maximum(v)+n)
extendSeriesData{T}(v::Range{T}, z::Real) = extendSeriesData(float(collect(v)), z)
extendSeriesData{T}(v::Range{T}, z::AVec) = extendSeriesData(float(collect(v)), z)
extendSeriesData{T}(v::AVec{T}, z::Real) = (push!(v, convert(T, z)); v) extendSeriesData{T}(v::AVec{T}, z::Real) = (push!(v, convert(T, z)); v)
extendSeriesData{T}(v::AVec{T}, z::AVec) = (append!(v, convert(Vector{T}, z)); v) extendSeriesData{T}(v::AVec{T}, z::AVec) = (append!(v, convert(Vector{T}, z)); v)