big cleanup: changed camelcase to underscores; removed supportedAxes; changed pyplot methods to be py_ which matches gr_/plotly_/etc convention
This commit is contained in:
parent
b1850e58f4
commit
02d893b316
120
src/Plots.jl
120
src/Plots.jl
@ -20,13 +20,9 @@ export
|
|||||||
grid,
|
grid,
|
||||||
EmptyLayout,
|
EmptyLayout,
|
||||||
@layout,
|
@layout,
|
||||||
# RowsLayout,
|
|
||||||
# FlexLayout,
|
|
||||||
AVec,
|
AVec,
|
||||||
AMat,
|
AMat,
|
||||||
KW,
|
KW,
|
||||||
# attr,
|
|
||||||
# attr!,
|
|
||||||
|
|
||||||
wrap,
|
wrap,
|
||||||
set_theme,
|
set_theme,
|
||||||
@ -34,8 +30,6 @@ export
|
|||||||
|
|
||||||
plot,
|
plot,
|
||||||
plot!,
|
plot!,
|
||||||
# subplot,
|
|
||||||
# subplot!,
|
|
||||||
|
|
||||||
current,
|
current,
|
||||||
default,
|
default,
|
||||||
@ -43,53 +37,11 @@ export
|
|||||||
|
|
||||||
@userplot,
|
@userplot,
|
||||||
@shorthands,
|
@shorthands,
|
||||||
# scatter,
|
|
||||||
# scatter!,
|
|
||||||
# bar,
|
|
||||||
# bar!,
|
|
||||||
# barh,
|
|
||||||
# barh!,
|
|
||||||
# histogram,
|
|
||||||
# histogram!,
|
|
||||||
# histogram2d,
|
|
||||||
# histogram2d!,
|
|
||||||
# density,
|
|
||||||
# density!,
|
|
||||||
# heatmap,
|
|
||||||
# heatmap!,
|
|
||||||
# hexbin,
|
|
||||||
# hexbin!,
|
|
||||||
# sticks,
|
|
||||||
# sticks!,
|
|
||||||
# hline,
|
|
||||||
# hline!,
|
|
||||||
# vline,
|
|
||||||
# vline!,
|
|
||||||
# ohlc,
|
|
||||||
# ohlc!,
|
|
||||||
pie,
|
pie,
|
||||||
pie!,
|
pie!,
|
||||||
# contour,
|
|
||||||
# contour!,
|
|
||||||
# contour3d,
|
|
||||||
# contour3d!,
|
|
||||||
# surface,
|
|
||||||
# surface!,
|
|
||||||
# wireframe,
|
|
||||||
# wireframe!,
|
|
||||||
# path3d,
|
|
||||||
# path3d!,
|
|
||||||
plot3d,
|
plot3d,
|
||||||
plot3d!,
|
plot3d!,
|
||||||
# scatter3d,
|
|
||||||
# scatter3d!,
|
|
||||||
# abline!,
|
|
||||||
# boxplot,
|
|
||||||
# boxplot!,
|
|
||||||
# violin,
|
|
||||||
# violin!,
|
|
||||||
# quiver,
|
|
||||||
# quiver!,
|
|
||||||
|
|
||||||
title!,
|
title!,
|
||||||
xlabel!,
|
xlabel!,
|
||||||
@ -119,9 +71,6 @@ export
|
|||||||
text,
|
text,
|
||||||
font,
|
font,
|
||||||
Axis,
|
Axis,
|
||||||
# xaxis,
|
|
||||||
# yaxis,
|
|
||||||
# zaxis,
|
|
||||||
stroke,
|
stroke,
|
||||||
brush,
|
brush,
|
||||||
Surface,
|
Surface,
|
||||||
@ -140,12 +89,11 @@ export
|
|||||||
|
|
||||||
debugplots,
|
debugplots,
|
||||||
|
|
||||||
supportedArgs,
|
supported_args,
|
||||||
supportedAxes,
|
supported_types,
|
||||||
supportedTypes,
|
supported_styles,
|
||||||
supportedStyles,
|
supported_markers,
|
||||||
supportedMarkers,
|
is_subplot_supported,
|
||||||
subplotSupported,
|
|
||||||
|
|
||||||
Animation,
|
Animation,
|
||||||
frame,
|
frame,
|
||||||
@ -158,10 +106,6 @@ export
|
|||||||
arcdiagram,
|
arcdiagram,
|
||||||
chorddiagram,
|
chorddiagram,
|
||||||
|
|
||||||
# @kw,
|
|
||||||
# @recipe,
|
|
||||||
# @plotrecipe,
|
|
||||||
|
|
||||||
test_examples,
|
test_examples,
|
||||||
|
|
||||||
translate,
|
translate,
|
||||||
@ -209,14 +153,11 @@ include("arg_desc.jl")
|
|||||||
# define and export shorthand plotting method definitions
|
# define and export shorthand plotting method definitions
|
||||||
macro shorthands(funcname::Symbol)
|
macro shorthands(funcname::Symbol)
|
||||||
funcname2 = Symbol(funcname, "!")
|
funcname2 = Symbol(funcname, "!")
|
||||||
ret = esc(quote
|
esc(quote
|
||||||
export $funcname, $funcname2
|
export $funcname, $funcname2
|
||||||
$funcname(args...; kw...) = plot(args...; kw..., seriestype = $(quot(funcname)))
|
$funcname(args...; kw...) = plot(args...; kw..., seriestype = $(quot(funcname)))
|
||||||
$funcname2(args...; kw...) = plot!(args...; kw..., seriestype = $(quot(funcname)))
|
$funcname2(args...; kw...) = plot!(args...; kw..., seriestype = $(quot(funcname)))
|
||||||
end)
|
end)
|
||||||
# dump(ret,20)
|
|
||||||
# @show ret
|
|
||||||
ret
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@shorthands scatter
|
@shorthands scatter
|
||||||
@ -231,7 +172,6 @@ end
|
|||||||
@shorthands hline
|
@shorthands hline
|
||||||
@shorthands vline
|
@shorthands vline
|
||||||
@shorthands ohlc
|
@shorthands ohlc
|
||||||
# @shorthands pie
|
|
||||||
@shorthands contour
|
@shorthands contour
|
||||||
@shorthands contour3d
|
@shorthands contour3d
|
||||||
@shorthands surface
|
@shorthands surface
|
||||||
@ -242,52 +182,10 @@ end
|
|||||||
@shorthands violin
|
@shorthands violin
|
||||||
@shorthands quiver
|
@shorthands quiver
|
||||||
|
|
||||||
# scatter(args...; kw...) = plot(args...; kw..., seriestype = :scatter)
|
|
||||||
# scatter!(args...; kw...) = plot!(args...; kw..., seriestype = :scatter)
|
|
||||||
# bar(args...; kw...) = plot(args...; kw..., seriestype = :bar)
|
|
||||||
# bar!(args...; kw...) = plot!(args...; kw..., seriestype = :bar)
|
|
||||||
# barh(args...; kw...) = plot(args...; kw..., seriestype = :barh, orientation = :h)
|
|
||||||
# barh!(args...; kw...) = plot!(args...; kw..., seriestype = :barh, orientation = :h)
|
|
||||||
# histogram(args...; kw...) = plot(args...; kw..., seriestype = :histogram)
|
|
||||||
# histogram!(args...; kw...) = plot!(args...; kw..., seriestype = :histogram)
|
|
||||||
# histogram2d(args...; kw...) = plot(args...; kw..., seriestype = :histogram2d)
|
|
||||||
# histogram2d!(args...; kw...) = plot!(args...; kw..., seriestype = :histogram2d)
|
|
||||||
# density(args...; kw...) = plot(args...; kw..., seriestype = :density)
|
|
||||||
# density!(args...; kw...) = plot!(args...; kw..., seriestype = :density)
|
|
||||||
# heatmap(args...; kw...) = plot(args...; kw..., seriestype = :heatmap)
|
|
||||||
# heatmap!(args...; kw...) = plot!(args...; kw..., seriestype = :heatmap)
|
|
||||||
# hexbin(args...; kw...) = plot(args...; kw..., seriestype = :hexbin)
|
|
||||||
# hexbin!(args...; kw...) = plot!(args...; kw..., seriestype = :hexbin)
|
|
||||||
# sticks(args...; kw...) = plot(args...; kw..., seriestype = :sticks, marker = :ellipse)
|
|
||||||
# sticks!(args...; kw...) = plot!(args...; kw..., seriestype = :sticks, marker = :ellipse)
|
|
||||||
# hline(args...; kw...) = plot(args...; kw..., seriestype = :hline)
|
|
||||||
# hline!(args...; kw...) = plot!(args...; kw..., seriestype = :hline)
|
|
||||||
# vline(args...; kw...) = plot(args...; kw..., seriestype = :vline)
|
|
||||||
# vline!(args...; kw...) = plot!(args...; kw..., seriestype = :vline)
|
|
||||||
# ohlc(args...; kw...) = plot(args...; kw..., seriestype = :ohlc)
|
|
||||||
# ohlc!(args...; kw...) = plot!(args...; kw..., seriestype = :ohlc)
|
|
||||||
pie(args...; kw...) = plot(args...; kw..., seriestype = :pie, aspect_ratio = :equal, grid=false, xticks=nothing, yticks=nothing)
|
pie(args...; kw...) = plot(args...; kw..., seriestype = :pie, aspect_ratio = :equal, grid=false, xticks=nothing, yticks=nothing)
|
||||||
pie!(args...; kw...) = plot!(args...; kw..., seriestype = :pie, aspect_ratio = :equal, grid=false, xticks=nothing, yticks=nothing)
|
pie!(args...; kw...) = plot!(args...; kw..., seriestype = :pie, aspect_ratio = :equal, grid=false, xticks=nothing, yticks=nothing)
|
||||||
# contour(args...; kw...) = plot(args...; kw..., seriestype = :contour)
|
|
||||||
# contour!(args...; kw...) = plot!(args...; kw..., seriestype = :contour)
|
|
||||||
# contour3d(args...; kw...) = plot(args...; kw..., seriestype = :contour3d)
|
|
||||||
# contour3d!(args...; kw...) = plot!(args...; kw..., seriestype = :contour3d)
|
|
||||||
# surface(args...; kw...) = plot(args...; kw..., seriestype = :surface)
|
|
||||||
# surface!(args...; kw...) = plot!(args...; kw..., seriestype = :surface)
|
|
||||||
# wireframe(args...; kw...) = plot(args...; kw..., seriestype = :wireframe)
|
|
||||||
# wireframe!(args...; kw...) = plot!(args...; kw..., seriestype = :wireframe)
|
|
||||||
# path3d(args...; kw...) = plot(args...; kw..., seriestype = :path3d)
|
|
||||||
# path3d!(args...; kw...) = plot!(args...; kw..., seriestype = :path3d)
|
|
||||||
plot3d(args...; kw...) = plot(args...; kw..., seriestype = :path3d)
|
plot3d(args...; kw...) = plot(args...; kw..., seriestype = :path3d)
|
||||||
plot3d!(args...; kw...) = plot!(args...; kw..., seriestype = :path3d)
|
plot3d!(args...; kw...) = plot!(args...; kw..., seriestype = :path3d)
|
||||||
# scatter3d(args...; kw...) = plot(args...; kw..., seriestype = :scatter3d)
|
|
||||||
# scatter3d!(args...; kw...) = plot!(args...; kw..., seriestype = :scatter3d)
|
|
||||||
# boxplot(args...; kw...) = plot(args...; kw..., seriestype = :boxplot)
|
|
||||||
# boxplot!(args...; kw...) = plot!(args...; kw..., seriestype = :boxplot)
|
|
||||||
# violin(args...; kw...) = plot(args...; kw..., seriestype = :violin)
|
|
||||||
# violin!(args...; kw...) = plot!(args...; kw..., seriestype = :violin)
|
|
||||||
# quiver(args...; kw...) = plot(args...; kw..., seriestype = :quiver)
|
|
||||||
# quiver!(args...; kw...) = plot!(args...; kw..., seriestype = :quiver)
|
|
||||||
|
|
||||||
|
|
||||||
title!(s::AbstractString; kw...) = plot!(; title = s, kw...)
|
title!(s::AbstractString; kw...) = plot!(; title = s, kw...)
|
||||||
@ -340,13 +238,9 @@ yaxis!(plt::Plot, args...; kw...) = plot!(pl
|
|||||||
|
|
||||||
const CURRENT_BACKEND = CurrentBackend(:none)
|
const CURRENT_BACKEND = CurrentBackend(:none)
|
||||||
|
|
||||||
# setup_dataframes()
|
|
||||||
|
|
||||||
function __init__()
|
function __init__()
|
||||||
setup_ijulia()
|
setup_ijulia()
|
||||||
# setup_dataframes()
|
|
||||||
setup_atom()
|
setup_atom()
|
||||||
# add_axis_letter_defaults()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|||||||
32
src/args.jl
32
src/args.jl
@ -290,10 +290,10 @@ const _all_defaults = KW[
|
|||||||
]
|
]
|
||||||
|
|
||||||
const _all_args = sort(collect(union(map(keys, _all_defaults)...)))
|
const _all_args = sort(collect(union(map(keys, _all_defaults)...)))
|
||||||
supportedArgs(::AbstractBackend) = error("supportedArgs not defined") #_all_args
|
supported_args(::AbstractBackend) = error("supported_args not defined") #_all_args
|
||||||
supportedArgs() = supportedArgs(backend())
|
supported_args() = supported_args(backend())
|
||||||
|
|
||||||
RecipesBase.is_key_supported(k::Symbol) = (k in supportedArgs())
|
RecipesBase.is_key_supported(k::Symbol) = (k in supported_args())
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -725,38 +725,38 @@ end
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
function warnOnUnsupportedArgs(pkg::AbstractBackend, d::KW)
|
function warnOnUnsupported_args(pkg::AbstractBackend, d::KW)
|
||||||
for k in sortedkeys(d)
|
for k in sortedkeys(d)
|
||||||
k in supportedArgs(pkg) && continue
|
k in supported_args(pkg) && continue
|
||||||
k in _suppress_warnings && continue
|
k in _suppress_warnings && continue
|
||||||
if d[k] != default(k)
|
if d[k] != default(k)
|
||||||
warn("Keyword argument $k not supported with $pkg. Choose from: $(supportedArgs(pkg))")
|
warn("Keyword argument $k not supported with $pkg. Choose from: $(supported_args(pkg))")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_markershape_supported(pkg::AbstractBackend, shape::Symbol) = shape in supportedMarkers(pkg)
|
_markershape_supported(pkg::AbstractBackend, shape::Symbol) = shape in supported_markers(pkg)
|
||||||
_markershape_supported(pkg::AbstractBackend, shape::Shape) = Shape in supportedMarkers(pkg)
|
_markershape_supported(pkg::AbstractBackend, shape::Shape) = Shape in supported_markers(pkg)
|
||||||
_markershape_supported(pkg::AbstractBackend, shapes::AVec) = all([_markershape_supported(pkg, shape) for shape in shapes])
|
_markershape_supported(pkg::AbstractBackend, shapes::AVec) = all([_markershape_supported(pkg, shape) for shape in shapes])
|
||||||
|
|
||||||
function warnOnUnsupported(pkg::AbstractBackend, d::KW)
|
function warnOnUnsupported(pkg::AbstractBackend, d::KW)
|
||||||
(d[:seriestype] == :none
|
(d[:seriestype] == :none
|
||||||
|| d[:seriestype] in supportedTypes(pkg)
|
|| d[:seriestype] in supported_types(pkg)
|
||||||
|| warn("seriestype $(d[:seriestype]) is unsupported with $pkg. Choose from: $(supportedTypes(pkg))"))
|
|| warn("seriestype $(d[:seriestype]) is unsupported with $pkg. Choose from: $(supported_types(pkg))"))
|
||||||
(d[:linestyle] in supportedStyles(pkg)
|
(d[:linestyle] in supported_styles(pkg)
|
||||||
|| warn("linestyle $(d[:linestyle]) is unsupported with $pkg. Choose from: $(supportedStyles(pkg))"))
|
|| warn("linestyle $(d[:linestyle]) is unsupported with $pkg. Choose from: $(supported_styles(pkg))"))
|
||||||
(d[:markershape] == :none
|
(d[:markershape] == :none
|
||||||
|| _markershape_supported(pkg, d[:markershape])
|
|| _markershape_supported(pkg, d[:markershape])
|
||||||
|| warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supportedMarkers(pkg))"))
|
|| warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supported_markers(pkg))"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function warnOnUnsupportedScales(pkg::AbstractBackend, d::KW)
|
function warnOnUnsupported_scales(pkg::AbstractBackend, d::KW)
|
||||||
for k in (:xscale, :yscale, :zscale)
|
for k in (:xscale, :yscale, :zscale)
|
||||||
if haskey(d, k)
|
if haskey(d, k)
|
||||||
v = d[k]
|
v = d[k]
|
||||||
v = get(_scaleAliases, v, v)
|
v = get(_scaleAliases, v, v)
|
||||||
if !(v in supportedScales(pkg))
|
if !(v in supported_scales(pkg))
|
||||||
warn("scale $(d[k]) is unsupported with $pkg. Choose from: $(supportedScales(pkg))")
|
warn("scale $(d[k]) is unsupported with $pkg. Choose from: $(supported_scales(pkg))")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -169,22 +169,20 @@ end
|
|||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
supportedAxes(::AbstractBackend) = [:left]
|
supported_types(::AbstractBackend) = []
|
||||||
supportedTypes(::AbstractBackend) = []
|
supported_styles(::AbstractBackend) = [:solid]
|
||||||
supportedStyles(::AbstractBackend) = [:solid]
|
supported_markers(::AbstractBackend) = [:none]
|
||||||
supportedMarkers(::AbstractBackend) = [:none]
|
supported_scales(::AbstractBackend) = [:identity]
|
||||||
supportedScales(::AbstractBackend) = [:identity]
|
is_subplot_supported(::AbstractBackend) = false
|
||||||
subplotSupported(::AbstractBackend) = false
|
is_string_supported(::AbstractBackend) = false
|
||||||
stringsSupported(::AbstractBackend) = false
|
nativeImagesSupported(b::AbstractBackend) = :image in supported_types(b)
|
||||||
nativeImagesSupported(b::AbstractBackend) = :image in supportedTypes(b)
|
|
||||||
|
|
||||||
supportedAxes() = supportedAxes(backend())
|
supported_types() = supported_types(backend())
|
||||||
supportedTypes() = supportedTypes(backend())
|
supported_styles() = supported_styles(backend())
|
||||||
supportedStyles() = supportedStyles(backend())
|
supported_markers() = supported_markers(backend())
|
||||||
supportedMarkers() = supportedMarkers(backend())
|
supported_scales() = supported_scales(backend())
|
||||||
supportedScales() = supportedScales(backend())
|
is_subplot_supported() = is_subplot_supported(backend())
|
||||||
subplotSupported() = subplotSupported(backend())
|
is_string_supported() = is_string_supported(backend())
|
||||||
stringsSupported() = stringsSupported(backend())
|
|
||||||
nativeImagesSupported() = nativeImagesSupported(backend())
|
nativeImagesSupported() = nativeImagesSupported(backend())
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# https://github.com/bokeh/Bokeh.jl
|
# https://github.com/bokeh/Bokeh.jl
|
||||||
|
|
||||||
|
|
||||||
supportedArgs(::BokehBackend) = [
|
supported_args(::BokehBackend) = [
|
||||||
# :annotations,
|
# :annotations,
|
||||||
# :axis,
|
# :axis,
|
||||||
# :background_color,
|
# :background_color,
|
||||||
@ -59,12 +59,11 @@ supportedArgs(::BokehBackend) = [
|
|||||||
# :surface,
|
# :surface,
|
||||||
# :levels,
|
# :levels,
|
||||||
]
|
]
|
||||||
supportedAxes(::BokehBackend) = [:auto, :left]
|
supported_types(::BokehBackend) = [:none, :path, :scatter]
|
||||||
supportedTypes(::BokehBackend) = [:none, :path, :scatter] #,:steppre, :steppost, :sticks, :histogram2d, :hexbin, :histogram, :bar, :hline, :vline, :contour]
|
supported_styles(::BokehBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedStyles(::BokehBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supported_markers(::BokehBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
|
||||||
supportedMarkers(::BokehBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
supported_scales(::BokehBackend) = [:identity, :ln]
|
||||||
supportedScales(::BokehBackend) = [:identity, :ln] #, :ln, :log2, :log10, :asinh, :sqrt]
|
is_subplot_supported(::BokehBackend) = false
|
||||||
subplotSupported(::BokehBackend) = false
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# https://github.com/dcjones/Gadfly.jl
|
# https://github.com/dcjones/Gadfly.jl
|
||||||
|
|
||||||
|
|
||||||
supportedArgs(::GadflyBackend) = [
|
supported_args(::GadflyBackend) = [
|
||||||
:annotations,
|
:annotations,
|
||||||
:background_color, :foreground_color, :color_palette,
|
:background_color, :foreground_color, :color_palette,
|
||||||
:group, :label, :seriestype,
|
:group, :label, :seriestype,
|
||||||
@ -15,7 +15,6 @@ supportedArgs(::GadflyBackend) = [
|
|||||||
:title, :window_title, :show, :size,
|
:title, :window_title, :show, :size,
|
||||||
:x, :xguide, :xlims, :xticks, :xscale, :xflip,
|
:x, :xguide, :xlims, :xticks, :xscale, :xflip,
|
||||||
:y, :yguide, :ylims, :yticks, :yscale, :yflip,
|
:y, :yguide, :ylims, :yticks, :yscale, :yflip,
|
||||||
# :z, :zguide, :zlims, :zticks, :zscale, :zflip,
|
|
||||||
:z,
|
:z,
|
||||||
:tickfont, :guidefont, :legendfont,
|
:tickfont, :guidefont, :legendfont,
|
||||||
:grid, :legend, :colorbar,
|
:grid, :legend, :colorbar,
|
||||||
@ -24,17 +23,16 @@ supportedArgs(::GadflyBackend) = [
|
|||||||
:ribbon, :quiver,
|
:ribbon, :quiver,
|
||||||
:orientation,
|
:orientation,
|
||||||
]
|
]
|
||||||
supportedAxes(::GadflyBackend) = [:auto, :left]
|
supported_types(::GadflyBackend) = [
|
||||||
supportedTypes(::GadflyBackend) = [
|
|
||||||
:none, :line, :path, :steppre, :steppost, :sticks,
|
:none, :line, :path, :steppre, :steppost, :sticks,
|
||||||
:scatter, :histogram2d, :hexbin, :histogram,
|
:scatter, :histogram2d, :hexbin, :histogram,
|
||||||
:bar, #:box, :violin, :quiver,
|
:bar,
|
||||||
:hline, :vline, :contour, :shape
|
:hline, :vline, :contour, :shape
|
||||||
]
|
]
|
||||||
supportedStyles(::GadflyBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supported_styles(::GadflyBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::GadflyBackend) = vcat(_allMarkers, Shape)
|
supported_markers(::GadflyBackend) = vcat(_allMarkers, Shape)
|
||||||
supportedScales(::GadflyBackend) = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
|
supported_scales(::GadflyBackend) = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
|
||||||
subplotSupported(::GadflyBackend) = true
|
is_subplot_supported(::GadflyBackend) = true
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# [WEBSITE]
|
# [WEBSITE]
|
||||||
|
|
||||||
supportedArgs(::GLVisualizeBackend) = [
|
supported_args(::GLVisualizeBackend) = [
|
||||||
# :annotations,
|
# :annotations,
|
||||||
# :axis,
|
# :axis,
|
||||||
# :background_color,
|
# :background_color,
|
||||||
@ -59,12 +59,11 @@ supportedArgs(::GLVisualizeBackend) = [
|
|||||||
# :surface
|
# :surface
|
||||||
# :levels,
|
# :levels,
|
||||||
]
|
]
|
||||||
supportedAxes(::GLVisualizeBackend) = [:auto, :left]
|
supported_types(::GLVisualizeBackend) = [:surface]
|
||||||
supportedTypes(::GLVisualizeBackend) = [:surface] #, :path, :scatter ,:steppre, :steppost, :sticks, :heatmap, :hexbin, :histogram, :bar, :hline, :vline, :contour]
|
supported_styles(::GLVisualizeBackend) = [:auto, :solid]
|
||||||
supportedStyles(::GLVisualizeBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
|
supported_markers(::GLVisualizeBackend) = [:none, :auto, :ellipse]
|
||||||
supportedMarkers(::GLVisualizeBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
supported_scales(::GLVisualizeBackend) = [:identity]
|
||||||
supportedScales(::GLVisualizeBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
|
is_subplot_supported(::GLVisualizeBackend) = false
|
||||||
subplotSupported(::GLVisualizeBackend) = false
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# significant contributions by @jheinen
|
# significant contributions by @jheinen
|
||||||
|
|
||||||
supportedArgs(::GRBackend) = [
|
supported_args(::GRBackend) = [
|
||||||
:annotations,
|
:annotations,
|
||||||
:background_color, :foreground_color, :color_palette,
|
:background_color, :foreground_color, :color_palette,
|
||||||
:background_color_legend, :background_color_inside, :background_color_outside,
|
:background_color_legend, :background_color_inside, :background_color_outside,
|
||||||
@ -36,17 +36,16 @@ supportedArgs(::GRBackend) = [
|
|||||||
:aspect_ratio,
|
:aspect_ratio,
|
||||||
:normalize, :weights
|
:normalize, :weights
|
||||||
]
|
]
|
||||||
supportedAxes(::GRBackend) = _allAxes
|
supported_types(::GRBackend) = [
|
||||||
supportedTypes(::GRBackend) = [
|
|
||||||
:path, :scatter,
|
:path, :scatter,
|
||||||
:heatmap, :pie, :image,
|
:heatmap, :pie, :image,
|
||||||
:contour, :path3d, :scatter3d, :surface, :wireframe,
|
:contour, :path3d, :scatter3d, :surface, :wireframe,
|
||||||
:shape
|
:shape
|
||||||
]
|
]
|
||||||
supportedStyles(::GRBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supported_styles(::GRBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::GRBackend) = vcat(_allMarkers, Shape)
|
supported_markers(::GRBackend) = vcat(_allMarkers, Shape)
|
||||||
supportedScales(::GRBackend) = [:identity, :log10]
|
supported_scales(::GRBackend) = [:identity, :log10]
|
||||||
subplotSupported(::GRBackend) = true
|
is_subplot_supported(::GRBackend) = true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
|
|
||||||
# https://github.com/JuliaGraphics/Immerse.jl
|
# https://github.com/JuliaGraphics/Immerse.jl
|
||||||
|
|
||||||
supportedArgs(::ImmerseBackend) = supportedArgs(GadflyBackend())
|
supported_args(::ImmerseBackend) = supported_args(GadflyBackend())
|
||||||
supportedAxes(::ImmerseBackend) = supportedAxes(GadflyBackend())
|
supported_types(::ImmerseBackend) = supported_types(GadflyBackend())
|
||||||
supportedTypes(::ImmerseBackend) = supportedTypes(GadflyBackend())
|
supported_styles(::ImmerseBackend) = supported_styles(GadflyBackend())
|
||||||
supportedStyles(::ImmerseBackend) = supportedStyles(GadflyBackend())
|
supported_markers(::ImmerseBackend) = supported_markers(GadflyBackend())
|
||||||
supportedMarkers(::ImmerseBackend) = supportedMarkers(GadflyBackend())
|
supported_scales(::ImmerseBackend) = supported_scales(GadflyBackend())
|
||||||
supportedScales(::ImmerseBackend) = supportedScales(GadflyBackend())
|
is_subplot_supported(::ImmerseBackend) = true
|
||||||
subplotSupported(::ImmerseBackend) = true
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# significant contributions by: @pkofod
|
# significant contributions by: @pkofod
|
||||||
|
|
||||||
supportedArgs(::PGFPlotsBackend) = [
|
supported_args(::PGFPlotsBackend) = [
|
||||||
# :annotations,
|
# :annotations,
|
||||||
:background_color, :foreground_color,
|
:background_color, :foreground_color,
|
||||||
:color_palette,
|
:color_palette,
|
||||||
@ -43,12 +43,11 @@ supportedArgs(::PGFPlotsBackend) = [
|
|||||||
:aspect_ratio,
|
:aspect_ratio,
|
||||||
# :match_dimensions,
|
# :match_dimensions,
|
||||||
]
|
]
|
||||||
supportedAxes(::PGFPlotsBackend) = [:auto, :left]
|
supported_types(::PGFPlotsBackend) = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour]
|
||||||
supportedTypes(::PGFPlotsBackend) = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour]
|
supported_styles(::PGFPlotsBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedStyles(::PGFPlotsBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supported_markers(::PGFPlotsBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape)
|
||||||
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape)
|
supported_scales(::PGFPlotsBackend) = [:identity, :ln, :log2, :log10]
|
||||||
supportedScales(::PGFPlotsBackend) = [:identity, :ln, :log2, :log10] # :asinh, :sqrt]
|
is_subplot_supported(::PGFPlotsBackend) = false
|
||||||
subplotSupported(::PGFPlotsBackend) = false
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
# https://plot.ly/javascript/getting-started
|
# https://plot.ly/javascript/getting-started
|
||||||
|
|
||||||
supportedArgs(::PlotlyBackend) = [
|
supported_args(::PlotlyBackend) = [
|
||||||
:annotations,
|
:annotations,
|
||||||
:background_color, :foreground_color, :color_palette,
|
:background_color, :foreground_color, :color_palette,
|
||||||
# :background_color_legend, :background_color_inside, :background_color_outside,
|
# :background_color_legend, :background_color_inside, :background_color_outside,
|
||||||
@ -34,16 +34,16 @@ supportedArgs(::PlotlyBackend) = [
|
|||||||
# :normalize, :weights, :contours, :aspect_ratio
|
# :normalize, :weights, :contours, :aspect_ratio
|
||||||
]
|
]
|
||||||
|
|
||||||
supportedAxes(::PlotlyBackend) = [:auto, :left]
|
supported_types(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
||||||
supportedTypes(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
:histogram2d, :histogram, :density, :bar,
|
||||||
:histogram2d, :histogram, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
:contour, :surface, :path3d, :scatter3d,
|
||||||
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
|
:pie, :heatmap]
|
||||||
supportedStyles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supported_styles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::PlotlyBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
supported_markers(::PlotlyBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
||||||
:pentagon, :hexagon, :octagon, :vline, :hline] #vcat(_allMarkers, Shape)
|
:pentagon, :hexagon, :octagon, :vline, :hline]
|
||||||
supportedScales(::PlotlyBackend) = [:identity, :log10] #, :ln, :log2, :log10, :asinh, :sqrt]
|
supported_scales(::PlotlyBackend) = [:identity, :log10]
|
||||||
subplotSupported(::PlotlyBackend) = true
|
is_subplot_supported(::PlotlyBackend) = true
|
||||||
stringsSupported(::PlotlyBackend) = true
|
is_string_supported(::PlotlyBackend) = true
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
# https://github.com/spencerlyon2/PlotlyJS.jl
|
# https://github.com/spencerlyon2/PlotlyJS.jl
|
||||||
|
|
||||||
supportedArgs(::PlotlyJSBackend) = [
|
supported_args(::PlotlyJSBackend) = [
|
||||||
:annotation,
|
:annotation,
|
||||||
# :axis,
|
# :axis,
|
||||||
:background_color,
|
:background_color,
|
||||||
@ -64,16 +64,15 @@ supportedArgs(::PlotlyJSBackend) = [
|
|||||||
:orientation,
|
:orientation,
|
||||||
:polar,
|
:polar,
|
||||||
]
|
]
|
||||||
supportedAxes(::PlotlyJSBackend) = [:auto, :left]
|
supported_types(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
||||||
supportedTypes(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
|
||||||
:histogram2d, :histogram, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
:histogram2d, :histogram, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
||||||
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
|
:pie, :heatmap]
|
||||||
supportedStyles(::PlotlyJSBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supported_styles(::PlotlyJSBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::PlotlyJSBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
supported_markers(::PlotlyJSBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
||||||
:pentagon, :hexagon, :octagon, :vline, :hline] #vcat(_allMarkers, Shape)
|
:pentagon, :hexagon, :octagon, :vline, :hline]
|
||||||
supportedScales(::PlotlyJSBackend) = [:identity, :log10] #, :ln, :log2, :log10, :asinh, :sqrt]
|
supported_scales(::PlotlyJSBackend) = [:identity, :log10]
|
||||||
subplotSupported(::PlotlyJSBackend) = true
|
is_subplot_supported(::PlotlyJSBackend) = true
|
||||||
stringsSupported(::PlotlyJSBackend) = true
|
is_string_supported(::PlotlyJSBackend) = true
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# https://github.com/stevengj/PyPlot.jl
|
# https://github.com/stevengj/PyPlot.jl
|
||||||
|
|
||||||
|
|
||||||
supportedArgs(::PyPlotBackend) = [
|
supported_args(::PyPlotBackend) = [
|
||||||
:annotations,
|
:annotations,
|
||||||
:background_color, :foreground_color, :color_palette,
|
:background_color, :foreground_color, :color_palette,
|
||||||
:background_color_legend, :background_color_inside, :background_color_outside,
|
:background_color_legend, :background_color_inside, :background_color_outside,
|
||||||
@ -38,19 +38,17 @@ supportedArgs(::PyPlotBackend) = [
|
|||||||
:subplot,
|
:subplot,
|
||||||
:clims,
|
:clims,
|
||||||
]
|
]
|
||||||
supportedAxes(::PyPlotBackend) = _allAxes
|
supported_types(::PyPlotBackend) = [
|
||||||
supportedTypes(::PyPlotBackend) = [
|
|
||||||
:none, :line, :path, :steppre, :steppost, :shape,
|
:none, :line, :path, :steppre, :steppost, :shape,
|
||||||
:scatter, :histogram2d, :hexbin, :histogram, #:density,
|
:scatter, :histogram2d, :hexbin, :histogram,
|
||||||
:bar, :sticks, #:box, :violin, :quiver,
|
:bar, :sticks,
|
||||||
:hline, :vline, :heatmap, :pie, :image,
|
:hline, :vline, :heatmap, :pie, :image,
|
||||||
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
||||||
]
|
]
|
||||||
supportedStyles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supported_styles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::PyPlotBackend) = vcat(_allMarkers, Shape)
|
supported_markers(::PyPlotBackend) = vcat(_allMarkers, Shape)
|
||||||
supportedScales(::PyPlotBackend) = [:identity, :ln, :log2, :log10]
|
supported_scales(::PyPlotBackend) = [:identity, :ln, :log2, :log10]
|
||||||
subplotSupported(::PyPlotBackend) = true
|
is_subplot_supported(::PyPlotBackend) = true
|
||||||
# nativeImagesSupported(::PyPlotBackend) = true
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
@ -82,37 +80,34 @@ end
|
|||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# convert colorant to 4-tuple RGBA
|
# convert colorant to 4-tuple RGBA
|
||||||
getPyPlotColor(c::Colorant, α=nothing) = map(f->float(f(convertColor(c,α))), (red, green, blue, alpha))
|
py_color(c::Colorant, α=nothing) = map(f->float(f(convertColor(c,α))), (red, green, blue, alpha))
|
||||||
getPyPlotColor(cvec::ColorVector, α=nothing) = map(getPyPlotColor, convertColor(cvec, α).v)
|
py_color(cvec::ColorVector, α=nothing) = map(py_color, convertColor(cvec, α).v)
|
||||||
getPyPlotColor(grad::ColorGradient, α=nothing) = map(c -> getPyPlotColor(c, α), grad.colors)
|
py_color(grad::ColorGradient, α=nothing) = map(c -> py_color(c, α), grad.colors)
|
||||||
getPyPlotColor(scheme::ColorScheme, α=nothing) = getPyPlotColor(convertColor(getColor(scheme), α))
|
py_color(scheme::ColorScheme, α=nothing) = py_color(convertColor(getColor(scheme), α))
|
||||||
getPyPlotColor(vec::AVec, α=nothing) = map(c->getPyPlotColor(c,α), vec)
|
py_color(vec::AVec, α=nothing) = map(c->py_color(c,α), vec)
|
||||||
getPyPlotColor(c, α=nothing) = getPyPlotColor(convertColor(c, α))
|
py_color(c, α=nothing) = py_color(convertColor(c, α))
|
||||||
|
|
||||||
function getPyPlotColorMap(c::ColorGradient, α=nothing)
|
function py_colormap(c::ColorGradient, α=nothing)
|
||||||
pyvals = [(v, getPyPlotColor(getColorZ(c, v), α)) for v in c.values]
|
pyvals = [(v, py_color(getColorZ(c, v), α)) for v in c.values]
|
||||||
pycolors.pymember("LinearSegmentedColormap")[:from_list]("tmp", pyvals)
|
pycolors.pymember("LinearSegmentedColormap")[:from_list]("tmp", pyvals)
|
||||||
end
|
end
|
||||||
|
|
||||||
# convert vectors and ColorVectors to standard ColorGradients
|
# convert vectors and ColorVectors to standard ColorGradients
|
||||||
# TODO: move this logic to colors.jl and keep a barebones wrapper for pyplot
|
# TODO: move this logic to colors.jl and keep a barebones wrapper for pyplot
|
||||||
getPyPlotColorMap(cv::ColorVector, α=nothing) = getPyPlotColorMap(ColorGradient(cv.v), α)
|
py_colormap(cv::ColorVector, α=nothing) = py_colormap(ColorGradient(cv.v), α)
|
||||||
getPyPlotColorMap(v::AVec, α=nothing) = getPyPlotColorMap(ColorGradient(v), α)
|
py_colormap(v::AVec, α=nothing) = py_colormap(ColorGradient(v), α)
|
||||||
|
|
||||||
# anything else just gets a bluesred gradient
|
# anything else just gets a bluesred gradient
|
||||||
getPyPlotColorMap(c, α=nothing) = getPyPlotColorMap(default_gradient(), α)
|
py_colormap(c, α=nothing) = py_colormap(default_gradient(), α)
|
||||||
|
|
||||||
function getPyPlotCustomShading(c, z, α=nothing)
|
function py_shading(c, z, α=nothing)
|
||||||
cmap = getPyPlotColorMap(c, α)
|
cmap = py_colormap(c, α)
|
||||||
# sm = pycmap.pymember("ScalarMappable")(cmap = cmap)
|
|
||||||
# sm[:set_array](z)
|
|
||||||
# sm
|
|
||||||
ls = pycolors.pymember("LightSource")(270,45)
|
ls = pycolors.pymember("LightSource")(270,45)
|
||||||
ls[:shade](z, cmap, vert_exag=0.1, blend_mode="soft")
|
ls[:shade](z, cmap, vert_exag=0.1, blend_mode="soft")
|
||||||
end
|
end
|
||||||
|
|
||||||
# get the style (solid, dashed, etc)
|
# get the style (solid, dashed, etc)
|
||||||
function getPyPlotLineStyle(seriestype::Symbol, linestyle::Symbol)
|
function py_linestyle(seriestype::Symbol, linestyle::Symbol)
|
||||||
seriestype == :none && return " "
|
seriestype == :none && return " "
|
||||||
linestyle == :solid && return "-"
|
linestyle == :solid && return "-"
|
||||||
linestyle == :dash && return "--"
|
linestyle == :dash && return "--"
|
||||||
@ -122,7 +117,7 @@ function getPyPlotLineStyle(seriestype::Symbol, linestyle::Symbol)
|
|||||||
return "-"
|
return "-"
|
||||||
end
|
end
|
||||||
|
|
||||||
function getPyPlotMarker(marker::Shape)
|
function py_marker(marker::Shape)
|
||||||
x, y = shape_coords(marker)
|
x, y = shape_coords(marker)
|
||||||
n = length(x)
|
n = length(x)
|
||||||
mat = zeros(n+1,2)
|
mat = zeros(n+1,2)
|
||||||
@ -140,7 +135,7 @@ const _path_CLOSEPOLY = UInt8(79)
|
|||||||
|
|
||||||
# see http://matplotlib.org/users/path_tutorial.html
|
# see http://matplotlib.org/users/path_tutorial.html
|
||||||
# and http://matplotlib.org/api/path_api.html#matplotlib.path.Path
|
# and http://matplotlib.org/api/path_api.html#matplotlib.path.Path
|
||||||
function buildPyPlotPath(x, y)
|
function py_path(x, y)
|
||||||
n = length(x)
|
n = length(x)
|
||||||
mat = zeros(n+1, 2)
|
mat = zeros(n+1, 2)
|
||||||
codes = zeros(UInt8, n+1)
|
codes = zeros(UInt8, n+1)
|
||||||
@ -161,7 +156,7 @@ function buildPyPlotPath(x, y)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# get the marker shape
|
# get the marker shape
|
||||||
function getPyPlotMarker(marker::Symbol)
|
function py_marker(marker::Symbol)
|
||||||
marker == :none && return " "
|
marker == :none && return " "
|
||||||
marker == :ellipse && return "o"
|
marker == :ellipse && return "o"
|
||||||
marker == :rect && return "s"
|
marker == :rect && return "s"
|
||||||
@ -174,32 +169,32 @@ function getPyPlotMarker(marker::Symbol)
|
|||||||
marker == :pentagon && return "p"
|
marker == :pentagon && return "p"
|
||||||
marker == :hexagon && return "h"
|
marker == :hexagon && return "h"
|
||||||
marker == :octagon && return "8"
|
marker == :octagon && return "8"
|
||||||
haskey(_shapes, marker) && return getPyPlotMarker(_shapes[marker])
|
haskey(_shapes, marker) && return py_marker(_shapes[marker])
|
||||||
|
|
||||||
warn("Unknown marker $marker")
|
warn("Unknown marker $marker")
|
||||||
return "o"
|
return "o"
|
||||||
end
|
end
|
||||||
|
|
||||||
# getPyPlotMarker(markers::AVec) = map(getPyPlotMarker, markers)
|
# py_marker(markers::AVec) = map(py_marker, markers)
|
||||||
function getPyPlotMarker(markers::AVec)
|
function py_marker(markers::AVec)
|
||||||
warn("Vectors of markers are currently unsupported in PyPlot: $markers")
|
warn("Vectors of markers are currently unsupported in PyPlot: $markers")
|
||||||
getPyPlotMarker(markers[1])
|
py_marker(markers[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
# pass through
|
# pass through
|
||||||
function getPyPlotMarker(marker::AbstractString)
|
function py_marker(marker::AbstractString)
|
||||||
@assert length(marker) == 1
|
@assert length(marker) == 1
|
||||||
marker
|
marker
|
||||||
end
|
end
|
||||||
|
|
||||||
function getPyPlotStepStyle(seriestype::Symbol)
|
function py_stepstyle(seriestype::Symbol)
|
||||||
seriestype == :steppost && return "steps-post"
|
seriestype == :steppost && return "steps-post"
|
||||||
seriestype == :steppre && return "steps-pre"
|
seriestype == :steppre && return "steps-pre"
|
||||||
return "default"
|
return "default"
|
||||||
end
|
end
|
||||||
|
|
||||||
# untested... return a FontProperties object from a Plots.Font
|
# untested... return a FontProperties object from a Plots.Font
|
||||||
function getPyPlotFont(font::Font)
|
function py_font(font::Font)
|
||||||
pyfont.pymember("FontProperties")(
|
pyfont.pymember("FontProperties")(
|
||||||
family = font.family,
|
family = font.family,
|
||||||
size = font.size
|
size = font.size
|
||||||
@ -215,18 +210,18 @@ function add_pyfixedformatter(cbar, vals::AVec)
|
|||||||
cbar[:update_ticks]()
|
cbar[:update_ticks]()
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: smoothing should be moved into the SliceIt method, should not touch backends
|
# # TODO: smoothing should be moved into the SliceIt method, should not touch backends
|
||||||
function handleSmooth(plt::Plot{PyPlotBackend}, ax, d::KW, smooth::Bool)
|
# function handleSmooth(plt::Plot{PyPlotBackend}, ax, d::KW, smooth::Bool)
|
||||||
if smooth
|
# if smooth
|
||||||
xs, ys = regressionXY(d[:x], d[:y])
|
# xs, ys = regressionXY(d[:x], d[:y])
|
||||||
ax[:plot](xs, ys,
|
# ax[:plot](xs, ys,
|
||||||
# linestyle = getPyPlotLineStyle(:path, :dashdot),
|
# # linestyle = py_linestyle(:path, :dashdot),
|
||||||
color = getPyPlotColor(d[:linecolor]),
|
# color = py_color(d[:linecolor]),
|
||||||
linewidth = 2
|
# linewidth = 2
|
||||||
)
|
# )
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
handleSmooth(plt::Plot{PyPlotBackend}, ax, d::KW, smooth::Real) = handleSmooth(plt, ax, d, true)
|
# handleSmooth(plt::Plot{PyPlotBackend}, ax, d::KW, smooth::Real) = handleSmooth(plt, ax, d, true)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -244,7 +239,7 @@ end
|
|||||||
|
|
||||||
# total hack due to PyPlot bug (see issue #145).
|
# total hack due to PyPlot bug (see issue #145).
|
||||||
# hack: duplicate the color vector when the total rgba fields is the same as the series length
|
# hack: duplicate the color vector when the total rgba fields is the same as the series length
|
||||||
function color_fix(c, x)
|
function py_color_fix(c, x)
|
||||||
if (typeof(c) <: AbstractArray && length(c)*4 == length(x)) ||
|
if (typeof(c) <: AbstractArray && length(c)*4 == length(x)) ||
|
||||||
(typeof(c) <: Tuple && length(x) == 4)
|
(typeof(c) <: Tuple && length(x) == 4)
|
||||||
vcat(c, c)
|
vcat(c, c)
|
||||||
@ -253,49 +248,49 @@ function color_fix(c, x)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pylinecolor(d::KW) = getPyPlotColor(d[:linecolor], d[:linealpha])
|
py_linecolor(d::KW) = py_color(d[:linecolor], d[:linealpha])
|
||||||
pymarkercolor(d::KW) = getPyPlotColor(d[:markercolor], d[:markeralpha])
|
py_markercolor(d::KW) = py_color(d[:markercolor], d[:markeralpha])
|
||||||
pymarkerstrokecolor(d::KW) = getPyPlotColor(d[:markerstrokecolor], d[:markerstrokealpha])
|
py_markerstrokecolor(d::KW) = py_color(d[:markerstrokecolor], d[:markerstrokealpha])
|
||||||
pyfillcolor(d::KW) = getPyPlotColor(d[:fillcolor], d[:fillalpha])
|
py_fillcolor(d::KW) = py_color(d[:fillcolor], d[:fillalpha])
|
||||||
|
|
||||||
pylinecolormap(d::KW) = getPyPlotColorMap(d[:linecolor], d[:linealpha])
|
py_linecolormap(d::KW) = py_colormap(d[:linecolor], d[:linealpha])
|
||||||
pymarkercolormap(d::KW) = getPyPlotColorMap(d[:markercolor], d[:markeralpha])
|
py_markercolormap(d::KW) = py_colormap(d[:markercolor], d[:markeralpha])
|
||||||
pyfillcolormap(d::KW) = getPyPlotColorMap(d[:fillcolor], d[:fillalpha])
|
py_fillcolormap(d::KW) = py_colormap(d[:fillcolor], d[:fillalpha])
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
# TODO: these can probably be removed eventually... right now they're just keeping things working before cleanup
|
# TODO: these can probably be removed eventually... right now they're just keeping things working before cleanup
|
||||||
|
|
||||||
getAxis(sp::Subplot) = sp.o
|
# getAxis(sp::Subplot) = sp.o
|
||||||
|
|
||||||
function getAxis(plt::Plot{PyPlotBackend}, series::Series)
|
# function getAxis(plt::Plot{PyPlotBackend}, series::Series)
|
||||||
sp = get_subplot(plt, get(series.d, :subplot, 1))
|
# sp = get_subplot(plt, get(series.d, :subplot, 1))
|
||||||
getAxis(sp)
|
# getAxis(sp)
|
||||||
end
|
# end
|
||||||
|
|
||||||
getfig(o) = o
|
# getfig(o) = o
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Figure utils -- F*** matplotlib for making me work so hard to figure this crap out
|
# Figure utils -- F*** matplotlib for making me work so hard to figure this crap out
|
||||||
|
|
||||||
# the drawing surface
|
# the drawing surface
|
||||||
canvas(fig) = fig[:canvas]
|
py_canvas(fig) = fig[:canvas]
|
||||||
|
|
||||||
# the object controlling draw commands
|
# the object controlling draw commands
|
||||||
renderer(fig) = canvas(fig)[:get_renderer]()
|
py_renderer(fig) = py_canvas(fig)[:get_renderer]()
|
||||||
|
|
||||||
# draw commands... paint the screen (probably updating internals too)
|
# draw commands... paint the screen (probably updating internals too)
|
||||||
drawfig(fig) = fig[:draw](renderer(fig))
|
py_drawfig(fig) = fig[:draw](py_renderer(fig))
|
||||||
drawax(ax) = ax[:draw](renderer(ax[:get_figure]()))
|
# py_drawax(ax) = ax[:draw](py_renderer(ax[:get_figure]()))
|
||||||
|
|
||||||
# get a vector [left, right, bottom, top] in PyPlot coords (origin is bottom-left!)
|
# get a vector [left, right, bottom, top] in PyPlot coords (origin is bottom-left!)
|
||||||
get_extents(obj) = obj[:get_window_extent]()[:get_points]()
|
py_extents(obj) = obj[:get_window_extent]()[:get_points]()
|
||||||
|
|
||||||
|
|
||||||
# compute a bounding box (with origin top-left), however pyplot gives coords with origin bottom-left
|
# compute a bounding box (with origin top-left), however pyplot gives coords with origin bottom-left
|
||||||
function py_bbox(obj)
|
function py_bbox(obj)
|
||||||
fl, fr, fb, ft = get_extents(obj[:get_figure]())
|
fl, fr, fb, ft = py_extents(obj[:get_figure]())
|
||||||
l, r, b, t = get_extents(obj)
|
l, r, b, t = py_extents(obj)
|
||||||
BoundingBox(l*px, (ft-t)*px, (r-l)*px, (t-b)*px)
|
BoundingBox(l*px, (ft-t)*px, (r-l)*px, (t-b)*px)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -381,15 +376,16 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
d = series.d
|
d = series.d
|
||||||
st = d[:seriestype]
|
st = d[:seriestype]
|
||||||
sp = d[:subplot]
|
sp = d[:subplot]
|
||||||
|
ax = sp.o
|
||||||
|
|
||||||
if !(st in supportedTypes(plt.backend))
|
if !(st in supported_types(plt.backend))
|
||||||
error("seriestype $(st) is unsupported in PyPlot. Choose from: $(supportedTypes(plt.backend))")
|
error("seriestype $(st) is unsupported in PyPlot. Choose from: $(supported_types(plt.backend))")
|
||||||
end
|
end
|
||||||
|
|
||||||
# PyPlot doesn't handle mismatched x/y
|
# PyPlot doesn't handle mismatched x/y
|
||||||
fix_xy_lengths!(plt, d)
|
fix_xy_lengths!(plt, d)
|
||||||
|
|
||||||
ax = getAxis(plt, series)
|
# ax = getAxis(plt, series)
|
||||||
x, y, z = d[:x], d[:y], d[:z]
|
x, y, z = d[:x], d[:y], d[:z]
|
||||||
xyargs = (st in _3dTypes ? (x,y,z) : (x,y))
|
xyargs = (st in _3dTypes ? (x,y,z) : (x,y))
|
||||||
|
|
||||||
@ -421,12 +417,12 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[:plot](xyargs...;
|
handle = ax[:plot](xyargs...;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
color = pylinecolor(d),
|
color = py_linecolor(d),
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
linestyle = getPyPlotLineStyle(st, d[:linestyle]),
|
linestyle = py_linestyle(st, d[:linestyle]),
|
||||||
solid_capstyle = "round",
|
solid_capstyle = "round",
|
||||||
# dash_capstyle = "round",
|
# dash_capstyle = "round",
|
||||||
drawstyle = getPyPlotStepStyle(st)
|
drawstyle = py_stepstyle(st)
|
||||||
)[1]
|
)[1]
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
|
|
||||||
@ -439,10 +435,10 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
:arrowstyle => "simple,head_length=$(a.headlength),head_width=$(a.headwidth)",
|
:arrowstyle => "simple,head_length=$(a.headlength),head_width=$(a.headwidth)",
|
||||||
:shrinkA => 0,
|
:shrinkA => 0,
|
||||||
:shrinkB => 0,
|
:shrinkB => 0,
|
||||||
:edgecolor => pylinecolor(d),
|
:edgecolor => py_linecolor(d),
|
||||||
:facecolor => pylinecolor(d),
|
:facecolor => py_linecolor(d),
|
||||||
:linewidth => d[:linewidth],
|
:linewidth => d[:linewidth],
|
||||||
:linestyle => getPyPlotLineStyle(st, d[:linestyle]),
|
:linestyle => py_linestyle(st, d[:linestyle]),
|
||||||
)
|
)
|
||||||
add_arrows(x, y) do xyprev, xy
|
add_arrows(x, y) do xyprev, xy
|
||||||
ax[:annotate]("",
|
ax[:annotate]("",
|
||||||
@ -471,8 +467,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[isvertical(d) ? :bar : :barh](x, y;
|
handle = ax[isvertical(d) ? :bar : :barh](x, y;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
color = pyfillcolor(d),
|
color = py_fillcolor(d),
|
||||||
edgecolor = pylinecolor(d),
|
edgecolor = py_linecolor(d),
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
align = d[:bar_edges] ? "edge" : "center",
|
align = d[:bar_edges] ? "edge" : "center",
|
||||||
extrakw...
|
extrakw...
|
||||||
@ -485,8 +481,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[isvertical(d) ? :bar : :barh](x, y;
|
handle = ax[isvertical(d) ? :bar : :barh](x, y;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
color = pylinecolor(d),
|
color = py_linecolor(d),
|
||||||
edgecolor = pylinecolor(d),
|
edgecolor = py_linecolor(d),
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
align = "center",
|
align = "center",
|
||||||
extrakw...
|
extrakw...
|
||||||
@ -500,10 +496,10 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
:bar, :sticks)
|
:bar, :sticks)
|
||||||
extrakw = KW()
|
extrakw = KW()
|
||||||
if d[:marker_z] == nothing
|
if d[:marker_z] == nothing
|
||||||
extrakw[:c] = color_fix(pymarkercolor(d), x)
|
extrakw[:c] = py_color_fix(py_markercolor(d), x)
|
||||||
else
|
else
|
||||||
extrakw[:c] = convert(Vector{Float64}, d[:marker_z])
|
extrakw[:c] = convert(Vector{Float64}, d[:marker_z])
|
||||||
extrakw[:cmap] = pymarkercolormap(d)
|
extrakw[:cmap] = py_markercolormap(d)
|
||||||
clims = sp[:clims]
|
clims = sp[:clims]
|
||||||
if isa(clims, Tuple) && length(clims) == 2
|
if isa(clims, Tuple) && length(clims) == 2
|
||||||
isfinite(clims[1]) && (extrakw[:vmin] = clims[1])
|
isfinite(clims[1]) && (extrakw[:vmin] = clims[1])
|
||||||
@ -519,9 +515,9 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[:scatter](xyargs...;
|
handle = ax[:scatter](xyargs...;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n + 0.5,
|
zorder = plt.n + 0.5,
|
||||||
marker = getPyPlotMarker(d[:markershape]),
|
marker = py_marker(d[:markershape]),
|
||||||
s = d[:markersize] .^ 2,
|
s = d[:markersize] .^ 2,
|
||||||
edgecolors = pymarkerstrokecolor(d),
|
edgecolors = py_markerstrokecolor(d),
|
||||||
linewidths = d[:markerstrokewidth],
|
linewidths = d[:markerstrokewidth],
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
@ -532,8 +528,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[:hist](y;
|
handle = ax[:hist](y;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
color = pyfillcolor(d),
|
color = py_fillcolor(d),
|
||||||
edgecolor = pylinecolor(d),
|
edgecolor = py_linecolor(d),
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
bins = d[:bins],
|
bins = d[:bins],
|
||||||
normed = d[:normalize],
|
normed = d[:normalize],
|
||||||
@ -564,7 +560,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
bins = d[:bins],
|
bins = d[:bins],
|
||||||
normed = d[:normalize],
|
normed = d[:normalize],
|
||||||
weights = d[:weights],
|
weights = d[:weights],
|
||||||
cmap = pyfillcolormap(d), # applies to the pcolorfast object
|
cmap = py_fillcolormap(d), # applies to the pcolorfast object
|
||||||
extrakw...
|
extrakw...
|
||||||
)[4]
|
)[4]
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -588,8 +584,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
gridsize = d[:bins],
|
gridsize = d[:bins],
|
||||||
linewidths = d[:linewidth],
|
linewidths = d[:linewidth],
|
||||||
edgecolors = pylinecolor(d),
|
edgecolors = py_linecolor(d),
|
||||||
cmap = pyfillcolormap(d), # applies to the pcolorfast object
|
cmap = py_fillcolormap(d), # applies to the pcolorfast object
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -601,8 +597,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
func = ax[st == :hline ? :axhline : :axvline]
|
func = ax[st == :hline ? :axhline : :axvline]
|
||||||
handle = func(yi;
|
handle = func(yi;
|
||||||
linewidth=d[:linewidth],
|
linewidth=d[:linewidth],
|
||||||
color=pylinecolor(d),
|
color=py_linecolor(d),
|
||||||
linestyle=getPyPlotLineStyle(st, d[:linestyle])
|
linestyle=py_linestyle(st, d[:linestyle])
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
end
|
end
|
||||||
@ -628,8 +624,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
linewidths = d[:linewidth],
|
linewidths = d[:linewidth],
|
||||||
linestyles = getPyPlotLineStyle(st, d[:linestyle]),
|
linestyles = py_linestyle(st, d[:linestyle]),
|
||||||
cmap = pylinecolormap(d),
|
cmap = py_linecolormap(d),
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -639,7 +635,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[:contourf](x, y, z, levelargs...;
|
handle = ax[:contourf](x, y, z, levelargs...;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n + 0.5,
|
zorder = plt.n + 0.5,
|
||||||
cmap = pyfillcolormap(d),
|
cmap = py_fillcolormap(d),
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -657,7 +653,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
z = transpose_z(d, z)
|
z = transpose_z(d, z)
|
||||||
if st == :surface
|
if st == :surface
|
||||||
if d[:marker_z] != nothing
|
if d[:marker_z] != nothing
|
||||||
extrakw[:facecolors] = getPyPlotCustomShading(d[:fillcolor], d[:marker_z], d[:fillalpha])
|
extrakw[:facecolors] = py_shading(d[:fillcolor], d[:marker_z], d[:fillalpha])
|
||||||
extrakw[:shade] = false
|
extrakw[:shade] = false
|
||||||
clims = sp[:clims]
|
clims = sp[:clims]
|
||||||
if isa(clims, Tuple) && length(clims) == 2
|
if isa(clims, Tuple) && length(clims) == 2
|
||||||
@ -665,7 +661,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
isfinite(clims[2]) && (extrakw[:vmax] = clims[2])
|
isfinite(clims[2]) && (extrakw[:vmax] = clims[2])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
extrakw[:cmap] = pyfillcolormap(d)
|
extrakw[:cmap] = py_fillcolormap(d)
|
||||||
needs_colorbar = true
|
needs_colorbar = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -675,7 +671,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
rstride = 1,
|
rstride = 1,
|
||||||
cstride = 1,
|
cstride = 1,
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
edgecolor = pylinecolor(d),
|
edgecolor = py_linecolor(d),
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -686,7 +682,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
offset = (zdir == "y" ? maximum : minimum)(mat)
|
offset = (zdir == "y" ? maximum : minimum)(mat)
|
||||||
handle = ax[:contourf](x, y, z, levelargs...;
|
handle = ax[:contourf](x, y, z, levelargs...;
|
||||||
zdir = zdir,
|
zdir = zdir,
|
||||||
cmap = pyfillcolormap(d),
|
cmap = py_fillcolormap(d),
|
||||||
offset = (zdir == "y" ? maximum : minimum)(mat) # where to draw the contour plane
|
offset = (zdir == "y" ? maximum : minimum)(mat) # where to draw the contour plane
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -709,9 +705,9 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[:plot_trisurf](x, y, z;
|
handle = ax[:plot_trisurf](x, y, z;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
cmap = pyfillcolormap(d),
|
cmap = py_fillcolormap(d),
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
edgecolor = pylinecolor(d),
|
edgecolor = py_linecolor(d),
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -733,7 +729,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
end
|
end
|
||||||
handle = ax[:imshow](z;
|
handle = ax[:imshow](z;
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
cmap = getPyPlotColorMap([:black, :white]),
|
cmap = py_colormap([:black, :white]),
|
||||||
vmin = 0.0,
|
vmin = 0.0,
|
||||||
vmax = 1.0
|
vmax = 1.0
|
||||||
)
|
)
|
||||||
@ -764,8 +760,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
handle = ax[:pcolormesh](x, y, z;
|
handle = ax[:pcolormesh](x, y, z;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
cmap = pyfillcolormap(d),
|
cmap = py_fillcolormap(d),
|
||||||
edgecolors = (d[:linewidth] > 0 ? pylinecolor(d) : "face"),
|
edgecolors = (d[:linewidth] > 0 ? py_linecolor(d) : "face"),
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -783,12 +779,12 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if st == :shape
|
if st == :shape
|
||||||
path = buildPyPlotPath(x, y)
|
path = py_path(x, y)
|
||||||
patches = pypatches.pymember("PathPatch")(path;
|
patches = pypatches.pymember("PathPatch")(path;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
edgecolor = pymarkerstrokecolor(d),
|
edgecolor = py_markerstrokecolor(d),
|
||||||
facecolor = pymarkercolor(d),
|
facecolor = py_markercolor(d),
|
||||||
linewidth = d[:markerstrokewidth],
|
linewidth = d[:markerstrokewidth],
|
||||||
fill = true
|
fill = true
|
||||||
)
|
)
|
||||||
@ -813,8 +809,8 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
|
|
||||||
d[:serieshandle] = handles
|
d[:serieshandle] = handles
|
||||||
|
|
||||||
# smoothing
|
# # smoothing
|
||||||
handleSmooth(plt, ax, d, d[:smooth])
|
# handleSmooth(plt, ax, d, d[:smooth])
|
||||||
|
|
||||||
# add the colorbar legend
|
# add the colorbar legend
|
||||||
if needs_colorbar && sp[:colorbar] != :none
|
if needs_colorbar && sp[:colorbar] != :none
|
||||||
@ -854,7 +850,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
|
|
||||||
handle = ax[f](args...;
|
handle = ax[f](args...;
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
facecolor = pyfillcolor(d),
|
facecolor = py_fillcolor(d),
|
||||||
linewidths = 0
|
linewidths = 0
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
@ -866,7 +862,7 @@ end
|
|||||||
|
|
||||||
function update_limits!(sp::Subplot{PyPlotBackend}, series::Series, letters)
|
function update_limits!(sp::Subplot{PyPlotBackend}, series::Series, letters)
|
||||||
for letter in letters
|
for letter in letters
|
||||||
setPyPlotLims(sp.o, sp[Symbol(letter, :axis)])
|
py_set_lims(sp.o, sp[Symbol(letter, :axis)])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -890,13 +886,13 @@ end
|
|||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
function setPyPlotLims(ax, axis::Axis)
|
function py_set_lims(ax, axis::Axis)
|
||||||
letter = axis[:letter]
|
letter = axis[:letter]
|
||||||
lfrom, lto = axis_limits(axis)
|
lfrom, lto = axis_limits(axis)
|
||||||
ax[Symbol("set_", letter, "lim")](lfrom, lto)
|
ax[Symbol("set_", letter, "lim")](lfrom, lto)
|
||||||
end
|
end
|
||||||
|
|
||||||
function addPyPlotTicks(ax, ticks, letter)
|
function py_set_ticks(ax, ticks, letter)
|
||||||
ticks == :auto && return
|
ticks == :auto && return
|
||||||
axis = ax[Symbol(letter,"axis")]
|
axis = ax[Symbol(letter,"axis")]
|
||||||
if ticks == :none || ticks == nothing
|
if ticks == :none || ticks == nothing
|
||||||
@ -919,8 +915,8 @@ function addPyPlotTicks(ax, ticks, letter)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function applyPyPlotScale(ax, scaleType::Symbol, letter)
|
function py_set_scale(ax, scaleType::Symbol, letter)
|
||||||
scaleType in supportedScales() || return warn("Unhandled scale value in pyplot: $scaleType")
|
scaleType in supported_scales() || return warn("Unhandled scale value in pyplot: $scaleType")
|
||||||
func = ax[Symbol("set_", letter, "scale")]
|
func = ax[Symbol("set_", letter, "scale")]
|
||||||
kw = KW()
|
kw = KW()
|
||||||
arg = if scaleType == :identity
|
arg = if scaleType == :identity
|
||||||
@ -940,16 +936,16 @@ function applyPyPlotScale(ax, scaleType::Symbol, letter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function updateAxisColors(ax, a::Axis)
|
function py_set_axis_colors(ax, a::Axis)
|
||||||
for (loc, spine) in ax[:spines]
|
for (loc, spine) in ax[:spines]
|
||||||
spine[:set_color](getPyPlotColor(a[:foreground_color_border]))
|
spine[:set_color](py_color(a[:foreground_color_border]))
|
||||||
end
|
end
|
||||||
axissym = Symbol(a[:letter], :axis)
|
axissym = Symbol(a[:letter], :axis)
|
||||||
if haskey(ax, axissym)
|
if haskey(ax, axissym)
|
||||||
ax[:tick_params](axis=string(a[:letter]), which="both",
|
ax[:tick_params](axis=string(a[:letter]), which="both",
|
||||||
colors=getPyPlotColor(a[:foreground_color_axis]),
|
colors=py_color(a[:foreground_color_axis]),
|
||||||
labelcolor=getPyPlotColor(a[:foreground_color_text]))
|
labelcolor=py_color(a[:foreground_color_text]))
|
||||||
ax[axissym][:label][:set_color](getPyPlotColor(a[:foreground_color_guide]))
|
ax[axissym][:label][:set_color](py_color(a[:foreground_color_guide]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -962,7 +958,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
w, h = plt[:size]
|
w, h = plt[:size]
|
||||||
fig = plt.o
|
fig = plt.o
|
||||||
fig[:set_size_inches](px2inch(w), px2inch(h), forward = true)
|
fig[:set_size_inches](px2inch(w), px2inch(h), forward = true)
|
||||||
fig[:set_facecolor](getPyPlotColor(plt[:background_color_outside]))
|
fig[:set_facecolor](py_color(plt[:background_color_outside]))
|
||||||
fig[:set_dpi](DPI)
|
fig[:set_dpi](DPI)
|
||||||
|
|
||||||
# resize the window
|
# resize the window
|
||||||
@ -970,14 +966,15 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
|
|
||||||
# update subplots
|
# update subplots
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
ax = getAxis(sp)
|
# ax = getAxis(sp)
|
||||||
|
ax = sp.o
|
||||||
if ax == nothing
|
if ax == nothing
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
# add the annotations
|
# add the annotations
|
||||||
for ann in sp[:annotations]
|
for ann in sp[:annotations]
|
||||||
createPyPlotAnnotationObject(sp, ann...)
|
py_add_annotations(sp, ann...)
|
||||||
end
|
end
|
||||||
|
|
||||||
# title
|
# title
|
||||||
@ -992,7 +989,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
end
|
end
|
||||||
ax[field][:set_text](sp[:title])
|
ax[field][:set_text](sp[:title])
|
||||||
ax[field][:set_fontsize](sp[:titlefont].pointsize)
|
ax[field][:set_fontsize](sp[:titlefont].pointsize)
|
||||||
ax[field][:set_color](getPyPlotColor(sp[:foreground_color_title]))
|
ax[field][:set_color](py_color(sp[:foreground_color_title]))
|
||||||
# ax[:set_title](sp[:title], loc = loc)
|
# ax[:set_title](sp[:title], loc = loc)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1001,9 +998,9 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
axissym = Symbol(letter, :axis)
|
axissym = Symbol(letter, :axis)
|
||||||
axis = sp[axissym]
|
axis = sp[axissym]
|
||||||
haskey(ax, axissym) || continue
|
haskey(ax, axissym) || continue
|
||||||
applyPyPlotScale(ax, axis[:scale], letter)
|
py_set_scale(ax, axis[:scale], letter)
|
||||||
setPyPlotLims(ax, axis)
|
py_set_lims(ax, axis)
|
||||||
addPyPlotTicks(ax, get_ticks(axis), letter)
|
py_set_ticks(ax, get_ticks(axis), letter)
|
||||||
ax[Symbol("set_", letter, "label")](axis[:guide])
|
ax[Symbol("set_", letter, "label")](axis[:guide])
|
||||||
if get(axis.d, :flip, false)
|
if get(axis.d, :flip, false)
|
||||||
ax[Symbol("invert_", letter, "axis")]()
|
ax[Symbol("invert_", letter, "axis")]()
|
||||||
@ -1014,11 +1011,11 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
lab[:set_rotation](axis[:rotation])
|
lab[:set_rotation](axis[:rotation])
|
||||||
end
|
end
|
||||||
if sp[:grid]
|
if sp[:grid]
|
||||||
fgcolor = getPyPlotColor(sp[:foreground_color_grid])
|
fgcolor = py_color(sp[:foreground_color_grid])
|
||||||
ax[axissym][:grid](true, color = fgcolor)
|
ax[axissym][:grid](true, color = fgcolor)
|
||||||
ax[:set_axisbelow](true)
|
ax[:set_axisbelow](true)
|
||||||
end
|
end
|
||||||
updateAxisColors(ax, axis)
|
py_set_axis_colors(ax, axis)
|
||||||
end
|
end
|
||||||
|
|
||||||
# aspect ratio
|
# aspect ratio
|
||||||
@ -1028,12 +1025,12 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
end
|
end
|
||||||
|
|
||||||
# legend
|
# legend
|
||||||
addPyPlotLegend(plt, sp, ax)
|
py_add_legend(plt, sp, ax)
|
||||||
|
|
||||||
# this sets the bg color inside the grid
|
# this sets the bg color inside the grid
|
||||||
ax[:set_axis_bgcolor](getPyPlotColor(sp[:background_color_inside]))
|
ax[:set_axis_bgcolor](py_color(sp[:background_color_inside]))
|
||||||
end
|
end
|
||||||
drawfig(fig)
|
py_drawfig(fig)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1073,18 +1070,18 @@ end
|
|||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
function createPyPlotAnnotationObject(sp::Subplot{PyPlotBackend}, x, y, val)
|
function py_add_annotations(sp::Subplot{PyPlotBackend}, x, y, val)
|
||||||
ax = sp.o
|
ax = sp.o
|
||||||
ax[:annotate](val, xy = (x,y), zorder = 999)
|
ax[:annotate](val, xy = (x,y), zorder = 999)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function createPyPlotAnnotationObject(sp::Subplot{PyPlotBackend}, x, y, val::PlotText)
|
function py_add_annotations(sp::Subplot{PyPlotBackend}, x, y, val::PlotText)
|
||||||
ax = sp.o
|
ax = sp.o
|
||||||
ax[:annotate](val.str,
|
ax[:annotate](val.str,
|
||||||
xy = (x,y),
|
xy = (x,y),
|
||||||
family = val.font.family,
|
family = val.font.family,
|
||||||
color = getPyPlotColor(val.font.color),
|
color = py_color(val.font.color),
|
||||||
horizontalalignment = val.font.halign == :hcenter ? "center" : string(val.font.halign),
|
horizontalalignment = val.font.halign == :hcenter ? "center" : string(val.font.halign),
|
||||||
verticalalignment = val.font.valign == :vcenter ? "center" : string(val.font.valign),
|
verticalalignment = val.font.valign == :vcenter ? "center" : string(val.font.valign),
|
||||||
rotation = val.font.rotation * 180 / π,
|
rotation = val.font.rotation * 180 / π,
|
||||||
@ -1121,7 +1118,7 @@ const _pyplot_legend_pos = KW(
|
|||||||
:topleft => "upper left"
|
:topleft => "upper left"
|
||||||
)
|
)
|
||||||
|
|
||||||
function addPyPlotLegend(plt::Plot, sp::Subplot, ax)
|
function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||||
leg = sp[:legend]
|
leg = sp[:legend]
|
||||||
if leg != :none
|
if leg != :none
|
||||||
# gotta do this to ensure both axes are included
|
# gotta do this to ensure both axes are included
|
||||||
@ -1131,7 +1128,7 @@ function addPyPlotLegend(plt::Plot, sp::Subplot, ax)
|
|||||||
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.d[:seriestype] == :histogram
|
push!(handles, if series.d[:seriestype] == :histogram
|
||||||
PyPlot.plt[:Line2D]((0,1),(0,0), color=pyfillcolor(series.d), linewidth=4)
|
PyPlot.plt[:Line2D]((0,1),(0,0), color=py_fillcolor(series.d), linewidth=4)
|
||||||
else
|
else
|
||||||
series.d[:serieshandle][1]
|
series.d[:serieshandle][1]
|
||||||
end)
|
end)
|
||||||
@ -1150,14 +1147,14 @@ function addPyPlotLegend(plt::Plot, sp::Subplot, ax)
|
|||||||
)
|
)
|
||||||
leg[:set_zorder](1000)
|
leg[:set_zorder](1000)
|
||||||
|
|
||||||
fgcolor = getPyPlotColor(sp[:foreground_color_legend])
|
fgcolor = py_color(sp[:foreground_color_legend])
|
||||||
for txt in leg[:get_texts]()
|
for txt in leg[:get_texts]()
|
||||||
PyPlot.plt[:setp](txt, color = fgcolor)
|
PyPlot.plt[:setp](txt, color = fgcolor)
|
||||||
end
|
end
|
||||||
|
|
||||||
# set some legend properties
|
# set some legend properties
|
||||||
frame = leg[:get_frame]()
|
frame = leg[:get_frame]()
|
||||||
frame[:set_facecolor](getPyPlotColor(sp[:background_color_legend]))
|
frame[:set_facecolor](py_color(sp[:background_color_legend]))
|
||||||
frame[:set_edgecolor](fgcolor)
|
frame[:set_edgecolor](fgcolor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# https://github.com/tbreloff/Qwt.jl
|
# https://github.com/tbreloff/Qwt.jl
|
||||||
|
|
||||||
|
|
||||||
supportedArgs(::QwtBackend) = [
|
supported_args(::QwtBackend) = [
|
||||||
:annotations,
|
:annotations,
|
||||||
:axis,
|
:axis,
|
||||||
:background_color,
|
:background_color,
|
||||||
@ -44,10 +44,10 @@ supportedArgs(::QwtBackend) = [
|
|||||||
:xscale,
|
:xscale,
|
||||||
:yscale,
|
:yscale,
|
||||||
]
|
]
|
||||||
supportedTypes(::QwtBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :histogram2d, :hexbin, :histogram, :bar, :hline, :vline]
|
supported_types(::QwtBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :histogram2d, :hexbin, :histogram, :bar, :hline, :vline]
|
||||||
supportedMarkers(::QwtBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon]
|
supported_markers(::QwtBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon]
|
||||||
supportedScales(::QwtBackend) = [:identity, :log10]
|
supported_scales(::QwtBackend) = [:identity, :log10]
|
||||||
subplotSupported(::QwtBackend) = true
|
is_subplot_supported(::QwtBackend) = true
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
@ -184,7 +184,7 @@ function updateLimsAndTicks(plt::Plot{QwtBackend}, d::KW, isx::Bool)
|
|||||||
# scaletype == :log && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(e))
|
# scaletype == :log && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(e))
|
||||||
# scaletype == :log2 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(2))
|
# scaletype == :log2 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(2))
|
||||||
scaletype == :log10 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLog10ScaleEngine())
|
scaletype == :log10 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLog10ScaleEngine())
|
||||||
scaletype in supportedScales() || warn("Unsupported scale type: ", scaletype)
|
scaletype in supported_scales() || warn("Unsupported scale type: ", scaletype)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
# https://github.com/Evizero/UnicodePlots.jl
|
# https://github.com/Evizero/UnicodePlots.jl
|
||||||
|
|
||||||
supportedArgs(::UnicodePlotsBackend) = [
|
supported_args(::UnicodePlotsBackend) = [
|
||||||
# :annotations,
|
# :annotations,
|
||||||
# :args,
|
# :args,
|
||||||
# :axis,
|
# :axis,
|
||||||
@ -51,19 +51,18 @@ supportedArgs(::UnicodePlotsBackend) = [
|
|||||||
# :yflip,
|
# :yflip,
|
||||||
# :z,
|
# :z,
|
||||||
]
|
]
|
||||||
supportedAxes(::UnicodePlotsBackend) = [:auto, :left]
|
supported_types(::UnicodePlotsBackend) = [
|
||||||
supportedTypes(::UnicodePlotsBackend) = [
|
|
||||||
:path, :steppre, :steppost, :scatter,
|
:path, :steppre, :steppost, :scatter,
|
||||||
:histogram2d, :hline, :vline
|
:histogram2d, :hline, :vline
|
||||||
]
|
]
|
||||||
supportedStyles(::UnicodePlotsBackend) = [:auto, :solid]
|
supported_styles(::UnicodePlotsBackend) = [:auto, :solid]
|
||||||
supportedMarkers(::UnicodePlotsBackend) = [:none, :auto, :ellipse]
|
supported_markers(::UnicodePlotsBackend) = [:none, :auto, :ellipse]
|
||||||
supportedScales(::UnicodePlotsBackend) = [:identity]
|
supported_scales(::UnicodePlotsBackend) = [:identity]
|
||||||
subplotSupported(::UnicodePlotsBackend) = true
|
is_subplot_supported(::UnicodePlotsBackend) = true
|
||||||
|
|
||||||
|
|
||||||
# don't warn on unsupported... there's just too many warnings!!
|
# don't warn on unsupported... there's just too many warnings!!
|
||||||
warnOnUnsupportedArgs(pkg::UnicodePlotsBackend, d::KW) = nothing
|
warnOnUnsupported_args(pkg::UnicodePlotsBackend, d::KW) = nothing
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# credit goes to https://github.com/jverzani for contributing to the first draft of this backend implementation
|
# credit goes to https://github.com/jverzani for contributing to the first draft of this backend implementation
|
||||||
|
|
||||||
supportedArgs(::WinstonBackend) = [
|
supported_args(::WinstonBackend) = [
|
||||||
:annotations,
|
:annotations,
|
||||||
# :args,
|
# :args,
|
||||||
# :axis,
|
# :axis,
|
||||||
@ -55,12 +55,11 @@ supportedArgs(::WinstonBackend) = [
|
|||||||
# :yflip,
|
# :yflip,
|
||||||
# :z,
|
# :z,
|
||||||
]
|
]
|
||||||
supportedAxes(::WinstonBackend) = [:auto, :left]
|
supported_types(::WinstonBackend) = [:none, :line, :path, :sticks, :scatter, :histogram, :bar]
|
||||||
supportedTypes(::WinstonBackend) = [:none, :line, :path, :sticks, :scatter, :histogram, :bar]
|
supported_styles(::WinstonBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedStyles(::WinstonBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supported_markers(::WinstonBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
|
||||||
supportedMarkers(::WinstonBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
|
supported_scales(::WinstonBackend) = [:identity, :log10]
|
||||||
supportedScales(::WinstonBackend) = [:identity, :log10]
|
is_subplot_supported(::WinstonBackend) = false
|
||||||
subplotSupported(::WinstonBackend) = false
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -115,7 +115,7 @@ PlotExample("Line types",
|
|||||||
PlotExample("Line styles",
|
PlotExample("Line styles",
|
||||||
"",
|
"",
|
||||||
[:(begin
|
[:(begin
|
||||||
styles = setdiff(supportedStyles(), [:auto])'
|
styles = setdiff(supported_styles(), [:auto])'
|
||||||
plot(cumsum(randn(20,length(styles)),1), style=:auto, label=map(string,styles), w=5)
|
plot(cumsum(randn(20,length(styles)),1), style=:auto, label=map(string,styles), w=5)
|
||||||
end)]
|
end)]
|
||||||
),
|
),
|
||||||
@ -123,7 +123,7 @@ PlotExample("Line styles",
|
|||||||
PlotExample("Marker types",
|
PlotExample("Marker types",
|
||||||
"",
|
"",
|
||||||
[:(begin
|
[:(begin
|
||||||
markers = setdiff(supportedMarkers(), [:none,:auto,Shape])'
|
markers = setdiff(supported_markers(), [:none,:auto,Shape])'
|
||||||
n = length(markers)
|
n = length(markers)
|
||||||
x = linspace(0,10,n+2)[2:end-1]
|
x = linspace(0,10,n+2)[2:end-1]
|
||||||
y = repmat(reverse(x)', n, 1)
|
y = repmat(reverse(x)', n, 1)
|
||||||
|
|||||||
@ -161,7 +161,7 @@ end
|
|||||||
function _apply_series_recipe(plt::Plot, d::KW)
|
function _apply_series_recipe(plt::Plot, d::KW)
|
||||||
st = d[:seriestype]
|
st = d[:seriestype]
|
||||||
# @show st
|
# @show st
|
||||||
if st in supportedTypes()
|
if st in supported_types()
|
||||||
|
|
||||||
# getting ready to add the series... last update to subplot from anything
|
# getting ready to add the series... last update to subplot from anything
|
||||||
# that might have been added during series recipes
|
# that might have been added during series recipes
|
||||||
@ -192,7 +192,7 @@ function _apply_series_recipe(plt::Plot, d::KW)
|
|||||||
|
|
||||||
|
|
||||||
# add the series!
|
# add the series!
|
||||||
warnOnUnsupportedArgs(plt.backend, d)
|
warnOnUnsupported_args(plt.backend, d)
|
||||||
warnOnUnsupported(plt.backend, d)
|
warnOnUnsupported(plt.backend, d)
|
||||||
series = Series(d)
|
series = Series(d)
|
||||||
push!(plt.series_list, series)
|
push!(plt.series_list, series)
|
||||||
@ -282,7 +282,7 @@ function _plot!(plt::Plot, d::KW, args...)
|
|||||||
kw[:series_plotindex] = plt.n
|
kw[:series_plotindex] = plt.n
|
||||||
|
|
||||||
# check that the backend will support the command and add it to the list
|
# check that the backend will support the command and add it to the list
|
||||||
warnOnUnsupportedScales(plt.backend, kw)
|
warnOnUnsupported_scales(plt.backend, kw)
|
||||||
push!(kw_list, kw)
|
push!(kw_list, kw)
|
||||||
|
|
||||||
# handle error bars by creating new recipedata data... these will have
|
# handle error bars by creating new recipedata data... these will have
|
||||||
|
|||||||
@ -800,7 +800,7 @@ end
|
|||||||
|
|
||||||
# function apply_series_recipe(d::KW, ::Type{Val{:quiver}})
|
# function apply_series_recipe(d::KW, ::Type{Val{:quiver}})
|
||||||
@recipe function f(::Type{Val{:quiver}}, x, y, z)
|
@recipe function f(::Type{Val{:quiver}}, x, y, z)
|
||||||
if :arrow in supportedArgs()
|
if :arrow in supported_args()
|
||||||
quiver_using_arrows(d)
|
quiver_using_arrows(d)
|
||||||
else
|
else
|
||||||
quiver_using_hack(d)
|
quiver_using_hack(d)
|
||||||
|
|||||||
@ -17,8 +17,8 @@ function _add_defaults!(d::KW, plt::Plot, sp::Subplot, commandIndex::Int)
|
|||||||
plotIndex += 1
|
plotIndex += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
aliasesAndAutopick(d, :linestyle, _styleAliases, supportedStyles(pkg), plotIndex)
|
aliasesAndAutopick(d, :linestyle, _styleAliases, supported_styles(pkg), plotIndex)
|
||||||
aliasesAndAutopick(d, :markershape, _markerAliases, supportedMarkers(pkg), plotIndex)
|
aliasesAndAutopick(d, :markershape, _markerAliases, supported_markers(pkg), plotIndex)
|
||||||
|
|
||||||
# update color
|
# update color
|
||||||
d[:seriescolor] = getSeriesRGBColor(d[:seriescolor], sp, plotIndex)
|
d[:seriescolor] = getSeriesRGBColor(d[:seriescolor], sp, plotIndex)
|
||||||
|
|||||||
@ -131,7 +131,7 @@ function replace_image_with_heatmap{T<:Colorant}(z::Array{T})
|
|||||||
end
|
end
|
||||||
|
|
||||||
function imageHack(d::KW)
|
function imageHack(d::KW)
|
||||||
:heatmap in supportedTypes() || error("Neither :image or :heatmap are supported!")
|
:heatmap in supported_types() || error("Neither :image or :heatmap are supported!")
|
||||||
d[:seriestype] = :heatmap
|
d[:seriestype] = :heatmap
|
||||||
d[:z], d[:fillcolor] = replace_image_with_heatmap(d[:z].surf)
|
d[:z], d[:fillcolor] = replace_image_with_heatmap(d[:z].surf)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user