orientation aliases dir/direction; removed native support for sticks/hline/vline in pyplot; commented out arcdiagram
This commit is contained in:
parent
c38e947dc6
commit
b0bc68ae8a
@ -431,6 +431,7 @@ add_aliases(:projection, :proj)
|
|||||||
add_aliases(:title_location, :title_loc, :titleloc, :title_position, :title_pos, :titlepos, :titleposition, :title_align, :title_alignment)
|
add_aliases(:title_location, :title_loc, :titleloc, :title_position, :title_pos, :titlepos, :titleposition, :title_align, :title_alignment)
|
||||||
add_aliases(:series_annotations, :series_ann, :seriesann, :series_anns, :seriesanns, :series_annotation)
|
add_aliases(:series_annotations, :series_ann, :seriesann, :series_anns, :seriesanns, :series_annotation)
|
||||||
add_aliases(:html_output_format, :format, :fmt, :html_format)
|
add_aliases(:html_output_format, :format, :fmt, :html_format)
|
||||||
|
add_aliases(:orientation, :direction, :dir)
|
||||||
|
|
||||||
|
|
||||||
# add all pluralized forms to the _keyAliases dict
|
# add all pluralized forms to the _keyAliases dict
|
||||||
|
|||||||
@ -34,8 +34,8 @@ supported_args(::PyPlotBackend) = merge_with_base_supported([
|
|||||||
supported_types(::PyPlotBackend) = [
|
supported_types(::PyPlotBackend) = [
|
||||||
:path, :steppre, :steppost, :shape,
|
:path, :steppre, :steppost, :shape,
|
||||||
:scatter, :histogram2d, :hexbin, :histogram,
|
:scatter, :histogram2d, :hexbin, :histogram,
|
||||||
:bar, :sticks,
|
:bar,
|
||||||
:hline, :vline, :heatmap, :pie, :image,
|
:heatmap, :pie, :image,
|
||||||
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
||||||
]
|
]
|
||||||
supported_styles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supported_styles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
@ -508,24 +508,24 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
end
|
end
|
||||||
|
|
||||||
if st == :sticks
|
# if st == :sticks
|
||||||
extrakw[isvertical(d) ? :width : :height] = 0.0
|
# extrakw[isvertical(d) ? :width : :height] = 0.0
|
||||||
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 = py_linecolor(d),
|
# color = py_linecolor(d),
|
||||||
edgecolor = py_linecolor(d),
|
# edgecolor = py_linecolor(d),
|
||||||
linewidth = d[:linewidth],
|
# linewidth = d[:linewidth],
|
||||||
align = "center",
|
# align = "center",
|
||||||
extrakw...
|
# extrakw...
|
||||||
)[1]
|
# )[1]
|
||||||
push!(handles, handle)
|
# push!(handles, handle)
|
||||||
end
|
# end
|
||||||
|
|
||||||
# add markers?
|
# add markers?
|
||||||
if d[:markershape] != :none && st in (:path, :scatter, :path3d,
|
if d[:markershape] != :none && st in (:path, :scatter, :path3d,
|
||||||
:scatter3d, :steppre, :steppost,
|
:scatter3d, :steppre, :steppost,
|
||||||
:bar, :sticks)
|
:bar)
|
||||||
extrakw = KW()
|
extrakw = KW()
|
||||||
if d[:marker_z] == nothing
|
if d[:marker_z] == nothing
|
||||||
extrakw[:c] = py_color_fix(py_markercolor(d), x)
|
extrakw[:c] = py_color_fix(py_markercolor(d), x)
|
||||||
@ -539,7 +539,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
end
|
end
|
||||||
needs_colorbar = true
|
needs_colorbar = true
|
||||||
end
|
end
|
||||||
xyargs = if st in (:bar, :sticks) && !isvertical(d)
|
xyargs = if st == :bar && !isvertical(d)
|
||||||
(y, x)
|
(y, x)
|
||||||
else
|
else
|
||||||
xyargs
|
xyargs
|
||||||
@ -624,17 +624,17 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
needs_colorbar = true
|
needs_colorbar = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if st in (:hline,:vline)
|
# if st in (:hline,:vline)
|
||||||
for yi in d[:y]
|
# for yi in d[:y]
|
||||||
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=py_linecolor(d),
|
# color=py_linecolor(d),
|
||||||
linestyle=py_linestyle(st, d[:linestyle])
|
# linestyle=py_linestyle(st, d[:linestyle])
|
||||||
)
|
# )
|
||||||
push!(handles, handle)
|
# push!(handles, handle)
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
if st in (:contour, :contour3d)
|
if st in (:contour, :contour3d)
|
||||||
# z = z.surf'
|
# z = z.surf'
|
||||||
|
|||||||
@ -1039,6 +1039,9 @@ end
|
|||||||
|
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
|
|
||||||
|
# TODO: everything below here should be either changed to a
|
||||||
|
# series recipe or moved to PlotRecipes
|
||||||
|
|
||||||
|
|
||||||
"Sparsity plot... heatmap of non-zero values of a matrix"
|
"Sparsity plot... heatmap of non-zero values of a matrix"
|
||||||
function spy{T<:Real}(z::AMat{T}; kw...)
|
function spy{T<:Real}(z::AMat{T}; kw...)
|
||||||
@ -1100,56 +1103,56 @@ end
|
|||||||
|
|
||||||
curvecolor(value, min, max, grad) = getColorZ(grad, (value-min)/(max-min))
|
curvecolor(value, min, max, grad) = getColorZ(grad, (value-min)/(max-min))
|
||||||
|
|
||||||
"Plots a clockwise arc, from source to destiny, colored by weight"
|
# "Plots a clockwise arc, from source to destiny, colored by weight"
|
||||||
function arc!(source, destiny, weight, min, max, grad)
|
# function arc!(source, destiny, weight, min, max, grad)
|
||||||
radius = (destiny - source) / 2
|
# radius = (destiny - source) / 2
|
||||||
arc = Plots.partialcircle(0, π, 30, radius)
|
# arc = Plots.partialcircle(0, π, 30, radius)
|
||||||
x, y = Plots.unzip(arc)
|
# x, y = Plots.unzip(arc)
|
||||||
plot!(x .+ radius .+ source, y, line = (curvecolor(weight, min, max, grad), 0.5, 2), legend=false)
|
# plot!(x .+ radius .+ source, y, line = (curvecolor(weight, min, max, grad), 0.5, 2), legend=false)
|
||||||
end
|
# end
|
||||||
|
|
||||||
"""
|
# """
|
||||||
`arcdiagram(source, destiny, weight[, grad])`
|
# `arcdiagram(source, destiny, weight[, grad])`
|
||||||
|
|
||||||
Plots an arc diagram, form `source` to `destiny` (clockwise), using `weight` to determine the colors.
|
# Plots an arc diagram, form `source` to `destiny` (clockwise), using `weight` to determine the colors.
|
||||||
"""
|
# """
|
||||||
function arcdiagram(source, destiny, weight; kargs...)
|
# function arcdiagram(source, destiny, weight; kargs...)
|
||||||
|
|
||||||
args = KW(kargs)
|
# args = KW(kargs)
|
||||||
grad = pop!(args, :grad, ColorGradient([colorant"darkred", colorant"darkblue"]))
|
# grad = pop!(args, :grad, ColorGradient([colorant"darkred", colorant"darkblue"]))
|
||||||
|
|
||||||
if length(source) == length(destiny) == length(weight)
|
# if length(source) == length(destiny) == length(weight)
|
||||||
|
|
||||||
vertices = unique(vcat(source, destiny))
|
# vertices = unique(vcat(source, destiny))
|
||||||
sort!(vertices)
|
# sort!(vertices)
|
||||||
|
|
||||||
xmin, xmax = extrema(vertices)
|
# xmin, xmax = extrema(vertices)
|
||||||
plot(xlim=(xmin - 0.5, xmax + 0.5), legend=false)
|
# plot(xlim=(xmin - 0.5, xmax + 0.5), legend=false)
|
||||||
|
|
||||||
wmin,wmax = extrema(weight)
|
# wmin,wmax = extrema(weight)
|
||||||
|
|
||||||
for (i, j, value) in zip(source,destiny,weight)
|
# for (i, j, value) in zip(source,destiny,weight)
|
||||||
arc!(i, j, value, wmin, wmax, grad)
|
# arc!(i, j, value, wmin, wmax, grad)
|
||||||
end
|
# end
|
||||||
|
|
||||||
scatter!(vertices, zeros(length(vertices)); legend=false, args...)
|
# scatter!(vertices, zeros(length(vertices)); legend=false, args...)
|
||||||
|
|
||||||
else
|
# else
|
||||||
|
|
||||||
throw(ArgumentError("source, destiny and weight should have the same length"))
|
# throw(ArgumentError("source, destiny and weight should have the same length"))
|
||||||
|
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
"""
|
# """
|
||||||
`arcdiagram(mat[, grad])`
|
# `arcdiagram(mat[, grad])`
|
||||||
|
|
||||||
Plots an arc diagram from an adjacency matrix, form rows to columns (clockwise),
|
# Plots an arc diagram from an adjacency matrix, form rows to columns (clockwise),
|
||||||
using the values on the matrix as weights to determine the colors.
|
# using the values on the matrix as weights to determine the colors.
|
||||||
Doesn't show edges with value zero if the input is sparse.
|
# Doesn't show edges with value zero if the input is sparse.
|
||||||
For simmetric matrices, only the upper triangular values are used.
|
# For simmetric matrices, only the upper triangular values are used.
|
||||||
"""
|
# """
|
||||||
arcdiagram{T}(mat::AbstractArray{T,2}; kargs...) = arcdiagram(mat2list(mat)...; kargs...)
|
# arcdiagram{T}(mat::AbstractArray{T,2}; kargs...) = arcdiagram(mat2list(mat)...; kargs...)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Chord diagram
|
# Chord diagram
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user