Merge 09421c9189dbb871af38b8af7c9f193f19adad63 into 008b61c9f6428e859e6ea5c1f619f140c7e83473

This commit is contained in:
Josef Heinen 2016-05-09 15:11:40 +00:00
commit 51a52d50db
4 changed files with 58 additions and 14 deletions

View File

@ -1,5 +1,6 @@
julia 0.4
RecipesBase
Colors
Reexport
Compat

View File

@ -228,6 +228,8 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
GR.setfillintstyle(GR.INTSTYLE_SOLID)
GR.setfillcolorind(gr_getcolorind(d[:background_color_outside]))
GR.fillrect(vp[1], vp[2], vp[3], vp[4])
c = getColor(d[:background_color_inside])
dark_bg = 0.21 * c.r + 0.72 * c.g + 0.07 * c.b < 0.9
GR.setfillcolorind(gr_getcolorind(d[:background_color_inside]))
GR.fillrect(viewport[1], viewport[2], viewport[3], viewport[4])
GR.selntran(1)
@ -356,6 +358,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
yorg = (ymax, ymin)
end
extrema[axis,:] = [xmin, xmax, ymin, ymax]
GR.setwindow(xmin, xmax, ymin, ymax)
GR.setscale(scale)
@ -371,9 +374,13 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
if outside_ticks
ticksize = -ticksize
end
if grid_flag && fg == 1
if grid_flag
if dark_bg
GR.grid(xtick * majorx, ytick * majory, 0, 0, 1, 1)
else
GR.grid(xtick, ytick, 0, 0, majorx, majory)
end
end
GR.setlinecolorind(gr_getcolorind(d[:foreground_color_axis]))
if num_axes == 1
GR.axes(xtick, ytick, xorg[1], yorg[1], majorx, majory, ticksize)

View File

@ -459,24 +459,59 @@ end
function setup_dataframes()
@require DataFrames begin
# @eval begin
# import DataFrames
get_data(df::DataFrames.AbstractDataFrame, arg::Symbol) = df[arg]
get_data(df::DataFrames.AbstractDataFrame, arg) = arg
DFS = Union{Symbol, AbstractVector{Symbol}}
function process_inputs(plt::AbstractPlot, d::KW, df::DataFrames.AbstractDataFrame, args...)
# d[:dataframe] = df
process_inputs(plt, d, map(arg -> get_data(df, arg), args)...)
end
# expecting the column name of a dataframe that was passed in... anything else should error
function extractGroupArgs(s::Symbol, df::DataFrames.AbstractDataFrame, args...)
if haskey(df, s)
return extractGroupArgs(df[s])
function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, dfs::DFS)
if isa(dfs, Symbol)
get!(d, symbol(letter * "label"), string(dfs))
collect(df[dfs])
else
error("Got a symbol, and expected that to be a key in d[:dataframe]. s=$s d=$d")
get!(d, :label, dfs')
Any[collect(df[s]) for s in dfs]
end
end
function handle_group(df::DataFrames.AbstractDataFrame, d::KW)
if haskey(d, :group)
g = d[:group]
if isa(g, Symbol)
d[:group] = collect(df[g])
end
end
end
@recipe function plot(df::DataFrames.AbstractDataFrame, sy::DFS)
handle_group(df, d)
handle_dfs(df, d, "y", sy)
end
@recipe function plot(df::DataFrames.AbstractDataFrame, sx::DFS, sy::DFS)
handle_group(df, d)
x = handle_dfs(df, d, "x", sx)
y = handle_dfs(df, d, "y", sy)
x, y
end
# get_data(df::DataFrames.AbstractDataFrame, arg::Symbol) = df[arg]
# get_data(df::DataFrames.AbstractDataFrame, arg) = arg
#
# function process_inputs(plt::AbstractPlot, d::KW, df::DataFrames.AbstractDataFrame, args...)
# # d[:dataframe] = df
# process_inputs(plt, d, map(arg -> get_data(df, arg), args)...)
# end
#
# # expecting the column name of a dataframe that was passed in... anything else should error
# function extractGroupArgs(s::Symbol, df::DataFrames.AbstractDataFrame, args...)
# if haskey(df, s)
# return extractGroupArgs(df[s])
# else
# error("Got a symbol, and expected that to be a key in d[:dataframe]. s=$s d=$d")
# end
# end
# function getDataFrameFromKW(d::KW)
# get(d, :dataframe) do
# error("Missing dataframe argument!")

View File

@ -1,5 +1,6 @@
julia 0.4
RecipesBase
Colors
Reexport
Requires