!= nothing -> !== nothing
This commit is contained in:
parent
0950c738e3
commit
82dd5bf3eb
@ -1121,7 +1121,7 @@ end
|
|||||||
|
|
||||||
function _filter_input_data!(plotattributes::KW)
|
function _filter_input_data!(plotattributes::KW)
|
||||||
idxfilter = pop!(plotattributes, :idxfilter, nothing)
|
idxfilter = pop!(plotattributes, :idxfilter, nothing)
|
||||||
if idxfilter != nothing
|
if idxfilter !== nothing
|
||||||
filter_data!(plotattributes, idxfilter)
|
filter_data!(plotattributes, idxfilter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1602,13 +1602,13 @@ function _update_series_attributes!(plotattributes::KW, plt::Plot, sp::Subplot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# if marker_z, fill_z or line_z are set, ensure we have a gradient
|
# if marker_z, fill_z or line_z are set, ensure we have a gradient
|
||||||
if plotattributes[:marker_z] != nothing
|
if plotattributes[:marker_z] !== nothing
|
||||||
ensure_gradient!(plotattributes, :markercolor, :markeralpha)
|
ensure_gradient!(plotattributes, :markercolor, :markeralpha)
|
||||||
end
|
end
|
||||||
if plotattributes[:line_z] != nothing
|
if plotattributes[:line_z] !== nothing
|
||||||
ensure_gradient!(plotattributes, :linecolor, :linealpha)
|
ensure_gradient!(plotattributes, :linecolor, :linealpha)
|
||||||
end
|
end
|
||||||
if plotattributes[:fill_z] != nothing
|
if plotattributes[:fill_z] !== nothing
|
||||||
ensure_gradient!(plotattributes, :fillcolor, :fillalpha)
|
ensure_gradient!(plotattributes, :fillcolor, :fillalpha)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -382,7 +382,7 @@ function expand_extrema!(sp::Subplot, plotattributes::KW)
|
|||||||
data = plotattributes[letter] = Surface(Matrix{Float64}(data.surf))
|
data = plotattributes[letter] = Surface(Matrix{Float64}(data.surf))
|
||||||
end
|
end
|
||||||
expand_extrema!(axis, data)
|
expand_extrema!(axis, data)
|
||||||
elseif data != nothing
|
elseif data !== nothing
|
||||||
# TODO: need more here... gotta track the discrete reference value
|
# TODO: need more here... gotta track the discrete reference value
|
||||||
# as well as any coord offset (think of boxplot shape coords... they all
|
# as well as any coord offset (think of boxplot shape coords... they all
|
||||||
# correspond to the same x-value)
|
# correspond to the same x-value)
|
||||||
@ -402,7 +402,7 @@ function expand_extrema!(sp::Subplot, plotattributes::KW)
|
|||||||
if fr === nothing && plotattributes[:seriestype] == :bar
|
if fr === nothing && plotattributes[:seriestype] == :bar
|
||||||
fr = 0.0
|
fr = 0.0
|
||||||
end
|
end
|
||||||
if fr != nothing && !all3D(plotattributes)
|
if fr !== nothing && !all3D(plotattributes)
|
||||||
axis = sp.attr[vert ? :yaxis : :xaxis]
|
axis = sp.attr[vert ? :yaxis : :xaxis]
|
||||||
if typeof(fr) <: Tuple
|
if typeof(fr) <: Tuple
|
||||||
for fri in fr
|
for fri in fr
|
||||||
|
|||||||
@ -147,7 +147,7 @@ gr_inqtext(x, y, s::Symbol) = gr_inqtext(x, y, string(s))
|
|||||||
function gr_inqtext(x, y, s)
|
function gr_inqtext(x, y, s)
|
||||||
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
|
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
|
||||||
GR.inqmathtex(x, y, s[2:end-1])
|
GR.inqmathtex(x, y, s[2:end-1])
|
||||||
elseif findfirst(isequal('\\'), s) != nothing || occursin("10^{", s)
|
elseif findfirst(isequal('\\'), s) !== nothing || occursin("10^{", s)
|
||||||
GR.inqtextext(x, y, s)
|
GR.inqtextext(x, y, s)
|
||||||
else
|
else
|
||||||
GR.inqtext(x, y, s)
|
GR.inqtext(x, y, s)
|
||||||
@ -159,7 +159,7 @@ gr_text(x, y, s::Symbol) = gr_text(x, y, string(s))
|
|||||||
function gr_text(x, y, s)
|
function gr_text(x, y, s)
|
||||||
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
|
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
|
||||||
GR.mathtex(x, y, s[2:end-1])
|
GR.mathtex(x, y, s[2:end-1])
|
||||||
elseif findfirst(isequal('\\'), s) != nothing || occursin("10^{", s)
|
elseif findfirst(isequal('\\'), s) !== nothing || occursin("10^{", s)
|
||||||
GR.textext(x, y, s)
|
GR.textext(x, y, s)
|
||||||
else
|
else
|
||||||
GR.text(x, y, s)
|
GR.text(x, y, s)
|
||||||
@ -237,7 +237,7 @@ gr_z_axislims(sp::Subplot) = axis_limits(sp, :z)
|
|||||||
gr_xy_axislims(sp::Subplot) = gr_x_axislims(sp)..., gr_y_axislims(sp)...
|
gr_xy_axislims(sp::Subplot) = gr_x_axislims(sp)..., gr_y_axislims(sp)...
|
||||||
|
|
||||||
function gr_lims(sp::Subplot, axis::Axis, adjust::Bool, expand = nothing)
|
function gr_lims(sp::Subplot, axis::Axis, adjust::Bool, expand = nothing)
|
||||||
if expand != nothing
|
if expand !== nothing
|
||||||
expand_extrema!(axis, expand)
|
expand_extrema!(axis, expand)
|
||||||
end
|
end
|
||||||
lims = axis_limits(sp, axis[:letter])
|
lims = axis_limits(sp, axis[:letter])
|
||||||
@ -629,11 +629,11 @@ function gr_get_color(series::Series)
|
|||||||
series[:fillcolor]
|
series[:fillcolor]
|
||||||
elseif st in (:contour, :wireframe)
|
elseif st in (:contour, :wireframe)
|
||||||
series[:linecolor]
|
series[:linecolor]
|
||||||
elseif series[:marker_z] != nothing
|
elseif series[:marker_z] !== nothing
|
||||||
series[:markercolor]
|
series[:markercolor]
|
||||||
elseif series[:line_z] != nothing
|
elseif series[:line_z] != nothing
|
||||||
series[:linecolor]
|
series[:linecolor]
|
||||||
elseif series[:fill_z] != nothing
|
elseif series[:fill_z] !== nothing
|
||||||
series[:fillcolor]
|
series[:fillcolor]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -880,7 +880,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
GR.selntran(0)
|
GR.selntran(0)
|
||||||
GR.setscale(0)
|
GR.setscale(0)
|
||||||
gr_set_font(legendfont(sp))
|
gr_set_font(legendfont(sp))
|
||||||
if sp[:legendtitle] != nothing
|
if sp[:legendtitle] !== nothing
|
||||||
tbx, tby = gr_inqtext(0, 0, string(sp[:legendtitle]))
|
tbx, tby = gr_inqtext(0, 0, string(sp[:legendtitle]))
|
||||||
legendw = tbx[3] - tbx[1]
|
legendw = tbx[3] - tbx[1]
|
||||||
legendn += 1
|
legendn += 1
|
||||||
@ -1247,7 +1247,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
if typeof(z) <: Surface
|
if typeof(z) <: Surface
|
||||||
z = vec(transpose_z(series, z.surf, false))
|
z = vec(transpose_z(series, z.surf, false))
|
||||||
elseif ispolar(sp)
|
elseif ispolar(sp)
|
||||||
if frng != nothing
|
if frng !== nothing
|
||||||
_, frng = convert_to_polar(x, frng, (rmin, rmax))
|
_, frng = convert_to_polar(x, frng, (rmin, rmax))
|
||||||
end
|
end
|
||||||
x, y = convert_to_polar(x, y, (rmin, rmax))
|
x, y = convert_to_polar(x, y, (rmin, rmax))
|
||||||
@ -1258,11 +1258,11 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if st in (:path, :scatter, :straightline)
|
if st in (:path, :scatter, :straightline)
|
||||||
if x != nothing && length(x) > 1
|
if x !== nothing && length(x) > 1
|
||||||
lz = series[:line_z]
|
lz = series[:line_z]
|
||||||
segments = iter_segments(series)
|
segments = iter_segments(series)
|
||||||
# do area fill
|
# do area fill
|
||||||
if frng != nothing
|
if frng !== nothing
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
fr_from, fr_to = (is_2tuple(frng) ? frng : (y, frng))
|
fr_from, fr_to = (is_2tuple(frng) ? frng : (y, frng))
|
||||||
for (i, rng) in enumerate(segments)
|
for (i, rng) in enumerate(segments)
|
||||||
@ -1301,7 +1301,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
plot_color(series[:linecolor]) in (black,[black])
|
plot_color(series[:linecolor]) in (black,[black])
|
||||||
end
|
end
|
||||||
h = gr_contour_levels(series, clims)
|
h = gr_contour_levels(series, clims)
|
||||||
if series[:fillrange] != nothing
|
if series[:fillrange] !== nothing
|
||||||
if series[:fillcolor] != series[:linecolor] && !is_lc_black
|
if series[:fillcolor] != series[:linecolor] && !is_lc_black
|
||||||
@warn("GR: filled contour only supported with black contour lines")
|
@warn("GR: filled contour only supported with black contour lines")
|
||||||
end
|
end
|
||||||
@ -1496,7 +1496,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
gr_set_line(1, :solid, sp[:foreground_color_legend])
|
gr_set_line(1, :solid, sp[:foreground_color_legend])
|
||||||
GR.drawrect(xpos - 0.08, xpos + w + 0.02, ypos + dy, ypos - dy * n)
|
GR.drawrect(xpos - 0.08, xpos + w + 0.02, ypos + dy, ypos - dy * n)
|
||||||
i = 0
|
i = 0
|
||||||
if sp[:legendtitle] != nothing
|
if sp[:legendtitle] !== nothing
|
||||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_HALF)
|
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_HALF)
|
||||||
gr_set_textcolor(sp[:legendfontcolor])
|
gr_set_textcolor(sp[:legendfontcolor])
|
||||||
gr_set_transparency(sp[:legendfontcolor])
|
gr_set_transparency(sp[:legendfontcolor])
|
||||||
@ -1509,7 +1509,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
lc = get_linecolor(series, clims)
|
lc = get_linecolor(series, clims)
|
||||||
gr_set_line(get_linewidth(series), get_linestyle(series), lc) #, series[:linealpha])
|
gr_set_line(get_linewidth(series), get_linestyle(series), lc) #, series[:linealpha])
|
||||||
|
|
||||||
if (st == :shape || series[:fillrange] != nothing) && series[:ribbon] === nothing
|
if (st == :shape || series[:fillrange] !== nothing) && series[:ribbon] === nothing
|
||||||
fc = get_fillcolor(series, clims)
|
fc = get_fillcolor(series, clims)
|
||||||
gr_set_fill(fc) #, series[:fillalpha])
|
gr_set_fill(fc) #, series[:fillalpha])
|
||||||
l, r = xpos-0.07, xpos-0.01
|
l, r = xpos-0.07, xpos-0.01
|
||||||
@ -1526,7 +1526,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
|
|
||||||
if st in (:path, :straightline)
|
if st in (:path, :straightline)
|
||||||
gr_set_transparency(lc, get_linealpha(series))
|
gr_set_transparency(lc, get_linealpha(series))
|
||||||
if series[:fillrange] === nothing || series[:ribbon] != nothing
|
if series[:fillrange] === nothing || series[:ribbon] !== nothing
|
||||||
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos, ypos])
|
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos, ypos])
|
||||||
else
|
else
|
||||||
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos+0.4dy, ypos+0.4dy])
|
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos+0.4dy, ypos+0.4dy])
|
||||||
|
|||||||
@ -121,9 +121,9 @@ function _create_backend_figure(plt::Plot{InspectDRBackend})
|
|||||||
gplot = _inspectdr_getgui(plt.o)
|
gplot = _inspectdr_getgui(plt.o)
|
||||||
|
|
||||||
#:overwrite_figure: want to reuse current figure
|
#:overwrite_figure: want to reuse current figure
|
||||||
if plt[:overwrite_figure] && mplot != nothing
|
if plt[:overwrite_figure] && mplot !== nothing
|
||||||
mplot.subplots = [] #Reset
|
mplot.subplots = [] #Reset
|
||||||
if gplot != nothing #Ensure still references current plot
|
if gplot !== nothing #Ensure still references current plot
|
||||||
gplot.src = mplot
|
gplot.src = mplot
|
||||||
end
|
end
|
||||||
else #want new one:
|
else #want new one:
|
||||||
|
|||||||
@ -96,7 +96,7 @@ pgf_thickness_scaling(series) = pgf_thickness_scaling(series[:subplot])
|
|||||||
function pgf_fillstyle(plotattributes, i = 1)
|
function pgf_fillstyle(plotattributes, i = 1)
|
||||||
cstr,a = pgf_color(get_fillcolor(plotattributes, i))
|
cstr,a = pgf_color(get_fillcolor(plotattributes, i))
|
||||||
fa = get_fillalpha(plotattributes, i)
|
fa = get_fillalpha(plotattributes, i)
|
||||||
if fa != nothing
|
if fa !== nothing
|
||||||
a = fa
|
a = fa
|
||||||
end
|
end
|
||||||
"fill = $cstr, fill opacity=$a"
|
"fill = $cstr, fill opacity=$a"
|
||||||
@ -216,12 +216,12 @@ function pgf_series(sp::Subplot, series::Series)
|
|||||||
|
|
||||||
# add to legend?
|
# add to legend?
|
||||||
if i == 1 && sp[:legend] != :none && should_add_to_legend(series)
|
if i == 1 && sp[:legend] != :none && should_add_to_legend(series)
|
||||||
if plotattributes[:fillrange] != nothing
|
if plotattributes[:fillrange] !== nothing
|
||||||
push!(style, "forget plot")
|
push!(style, "forget plot")
|
||||||
push!(series_collection, pgf_fill_legend_hack(plotattributes, args))
|
push!(series_collection, pgf_fill_legend_hack(plotattributes, args))
|
||||||
else
|
else
|
||||||
kw[:legendentry] = plotattributes[:label]
|
kw[:legendentry] = plotattributes[:label]
|
||||||
if st == :shape # || plotattributes[:fillrange] != nothing
|
if st == :shape # || plotattributes[:fillrange] !== nothing
|
||||||
push!(style, "area legend")
|
push!(style, "area legend")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -238,7 +238,7 @@ function pgf_series(sp::Subplot, series::Series)
|
|||||||
kw[:style] = join(style, ',')
|
kw[:style] = join(style, ',')
|
||||||
|
|
||||||
# add fillrange
|
# add fillrange
|
||||||
if series[:fillrange] != nothing && st != :shape
|
if series[:fillrange] !== nothing && st != :shape
|
||||||
push!(series_collection, pgf_fillrange_series(series, i, _cycle(series[:fillrange], rng), seg_args...))
|
push!(series_collection, pgf_fillrange_series(series, i, _cycle(series[:fillrange], rng), seg_args...))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -403,7 +403,7 @@ end
|
|||||||
function plotly_data(series::Series, letter::Symbol, data)
|
function plotly_data(series::Series, letter::Symbol, data)
|
||||||
axis = series[:subplot][Symbol(letter, :axis)]
|
axis = series[:subplot][Symbol(letter, :axis)]
|
||||||
|
|
||||||
data = if axis[:ticks] == :native && data != nothing
|
data = if axis[:ticks] == :native && data !== nothing
|
||||||
plotly_native_data(axis, data)
|
plotly_native_data(axis, data)
|
||||||
else
|
else
|
||||||
data
|
data
|
||||||
@ -415,7 +415,7 @@ function plotly_data(series::Series, letter::Symbol, data)
|
|||||||
plotly_data(data)
|
plotly_data(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
plotly_data(v) = v != nothing ? collect(v) : v
|
plotly_data(v) = v !== nothing ? collect(v) : v
|
||||||
plotly_data(surf::Surface) = surf.surf
|
plotly_data(surf::Surface) = surf.surf
|
||||||
plotly_data(v::AbstractArray{R}) where {R<:Rational} = float(v)
|
plotly_data(v::AbstractArray{R}) where {R<:Rational} = float(v)
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
else
|
else
|
||||||
plotattributes_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
|
plotattributes_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
|
||||||
plotattributes_out[:opacity] = series[:fillalpha]
|
plotattributes_out[:opacity] = series[:fillalpha]
|
||||||
if series[:fill_z] != nothing
|
if series[:fill_z] !== nothing
|
||||||
plotattributes_out[:surfacecolor] = plotly_surface_data(series, series[:fill_z])
|
plotattributes_out[:surfacecolor] = plotly_surface_data(series, series[:fill_z])
|
||||||
end
|
end
|
||||||
plotattributes_out[:showscale] = hascolorbar(sp)
|
plotattributes_out[:showscale] = hascolorbar(sp)
|
||||||
@ -611,11 +611,11 @@ function plotly_series_shapes(plt::Plot, series::Series, clims)
|
|||||||
plotly_hover!(plotattributes_out, _cycle(series[:hover], i))
|
plotly_hover!(plotattributes_out, _cycle(series[:hover], i))
|
||||||
plotattributes_outs[i] = plotattributes_out
|
plotattributes_outs[i] = plotattributes_out
|
||||||
end
|
end
|
||||||
if series[:fill_z] != nothing
|
if series[:fill_z] !== nothing
|
||||||
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :fill))
|
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :fill))
|
||||||
elseif series[:line_z] != nothing
|
elseif series[:line_z] !== nothing
|
||||||
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :line))
|
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :line))
|
||||||
elseif series[:marker_z] != nothing
|
elseif series[:marker_z] !== nothing
|
||||||
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :marker))
|
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :marker))
|
||||||
end
|
end
|
||||||
plotattributes_outs
|
plotattributes_outs
|
||||||
@ -733,11 +733,11 @@ function plotly_series_segments(series::Series, plotattributes_base::KW, x, y, z
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if series[:line_z] != nothing
|
if series[:line_z] !== nothing
|
||||||
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :line))
|
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :line))
|
||||||
elseif series[:fill_z] != nothing
|
elseif series[:fill_z] !== nothing
|
||||||
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :fill))
|
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :fill))
|
||||||
elseif series[:marker_z] != nothing
|
elseif series[:marker_z] !== nothing
|
||||||
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :marker))
|
push!(plotattributes_outs, plotly_colorbar_hack(series, plotattributes_base, :marker))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -782,7 +782,7 @@ function plotly_hover!(plotattributes_out::KW, hover)
|
|||||||
# hover text
|
# hover text
|
||||||
if hover in (:none, false)
|
if hover in (:none, false)
|
||||||
plotattributes_out[:hoverinfo] = "none"
|
plotattributes_out[:hoverinfo] = "none"
|
||||||
elseif hover != nothing
|
elseif hover !== nothing
|
||||||
plotattributes_out[:hoverinfo] = "text"
|
plotattributes_out[:hoverinfo] = "text"
|
||||||
plotattributes_out[:text] = hover
|
plotattributes_out[:text] = hover
|
||||||
end
|
end
|
||||||
|
|||||||
@ -216,7 +216,7 @@ end
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function fix_xy_lengths!(plt::Plot{PyPlotBackend}, series::Series)
|
function fix_xy_lengths!(plt::Plot{PyPlotBackend}, series::Series)
|
||||||
if series[:x] != nothing
|
if series[:x] !== nothing
|
||||||
x, y = series[:x], series[:y]
|
x, y = series[:x], series[:y]
|
||||||
nx, ny = length(x), length(y)
|
nx, ny = length(x), length(y)
|
||||||
if !isa(get(series.plotattributes, :z, nothing), Surface) && nx != ny
|
if !isa(get(series.plotattributes, :z, nothing), Surface) && nx != ny
|
||||||
@ -434,7 +434,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
if maximum(series[:linewidth]) > 0
|
if maximum(series[:linewidth]) > 0
|
||||||
segments = iter_segments(series)
|
segments = iter_segments(series)
|
||||||
# TODO: check LineCollection alternative for speed
|
# TODO: check LineCollection alternative for speed
|
||||||
# if length(segments) > 1 && (any(typeof(series[attr]) <: AbstractVector for attr in (:fillcolor, :fillalpha)) || series[:fill_z] != nothing) && !(typeof(series[:linestyle]) <: AbstractVector)
|
# if length(segments) > 1 && (any(typeof(series[attr]) <: AbstractVector for attr in (:fillcolor, :fillalpha)) || series[:fill_z] !== nothing) && !(typeof(series[:linestyle]) <: AbstractVector)
|
||||||
# # multicolored line segments
|
# # multicolored line segments
|
||||||
# n = length(segments)
|
# n = length(segments)
|
||||||
# # segments = Array(Any,n)
|
# # segments = Array(Any,n)
|
||||||
@ -478,7 +478,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
a = series[:arrow]
|
a = series[:arrow]
|
||||||
if a != nothing && !is3d(st) # TODO: handle 3d later
|
if a !== nothing && !is3d(st) # TODO: handle 3d later
|
||||||
if typeof(a) != Arrow
|
if typeof(a) != Arrow
|
||||||
@warn("Unexpected type for arrow: $(typeof(a))")
|
@warn("Unexpected type for arrow: $(typeof(a))")
|
||||||
else
|
else
|
||||||
@ -508,7 +508,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
if series[:markershape] != :none && st in (:path, :scatter, :path3d,
|
if series[:markershape] != :none && st in (:path, :scatter, :path3d,
|
||||||
:scatter3d, :steppre, :steppost,
|
:scatter3d, :steppre, :steppost,
|
||||||
:bar)
|
:bar)
|
||||||
markercolor = if any(typeof(series[arg]) <: AVec for arg in (:markercolor, :markeralpha)) || series[:marker_z] != nothing
|
markercolor = if any(typeof(series[arg]) <: AVec for arg in (:markercolor, :markeralpha)) || series[:marker_z] !== nothing
|
||||||
# py_color(plot_color.(get_markercolor.(series, clims, eachindex(x)), get_markeralpha.(series, eachindex(x))))
|
# py_color(plot_color.(get_markercolor.(series, clims, eachindex(x)), get_markeralpha.(series, eachindex(x))))
|
||||||
[py_color(plot_color(get_markercolor(series, clims, i), get_markeralpha(series, i))) for i in eachindex(x)]
|
[py_color(plot_color(get_markercolor(series, clims, i), get_markeralpha(series, i))) for i in eachindex(x)]
|
||||||
else
|
else
|
||||||
@ -672,7 +672,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
|
|
||||||
# contour fills
|
# contour fills
|
||||||
if series[:fillrange] != nothing
|
if series[:fillrange] !== nothing
|
||||||
handle = ax."contourf"(x, y, z, levelargs...;
|
handle = ax."contourf"(x, y, z, levelargs...;
|
||||||
label = series[:label],
|
label = series[:label],
|
||||||
zorder = series[:series_plotindex] + 0.5,
|
zorder = series[:series_plotindex] + 0.5,
|
||||||
@ -691,7 +691,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
end
|
end
|
||||||
z = transpose_z(series, z)
|
z = transpose_z(series, z)
|
||||||
if st == :surface
|
if st == :surface
|
||||||
if series[:fill_z] != nothing
|
if series[:fill_z] !== nothing
|
||||||
# the surface colors are different than z-value
|
# the surface colors are different than z-value
|
||||||
extrakw[:facecolors] = py_shading(series[:fillcolor], transpose_z(series, series[:fill_z].surf))
|
extrakw[:facecolors] = py_shading(series[:fillcolor], transpose_z(series, series[:fill_z].surf))
|
||||||
extrakw[:shade] = false
|
extrakw[:shade] = false
|
||||||
@ -830,7 +830,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
|
|
||||||
# handle area filling
|
# handle area filling
|
||||||
fillrange = series[:fillrange]
|
fillrange = series[:fillrange]
|
||||||
if fillrange != nothing && st != :contour
|
if fillrange !== nothing && st != :contour
|
||||||
for (i, rng) in enumerate(iter_segments(series))
|
for (i, rng) in enumerate(iter_segments(series))
|
||||||
f, dim1, dim2 = if isvertical(series)
|
f, dim1, dim2 = if isvertical(series)
|
||||||
:fill_between, x[rng], y[rng]
|
:fill_between, x[rng], y[rng]
|
||||||
@ -1018,12 +1018,12 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
kw[:ticks] = locator
|
kw[:ticks] = locator
|
||||||
kw[:format] = formatter
|
kw[:format] = formatter
|
||||||
kw[:boundaries] = vcat(0, kw[:values] + 0.5)
|
kw[:boundaries] = vcat(0, kw[:values] + 0.5)
|
||||||
elseif any(colorbar_series[attr] != nothing for attr in (:line_z, :fill_z, :marker_z))
|
elseif any(colorbar_series[attr] !== nothing for attr in (:line_z, :fill_z, :marker_z))
|
||||||
cmin, cmax = get_clims(sp)
|
cmin, cmax = get_clims(sp)
|
||||||
norm = pycolors."Normalize"(vmin = cmin, vmax = cmax)
|
norm = pycolors."Normalize"(vmin = cmin, vmax = cmax)
|
||||||
f = if colorbar_series[:line_z] != nothing
|
f = if colorbar_series[:line_z] !== nothing
|
||||||
py_linecolormap
|
py_linecolormap
|
||||||
elseif colorbar_series[:fill_z] != nothing
|
elseif colorbar_series[:fill_z] !== nothing
|
||||||
py_fillcolormap
|
py_fillcolormap
|
||||||
else
|
else
|
||||||
py_markercolormap
|
py_markercolormap
|
||||||
@ -1297,7 +1297,7 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
|||||||
for series in series_list(sp)
|
for series in series_list(sp)
|
||||||
if should_add_to_legend(series)
|
if should_add_to_legend(series)
|
||||||
# add a line/marker and a label
|
# add a line/marker and a label
|
||||||
push!(handles, if series[:seriestype] == :shape || series[:fillrange] != nothing
|
push!(handles, if series[:seriestype] == :shape || series[:fillrange] !== nothing
|
||||||
pypatches."Patch"(
|
pypatches."Patch"(
|
||||||
edgecolor = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)),
|
edgecolor = py_color(single_color(get_linecolor(series, clims)), get_linealpha(series)),
|
||||||
facecolor = py_color(single_color(get_fillcolor(series, clims)), get_fillalpha(series)),
|
facecolor = py_color(single_color(get_fillcolor(series, clims)), get_fillalpha(series)),
|
||||||
@ -1335,7 +1335,7 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
|||||||
frame = leg."get_frame"()
|
frame = leg."get_frame"()
|
||||||
frame."set_linewidth"(py_thickness_scale(plt, 1))
|
frame."set_linewidth"(py_thickness_scale(plt, 1))
|
||||||
leg."set_zorder"(1000)
|
leg."set_zorder"(1000)
|
||||||
sp[:legendtitle] != nothing && leg."set_title"(sp[:legendtitle])
|
sp[:legendtitle] !== nothing && leg."set_title"(sp[:legendtitle])
|
||||||
|
|
||||||
for txt in leg."get_texts"()
|
for txt in leg."get_texts"()
|
||||||
PyPlot.plt."setp"(txt, color = py_color(sp[:legendfontcolor]), family = sp[:legendfontfamily])
|
PyPlot.plt."setp"(txt, color = py_color(sp[:legendfontcolor]), family = sp[:legendfontfamily])
|
||||||
|
|||||||
@ -529,7 +529,7 @@ function series_annotations_shapes!(series::Series, scaletype::Symbol = :pixels)
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
# @show msw msh
|
# @show msw msh
|
||||||
if anns != nothing && anns.baseshape != nothing
|
if anns !== nothing && anns.baseshape !== nothing
|
||||||
# we use baseshape to overwrite the markershape attribute
|
# we use baseshape to overwrite the markershape attribute
|
||||||
# with a list of custom shapes for each
|
# with a list of custom shapes for each
|
||||||
msw,msh = anns.scalefactor
|
msw,msh = anns.scalefactor
|
||||||
|
|||||||
@ -496,7 +496,7 @@ function test_examples(pkgname::Symbol; debug = false, disp = true, sleep = noth
|
|||||||
Plots._debugMode.on = debug
|
Plots._debugMode.on = debug
|
||||||
plts = Dict()
|
plts = Dict()
|
||||||
for i in 1:length(_examples)
|
for i in 1:length(_examples)
|
||||||
only != nothing && !(i in only) && continue
|
only !== nothing && !(i in only) && continue
|
||||||
i in skip && continue
|
i in skip && continue
|
||||||
try
|
try
|
||||||
plt = test_examples(pkgname, i, debug=debug, disp=disp)
|
plt = test_examples(pkgname, i, debug=debug, disp=disp)
|
||||||
@ -505,7 +505,7 @@ function test_examples(pkgname::Symbol; debug = false, disp = true, sleep = noth
|
|||||||
# TODO: put error info into markdown?
|
# TODO: put error info into markdown?
|
||||||
@warn("Example $pkgname:$i:$(_examples[i].header) failed with: $ex")
|
@warn("Example $pkgname:$i:$(_examples[i].header) failed with: $ex")
|
||||||
end
|
end
|
||||||
if sleep != nothing
|
if sleep !== nothing
|
||||||
Base.sleep(sleep)
|
Base.sleep(sleep)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -126,7 +126,7 @@ function _preprocess_userrecipe(kw::KW)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# convert a ribbon into a fillrange
|
# convert a ribbon into a fillrange
|
||||||
if get(kw, :ribbon, nothing) != nothing
|
if get(kw, :ribbon, nothing) !== nothing
|
||||||
make_fillrange_from_ribbon(kw)
|
make_fillrange_from_ribbon(kw)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
@ -136,7 +136,7 @@ function _add_errorbar_kw(kw_list::Vector{KW}, kw::KW)
|
|||||||
# handle error bars by creating new recipedata data... these will have
|
# handle error bars by creating new recipedata data... these will have
|
||||||
# the same recipedata index as the recipedata they are copied from
|
# the same recipedata index as the recipedata they are copied from
|
||||||
for esym in (:xerror, :yerror)
|
for esym in (:xerror, :yerror)
|
||||||
if get(kw, esym, nothing) != nothing
|
if get(kw, esym, nothing) !== nothing
|
||||||
# we make a copy of the KW and apply an errorbar recipe
|
# we make a copy of the KW and apply an errorbar recipe
|
||||||
errkw = copy(kw)
|
errkw = copy(kw)
|
||||||
errkw[:seriestype] = esym
|
errkw[:seriestype] = esym
|
||||||
@ -227,7 +227,7 @@ function _plot_setup(plt::Plot, plotattributes::KW, kw_list::Vector{KW})
|
|||||||
|
|
||||||
# handle inset subplots
|
# handle inset subplots
|
||||||
insets = plt[:inset_subplots]
|
insets = plt[:inset_subplots]
|
||||||
if insets != nothing
|
if insets !== nothing
|
||||||
if !(typeof(insets) <: AVec)
|
if !(typeof(insets) <: AVec)
|
||||||
insets = [insets]
|
insets = [insets]
|
||||||
end
|
end
|
||||||
|
|||||||
@ -291,13 +291,13 @@ end
|
|||||||
|
|
||||||
# create segmented bezier curves in place of line segments
|
# create segmented bezier curves in place of line segments
|
||||||
@recipe function f(::Type{Val{:curves}}, x, y, z; npoints = 30)
|
@recipe function f(::Type{Val{:curves}}, x, y, z; npoints = 30)
|
||||||
args = z != nothing ? (x,y,z) : (x,y)
|
args = z !== nothing ? (x,y,z) : (x,y)
|
||||||
newx, newy = zeros(0), zeros(0)
|
newx, newy = zeros(0), zeros(0)
|
||||||
fr = plotattributes[:fillrange]
|
fr = plotattributes[:fillrange]
|
||||||
newfr = fr != nothing ? zeros(0) : nothing
|
newfr = fr !== nothing ? zeros(0) : nothing
|
||||||
newz = z != nothing ? zeros(0) : nothing
|
newz = z !== nothing ? zeros(0) : nothing
|
||||||
# lz = plotattributes[:line_z]
|
# lz = plotattributes[:line_z]
|
||||||
# newlz = lz != nothing ? zeros(0) : nothing
|
# newlz = lz !== nothing ? zeros(0) : nothing
|
||||||
|
|
||||||
# for each line segment (point series with no NaNs), convert it into a bezier curve
|
# for each line segment (point series with no NaNs), convert it into a bezier curve
|
||||||
# where the points are the control points of the curve
|
# where the points are the control points of the curve
|
||||||
@ -306,13 +306,13 @@ end
|
|||||||
ts = range(0, stop = 1, length = npoints)
|
ts = range(0, stop = 1, length = npoints)
|
||||||
nanappend!(newx, map(t -> bezier_value(_cycle(x,rng), t), ts))
|
nanappend!(newx, map(t -> bezier_value(_cycle(x,rng), t), ts))
|
||||||
nanappend!(newy, map(t -> bezier_value(_cycle(y,rng), t), ts))
|
nanappend!(newy, map(t -> bezier_value(_cycle(y,rng), t), ts))
|
||||||
if z != nothing
|
if z !== nothing
|
||||||
nanappend!(newz, map(t -> bezier_value(_cycle(z,rng), t), ts))
|
nanappend!(newz, map(t -> bezier_value(_cycle(z,rng), t), ts))
|
||||||
end
|
end
|
||||||
if fr != nothing
|
if fr !== nothing
|
||||||
nanappend!(newfr, map(t -> bezier_value(_cycle(fr,rng), t), ts))
|
nanappend!(newfr, map(t -> bezier_value(_cycle(fr,rng), t), ts))
|
||||||
end
|
end
|
||||||
# if lz != nothing
|
# if lz !== nothing
|
||||||
# lzrng = _cycle(lz, rng) # the line_z's for this segment
|
# lzrng = _cycle(lz, rng) # the line_z's for this segment
|
||||||
# push!(newlz, 0.0)
|
# push!(newlz, 0.0)
|
||||||
# append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts))
|
# append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts))
|
||||||
@ -327,10 +327,10 @@ end
|
|||||||
seriestype := :path3d
|
seriestype := :path3d
|
||||||
z := newz
|
z := newz
|
||||||
end
|
end
|
||||||
if fr != nothing
|
if fr !== nothing
|
||||||
fillrange := newfr
|
fillrange := newfr
|
||||||
end
|
end
|
||||||
# if lz != nothing
|
# if lz !== nothing
|
||||||
# # line_z := newlz
|
# # line_z := newlz
|
||||||
# linecolor := (isa(plotattributes[:linecolor], ColorGradient) ? plotattributes[:linecolor] : cgrad())
|
# linecolor := (isa(plotattributes[:linecolor], ColorGradient) ? plotattributes[:linecolor] : cgrad())
|
||||||
# end
|
# end
|
||||||
@ -533,7 +533,7 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S
|
|||||||
|
|
||||||
last_w = eltype(weights)(NaN)
|
last_w = eltype(weights)(NaN)
|
||||||
|
|
||||||
while it_tuple_e != nothing && it_tuple_w != nothing
|
while it_tuple_e !== nothing && it_tuple_w !== nothing
|
||||||
b, it_state_e = it_tuple_e
|
b, it_state_e = it_tuple_e
|
||||||
w, it_state_w = it_tuple_w
|
w, it_state_w = it_tuple_w
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ function _get_defaults(s::Symbol)
|
|||||||
:fglegend => thm.text,
|
:fglegend => thm.text,
|
||||||
:palette => thm.palette,
|
:palette => thm.palette,
|
||||||
)
|
)
|
||||||
if thm.gradient != nothing
|
if thm.gradient !== nothing
|
||||||
push!(defaults, :gradient => thm.gradient)
|
push!(defaults, :gradient => thm.gradient)
|
||||||
end
|
end
|
||||||
return defaults
|
return defaults
|
||||||
|
|||||||
@ -529,7 +529,7 @@ function get_clims(sp::Subplot)
|
|||||||
for vals in (series[:seriestype] in z_colored_series ? series[:z] : nothing, series[:line_z], series[:marker_z], series[:fill_z])
|
for vals in (series[:seriestype] in z_colored_series ? series[:z] : nothing, series[:line_z], series[:marker_z], series[:fill_z])
|
||||||
if (typeof(vals) <: AbstractSurface) && (eltype(vals.surf) <: Union{Missing, Real})
|
if (typeof(vals) <: AbstractSurface) && (eltype(vals.surf) <: Union{Missing, Real})
|
||||||
zmin, zmax = _update_clims(zmin, zmax, ignorenan_extrema(vals.surf)...)
|
zmin, zmax = _update_clims(zmin, zmax, ignorenan_extrema(vals.surf)...)
|
||||||
elseif (vals != nothing) && (eltype(vals) <: Union{Missing, Real})
|
elseif (vals !== nothing) && (eltype(vals) <: Union{Missing, Real})
|
||||||
zmin, zmax = _update_clims(zmin, zmax, ignorenan_extrema(vals)...)
|
zmin, zmax = _update_clims(zmin, zmax, ignorenan_extrema(vals)...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -650,7 +650,7 @@ function has_attribute_segments(series::Series)
|
|||||||
for letter in (:x, :y, :z)
|
for letter in (:x, :y, :z)
|
||||||
# If we have NaNs in the data they define the segments and
|
# If we have NaNs in the data they define the segments and
|
||||||
# SegmentsIterator is used
|
# SegmentsIterator is used
|
||||||
series[letter] != nothing && NaN in collect(series[letter]) && return false
|
series[letter] !== nothing && NaN in collect(series[letter]) && return false
|
||||||
end
|
end
|
||||||
series[:seriestype] == :shape && return false
|
series[:seriestype] == :shape && return false
|
||||||
# ... else we check relevant attributes if they have multiple inputs
|
# ... else we check relevant attributes if they have multiple inputs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user