fixed dataframes loading; added dataframes to tests; started atom integration
This commit is contained in:
parent
b08212e2f9
commit
8b2a838388
@ -239,6 +239,9 @@ function __init__()
|
||||
@eval import IJulia
|
||||
IJulia.display_dict(plt::AbstractPlot) = Dict{ASCIIString, ByteString}("text/html" => sprint(writemime, "text/html", plt))
|
||||
end
|
||||
|
||||
setup_dataframes()
|
||||
setup_atom()
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
@ -117,3 +117,25 @@ Base.display(::Base.REPL.REPLDisplay, ::MIME"text/plain", plt::AbstractPlot) = g
|
||||
function Base.writemime(io::IO, ::MIME"text/html", plt::AbstractPlot)
|
||||
writemime(io, MIME("image/svg+xml"), plt)
|
||||
end
|
||||
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Atom PlotPane
|
||||
# ---------------------------------------------------------
|
||||
|
||||
function setup_atom()
|
||||
# @require Atom begin
|
||||
# @eval begin
|
||||
# import Atom
|
||||
#
|
||||
# Atom.displaysize(::AbstractPlot) = (535, 379)
|
||||
# Atom.displaytitle(::AbstractPlot) = "Plots.jl"
|
||||
#
|
||||
# Atom.@render Atom.PlotPane p::Plot begin
|
||||
# x, y = Atom.@rpc Atom.plotsize()
|
||||
# plot!(p, size=(x,y)) # changes the size of the Plots.Plot
|
||||
# Atom.div(Dict(:style=>"background: white"), Atom.HTML(stringmime("text/html", p)))
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
12
src/plot.jl
12
src/plot.jl
@ -531,7 +531,8 @@ end
|
||||
|
||||
# For DataFrame support. Imports DataFrames and defines the necessary methods which support them.
|
||||
|
||||
@require DataFrames begin
|
||||
function setup_dataframes()
|
||||
@require DataFrames begin
|
||||
|
||||
function createKWargsList(plt::AbstractPlot, df::DataFrames.AbstractDataFrame, args...; kw...)
|
||||
createKWargsList(plt, args...; kw..., dataframe = df)
|
||||
@ -547,23 +548,16 @@ end
|
||||
end
|
||||
|
||||
function getDataFrameFromKW(d::Dict)
|
||||
# for (k,v) in kw
|
||||
# if k == :dataframe
|
||||
# return v
|
||||
# end
|
||||
# end
|
||||
get(d, :dataframe) do
|
||||
error("Missing dataframe argument!")
|
||||
end
|
||||
end
|
||||
|
||||
# the conversion functions for when we pass symbols or vectors of symbols to reference dataframes
|
||||
# convertToAnyVector(s::Symbol; kw...) = Any[getDataFrameFromKW(;kw...)[s]], s
|
||||
# convertToAnyVector(v::AVec{Symbol}; kw...) = (df = getDataFrameFromKW(;kw...); Any[df[s] for s in v]), v
|
||||
convertToAnyVector(s::Symbol, d::Dict) = Any[getDataFrameFromKW(d)[s]], s
|
||||
convertToAnyVector(v::AVec{Symbol}, d::Dict) = (df = getDataFrameFromKW(d); Any[df[s] for s in v]), v
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
@ -10,3 +10,5 @@ ImageMagick
|
||||
PyPlot
|
||||
@osx QuartzImageIO
|
||||
GR
|
||||
DataFrames
|
||||
RDatasets
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
using VisualRegressionTests
|
||||
using ExamplePlots
|
||||
|
||||
import DataFrames, RDatasets
|
||||
|
||||
# don't let pyplot use a gui... it'll crash
|
||||
# note: Agg will set gui -> :none in PyPlot
|
||||
ENV["MPLBACKEND"] = "Agg"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user