fixes for gadfly and unicodeplots
This commit is contained in:
parent
b153dcbd63
commit
55e388513c
@ -51,7 +51,10 @@ const examples = PlotExample[
|
|||||||
PlotExample("Global",
|
PlotExample("Global",
|
||||||
"Change the guides/background/limits/ticks. Convenience args `xaxis` and `yaxis` allow you to pass a tuple or value which will be mapped to the relevant args automatically. The `xaxis` below will be replaced with `xlabel` and `xlims` args automatically during the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`, `yaxis!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!`",
|
"Change the guides/background/limits/ticks. Convenience args `xaxis` and `yaxis` allow you to pass a tuple or value which will be mapped to the relevant args automatically. The `xaxis` below will be replaced with `xlabel` and `xlims` args automatically during the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`, `yaxis!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!`",
|
||||||
[
|
[
|
||||||
:(plot(rand(20,3), xaxis=("XLABEL",(-5,30),0:2:20,:flip), background_color = RGB(0.2,0.2,0.2), leg=false)),
|
:(y = rand(20,3)),
|
||||||
|
:(plot(y, xaxis=("XLABEL",(-5,30),0:2:20,:flip), background_color = RGB(0.2,0.2,0.2), leg=false)),
|
||||||
|
:(hline!(mean(y,1)+rand(1,3), line=(4,:dash,0.6,[:lightgreen :green :darkgreen]))),
|
||||||
|
:(vline!([5,10])),
|
||||||
:(title!("TITLE")),
|
:(title!("TITLE")),
|
||||||
:(yaxis!("YLABEL", :log10))
|
:(yaxis!("YLABEL", :log10))
|
||||||
]),
|
]),
|
||||||
|
|||||||
@ -63,17 +63,19 @@ end
|
|||||||
|
|
||||||
function getGadflyLineTheme(d::Dict)
|
function getGadflyLineTheme(d::Dict)
|
||||||
|
|
||||||
lc = getColor(d[:linecolor])
|
lc = convertColor(getColor(d[:linecolor]), d[:linealpha])
|
||||||
α = d[:linealpha]
|
# lc = getColor(d[:linecolor])
|
||||||
if α != nothing
|
# α = d[:linealpha]
|
||||||
lc = RGBA(lc, α)
|
# if α != nothing
|
||||||
end
|
# lc = RGBA(lc, α)
|
||||||
|
# end
|
||||||
|
|
||||||
fc = getColor(d[:fillcolor])
|
fc = convertColor(getColor(d[:fillcolor]), d[:fillalpha])
|
||||||
α = d[:fillalpha]
|
# fc = getColor(d[:fillcolor])
|
||||||
if α != nothing
|
# α = d[:fillalpha]
|
||||||
fc = RGBA(fc, α)
|
# if α != nothing
|
||||||
end
|
# fc = RGBA(fc, α)
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
Gadfly.Theme(;
|
Gadfly.Theme(;
|
||||||
@ -104,23 +106,49 @@ function addGadflyLine!(plt::Plot, numlayers::Int, d::Dict, geoms...)
|
|||||||
push!(gfargs, Gadfly.Geom.ribbon)
|
push!(gfargs, Gadfly.Geom.ribbon)
|
||||||
end
|
end
|
||||||
|
|
||||||
# h/vlines
|
if lt in (:hline, :vline)
|
||||||
if lt == :hline
|
kwargs[lt == :hline ? :yintercept : :xintercept] = d[:y]
|
||||||
kwargs[:yintercept] = d[:y]
|
|
||||||
elseif lt == :vline
|
else
|
||||||
kwargs[:xintercept] = d[:y]
|
if lt == :sticks
|
||||||
elseif lt == :sticks
|
w = 0.01 * mean(diff(d[:x]))
|
||||||
w = 0.01 * mean(diff(d[:x]))
|
kwargs[:xmin] = d[:x] - w
|
||||||
kwargs[:xmin] = d[:x] - w
|
kwargs[:xmax] = d[:x] + w
|
||||||
kwargs[:xmax] = d[:x] + w
|
elseif lt == :contour
|
||||||
elseif lt == :contour
|
d[:y] = reverse(d[:y])
|
||||||
d[:y] = reverse(d[:y])
|
kwargs[:z] = d[:surface]
|
||||||
kwargs[:z] = d[:surface]
|
end
|
||||||
|
|
||||||
|
kwargs[:x] = d[lt == :hist ? :y : :x]
|
||||||
|
kwargs[:y] = d[:y]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# add the layer
|
# # h/vlines
|
||||||
x = d[d[:linetype] == :hist ? :y : :x]
|
# if lt == :hline
|
||||||
Gadfly.layer(gfargs...; x = x, y = d[:y], order=numlayers, kwargs...)
|
# kwargs[:yintercept] = d[:y]
|
||||||
|
# elseif lt == :vline
|
||||||
|
# kwargs[:xintercept] = d[:y]
|
||||||
|
# elseif lt == :sticks
|
||||||
|
# w = 0.01 * mean(diff(d[:x]))
|
||||||
|
# kwargs[:xmin] = d[:x] - w
|
||||||
|
# kwargs[:xmax] = d[:x] + w
|
||||||
|
# elseif lt == :contour
|
||||||
|
# d[:y] = reverse(d[:y])
|
||||||
|
# kwargs[:z] = d[:surface]
|
||||||
|
# end
|
||||||
|
|
||||||
|
# if lt == :hist
|
||||||
|
# kwargs[:x] = kwargs[:y] = d[:y]
|
||||||
|
# elseif lt != :hline && lt != :vline
|
||||||
|
# kwargs[:x] = d[:x]
|
||||||
|
# kwargs[:y] = d[:y]
|
||||||
|
# end
|
||||||
|
|
||||||
|
# # add the layer
|
||||||
|
# x = d[d[:linetype] == :hist ? :y : :x]
|
||||||
|
# Gadfly.layer(gfargs...; x = x, y = d[:y], order=numlayers, kwargs...)
|
||||||
|
Gadfly.layer(gfargs...; order=numlayers, kwargs...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -217,7 +217,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
|
|||||||
linecolor = color
|
linecolor = color
|
||||||
linestyle = getPyPlotLineStyle(lt, d[:linestyle])
|
linestyle = getPyPlotLineStyle(lt, d[:linestyle])
|
||||||
for yi in d[:y]
|
for yi in d[:y]
|
||||||
func = ax[lt == :hline ? :axhline : axvline]
|
func = ax[lt == :hline ? :axhline : :axvline]
|
||||||
func(yi, linewidth=d[:linewidth], color=linecolor, linestyle=linestyle)
|
func(yi, linewidth=d[:linewidth], color=linecolor, linestyle=linestyle)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ function rebuildUnicodePlot!(plt::Plot)
|
|||||||
|
|
||||||
# create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds
|
# create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds
|
||||||
width, height = iargs[:size]
|
width, height = iargs[:size]
|
||||||
o = UnicodePlots.createPlotWindow(x, y; width = width,
|
o = UnicodePlots.Plot(x, y; width = width,
|
||||||
height = height,
|
height = height,
|
||||||
title = iargs[:title],
|
title = iargs[:title],
|
||||||
# labels = iargs[:legend],
|
# labels = iargs[:legend],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user