Merge 09421c9189dbb871af38b8af7c9f193f19adad63 into 008b61c9f6428e859e6ea5c1f619f140c7e83473
This commit is contained in:
commit
51a52d50db
1
REQUIRE
1
REQUIRE
@ -1,5 +1,6 @@
|
|||||||
julia 0.4
|
julia 0.4
|
||||||
|
|
||||||
|
RecipesBase
|
||||||
Colors
|
Colors
|
||||||
Reexport
|
Reexport
|
||||||
Compat
|
Compat
|
||||||
|
|||||||
@ -228,6 +228,8 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
GR.setfillcolorind(gr_getcolorind(d[:background_color_outside]))
|
GR.setfillcolorind(gr_getcolorind(d[:background_color_outside]))
|
||||||
GR.fillrect(vp[1], vp[2], vp[3], vp[4])
|
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.setfillcolorind(gr_getcolorind(d[:background_color_inside]))
|
||||||
GR.fillrect(viewport[1], viewport[2], viewport[3], viewport[4])
|
GR.fillrect(viewport[1], viewport[2], viewport[3], viewport[4])
|
||||||
GR.selntran(1)
|
GR.selntran(1)
|
||||||
@ -356,6 +358,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
yorg = (ymax, ymin)
|
yorg = (ymax, ymin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
extrema[axis,:] = [xmin, xmax, ymin, ymax]
|
||||||
GR.setwindow(xmin, xmax, ymin, ymax)
|
GR.setwindow(xmin, xmax, ymin, ymax)
|
||||||
GR.setscale(scale)
|
GR.setscale(scale)
|
||||||
|
|
||||||
@ -371,8 +374,12 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
if outside_ticks
|
if outside_ticks
|
||||||
ticksize = -ticksize
|
ticksize = -ticksize
|
||||||
end
|
end
|
||||||
if grid_flag && fg == 1
|
if grid_flag
|
||||||
GR.grid(xtick, ytick, 0, 0, majorx, majory)
|
if dark_bg
|
||||||
|
GR.grid(xtick * majorx, ytick * majory, 0, 0, 1, 1)
|
||||||
|
else
|
||||||
|
GR.grid(xtick, ytick, 0, 0, majorx, majory)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
GR.setlinecolorind(gr_getcolorind(d[:foreground_color_axis]))
|
GR.setlinecolorind(gr_getcolorind(d[:foreground_color_axis]))
|
||||||
if num_axes == 1
|
if num_axes == 1
|
||||||
|
|||||||
@ -459,24 +459,59 @@ end
|
|||||||
|
|
||||||
function setup_dataframes()
|
function setup_dataframes()
|
||||||
@require DataFrames begin
|
@require DataFrames begin
|
||||||
|
# @eval begin
|
||||||
|
# import DataFrames
|
||||||
|
|
||||||
get_data(df::DataFrames.AbstractDataFrame, arg::Symbol) = df[arg]
|
DFS = Union{Symbol, AbstractVector{Symbol}}
|
||||||
get_data(df::DataFrames.AbstractDataFrame, arg) = arg
|
|
||||||
|
|
||||||
function process_inputs(plt::AbstractPlot, d::KW, df::DataFrames.AbstractDataFrame, args...)
|
function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, dfs::DFS)
|
||||||
# d[:dataframe] = df
|
if isa(dfs, Symbol)
|
||||||
process_inputs(plt, d, map(arg -> get_data(df, arg), args)...)
|
get!(d, symbol(letter * "label"), string(dfs))
|
||||||
end
|
collect(df[dfs])
|
||||||
|
|
||||||
# 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
|
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
|
||||||
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)
|
# function getDataFrameFromKW(d::KW)
|
||||||
# get(d, :dataframe) do
|
# get(d, :dataframe) do
|
||||||
# error("Missing dataframe argument!")
|
# error("Missing dataframe argument!")
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
julia 0.4
|
julia 0.4
|
||||||
|
|
||||||
|
RecipesBase
|
||||||
Colors
|
Colors
|
||||||
Reexport
|
Reexport
|
||||||
Requires
|
Requires
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user