From 23ef6ad388d9df8287db431a5f8628d9e9c6b476 Mon Sep 17 00:00:00 2001 From: David Little Date: Tue, 23 Jul 2019 13:49:03 -0400 Subject: [PATCH] Fix Issue #2 --- src/PlotAxes.jl | 2 +- test/runtests.jl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PlotAxes.jl b/src/PlotAxes.jl index 4b2c5a0..0962b0c 100644 --- a/src/PlotAxes.jl +++ b/src/PlotAxes.jl @@ -228,7 +228,7 @@ function asplotable(x::AxisArray,ax1,axes...; vals = PlotAxes.quantize(x,steps) axqvals = PlotAxes.quantize.(axisvalues(x),steps) - df = DataFrame(value = vec(vals)) + df = DataFrame(value = convert(Array{eltype(vals)},vec(vals))) for ax in show_axes axi = findfirst(isequal(axarg_name(ax)),axisnames(x)) df[!,ax] .= default_value(eltype(axqvals[axi])) diff --git a/test/runtests.jl b/test/runtests.jl index cd46f30..b6a72de 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -84,6 +84,11 @@ end data = AxisArray(rand(10),Axis{:time}(range(0u"s",1u"s",length=10))) df, = PlotAxes.asplotable(data,quantize=(5,)) @test size(df,1) == 5 + @test df.time isa Array + + df, = PlotAxes.asplotable(data,quantize=(20,)) + @test size(df,1) == length(data) + @test df.time isa Array df, = PlotAxes.asplotable(rand(10,10),quantize=(5,5)) @test size(df,1) == 25