diff --git a/src/MadsPlot.jl b/src/MadsPlot.jl index 87d31123..dd021158 100644 --- a/src/MadsPlot.jl +++ b/src/MadsPlot.jl @@ -1153,7 +1153,7 @@ Dumps: - Plots of data series """ -function plotseriesengine(X::Union{AbstractMatrix,AbstractVector}, filename::AbstractString=""; nT::Integer=size(X, 1), nS::Integer=size(X, 2), format::AbstractString="", xtitle::AbstractString = "", ytitle::AbstractString = "", title::AbstractString="", logx::Bool=false, logy::Bool=false, keytitle::AbstractString="", name::AbstractString="Signal", names::Vector{String}=["$name $(i)" for i in 1:nS], combined::Bool=true, hsize::Measures.AbsoluteLength=8Gadfly.inch, vsize::Measures.AbsoluteLength=4Gadfly.inch, linewidth::Measures.AbsoluteLength=2Gadfly.pt, linestyle::Union{Symbol,AbstractVector}=:solid, pointsize::Measures.AbsoluteLength=2Gadfly.pt, key_position::Symbol=:right, major_label_font_size=14Gadfly.pt, minor_label_font_size=12Gadfly.pt, dpi::Integer=Mads.imagedpi, colors::Vector{String}=Mads.colors, opacity::Number=1.0, xmin::Any=nothing, xmax::Any=nothing, ymin::Any=nothing, ymax::Any=nothing, xaxis=1:nT, plotline::Bool=true, plotdots::Bool=!plotline, nextgray::Bool=false, lastcolored::Bool=false, code::Bool=false, returnplot::Bool=false, colorkey::Bool=(nS>ncolors) ? false : true, background_color=nothing, gm::Any=[], gl::Any=[], quiet::Bool=!Mads.graphoutput, truth::Bool=false, gall::Bool=false) +function plotseriesengine(X::Union{AbstractMatrix,AbstractVector}, filename::AbstractString=""; nT::Integer=size(X, 1), nS::Integer=size(X, 2), format::AbstractString="", xtitle::AbstractString = "", ytitle::AbstractString = "", title::AbstractString="", logx::Bool=false, logy::Bool=false, keytitle::AbstractString="", name::AbstractString="Signal", names::Vector{String}=["$name $(i)" for i in 1:nS], combined::Bool=true, hsize::Measures.AbsoluteLength=8Gadfly.inch, vsize::Measures.AbsoluteLength=4Gadfly.inch, linewidth::Measures.AbsoluteLength=2Gadfly.pt, linestyle::Union{Symbol,AbstractVector}=:solid, pointsize::Measures.AbsoluteLength=2Gadfly.pt, key_position::Symbol=:right, major_label_font_size=14Gadfly.pt, minor_label_font_size=12Gadfly.pt, dpi::Integer=Mads.imagedpi, colors::Vector{String}=Mads.colors, alpha::Number=0.2, alphas::AbstractVector=[alpha], xmin::Any=nothing, xmax::Any=nothing, ymin::Any=nothing, ymax::Any=nothing, xaxis=1:nT, plotline::Bool=true, plotdots::Bool=!plotline, nextgray::Bool=false, lastcolored::Bool=false, code::Bool=false, returnplot::Bool=false, colorkey::Bool=(nS>ncolors) ? false : true, background_color=nothing, gm::Any=[], gl::Any=[], quiet::Bool=!Mads.graphoutput, truth::Bool=false, gall::Bool=false) if nT == 0 || nS == 0 @warn "Input is empty $(size(X)); a matrix or a vector is needed!" return @@ -1225,22 +1225,24 @@ function plotseriesengine(X::Union{AbstractMatrix,AbstractVector}, filename::Abs if nextgray cs = [] if lastcolored - default_colors = [[Colors.RGBA(parse(Colors.Colorant, "gray"), opacity) for i in 2:nS]; Colors.RGBA(parse(Colors.Colorant, colors[1]), opacity)] + default_colors = [[Colors.RGBA(parse(Colors.Colorant, "gray"), alpha) for i in 2:nS]; Colors.RGBA(parse(Colors.Colorant, colors[1]), alpha)] else - default_colors = [Colors.RGBA(parse(Colors.Colorant, colors[1]), opacity); [Colors.RGBA(parse(Colors.Colorant, "gray"), opacity) for i in 2:nS]] + default_colors = [Colors.RGBA(parse(Colors.Colorant, colors[1]), alpha); [Colors.RGBA(parse(Colors.Colorant, "gray"), alpha) for i in 2:nS]] end else if nS <= ncolors cs = colorkey ? [Gadfly.Guide.manual_color_key(keytitle, names, [colors[i] for i in 1:nS])] : [] - default_colors = [Colors.RGBA(parse(Colors.Colorant, colors[i]), opacity) for i in 1:nS] + default_colors = [Colors.RGBA(parse(Colors.Colorant, colors[i]), alpha) for i in 1:nS] else cs = colorkey ? [Gadfly.Guide.manual_color_key(keytitle, names, [colors[(i-1)%ncolors+1] for i in 1:nS])] : [] - default_colors = [Colors.RGBA(parse(Colors.Colorant, colors[(i-1)%ncolors+1]), opacity) for i in 1:nS] + default_colors = [Colors.RGBA(parse(Colors.Colorant, colors[(i-1)%ncolors+1]), alpha) for i in 1:nS] end end + # RGBA does not impact opacity + # Gadfly.There alphas impact opacity c = [Gadfly.layer(x=xaxis, y=X[:,i], geometry[i]..., - Gadfly.Theme(line_width=linewidthea[i], line_style=[linestylea[i]], point_size=pointsize, highlight_width=0Gadfly.pt, discrete_highlight_color=c->nothing, default_color=default_colors[i])) + Gadfly.Theme(line_width=linewidthea[i], line_style=[linestylea[i]], point_size=pointsize, highlight_width=0Gadfly.pt, discrete_highlight_color=c->nothing, default_color=default_colors[i], alphas=alphas)) for i in 1:nS]..., mck..., gl...,