winston annotations
This commit is contained in:
parent
228ce768e0
commit
3334c4a87a
File diff suppressed because one or more lines are too long
30
examples/ticks_and_limits.ipynb
Normal file
30
examples/ticks_and_limits.ipynb
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"using Plots; gadfly!()"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Julia 0.4.0-rc1",
|
||||||
|
"language": "julia",
|
||||||
|
"name": "julia-0.4"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"file_extension": ".jl",
|
||||||
|
"mimetype": "application/julia",
|
||||||
|
"name": "julia",
|
||||||
|
"version": "0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 0
|
||||||
|
}
|
||||||
@ -8,7 +8,7 @@ gadfly!() = plotter!(:gadfly)
|
|||||||
|
|
||||||
|
|
||||||
supportedArgs(::GadflyPackage) = setdiff(_allArgs, [:heatmap_c, :pos, :screen, :yrightlabel])
|
supportedArgs(::GadflyPackage) = setdiff(_allArgs, [:heatmap_c, :pos, :screen, :yrightlabel])
|
||||||
supportedAxes(::GadflyPackage) = setdiff(_allAxes, [:right])
|
supportedAxes(::GadflyPackage) = [:auto, :left]
|
||||||
supportedTypes(::GadflyPackage) = [:none, :line, :path, :steppost, :sticks, :scatter, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :ohlc]
|
supportedTypes(::GadflyPackage) = [:none, :line, :path, :steppost, :sticks, :scatter, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :ohlc]
|
||||||
supportedStyles(::GadflyPackage) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supportedStyles(::GadflyPackage) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::GadflyPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon, :octagon]
|
supportedMarkers(::GadflyPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon, :octagon]
|
||||||
@ -227,14 +227,17 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
nothing
|
nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function replaceType(vec, val)
|
||||||
|
filter!(x -> !isa(x, typeof(val)), vec)
|
||||||
|
push!(vec, val)
|
||||||
|
end
|
||||||
|
|
||||||
function addTicksGuide(gplt, ticks, isx::Bool)
|
function addTicksGuide(gplt, ticks, isx::Bool)
|
||||||
ticks == :auto && return
|
ticks == :auto && return
|
||||||
ttype = ticksType(ticks)
|
ttype = ticksType(ticks)
|
||||||
if ttype == :ticks
|
if ttype == :ticks
|
||||||
gtype = isx ? Gadfly.Guide.xticks : Gadfly.Guide.yticks
|
gtype = isx ? Gadfly.Guide.xticks : Gadfly.Guide.yticks
|
||||||
filter!(x -> !isa(x, gtype), gplt.guides)
|
replaceType(gplt.guides, gtype(ticks = collect(ticks)))
|
||||||
push!(gplt.guides, gtype(ticks = sort(collect(ticks))))
|
|
||||||
else
|
else
|
||||||
error("Invalid input for $(isx ? "xticks" : "yticks"): ", ticks)
|
error("Invalid input for $(isx ? "xticks" : "yticks"): ", ticks)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -37,6 +37,11 @@ supportedStyles(::WinstonPackage) = intersect(_allStyles, collect(keys(winston_l
|
|||||||
supportedMarkers(::WinstonPackage) = intersect(_allMarkers, collect(keys(winston_marker)))
|
supportedMarkers(::WinstonPackage) = intersect(_allMarkers, collect(keys(winston_marker)))
|
||||||
subplotSupported(::WinstonPackage) = false
|
subplotSupported(::WinstonPackage) = false
|
||||||
|
|
||||||
|
|
||||||
|
function preparePlotUpdate(plt::Plot{WinstonPackage})
|
||||||
|
Winston.ghf(plt.o)
|
||||||
|
end
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -183,13 +188,15 @@ end
|
|||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
# function savepng(::WinstonPackage, plt::PlottingObject, fn::AbstractString; kw...)
|
function createWinstonAnnotationObject(plt::Plot{WinstonPackage}, x, y, val::AbstractString)
|
||||||
# f = open(fn, "w")
|
Winston.text(x, y, val)
|
||||||
# window, canvas, wplt = getWinstonItems(plt)
|
end
|
||||||
# addWinstonLegend(plt, wplt)
|
|
||||||
# writemime(f, "image/png", wplt)
|
function addAnnotations{X,Y,V}(plt::Plot{WinstonPackage}, anns::AVec{Tuple{X,Y,V}})
|
||||||
# close(f)
|
for ann in anns
|
||||||
# end
|
createWinstonAnnotationObject(plt, ann...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
@ -201,8 +208,10 @@ end
|
|||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
function addWinstonLegend(plt::Plot, wplt)
|
function addWinstonLegend(plt::Plot, wplt)
|
||||||
|
if plt.initargs[:legend]
|
||||||
Winston.legend(wplt, [sd[:label] for sd in plt.seriesargs])
|
Winston.legend(wplt, [sd[:label] for sd in plt.seriesargs])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{WinstonPackage})
|
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{WinstonPackage})
|
||||||
window, canvas, wplt = getWinstonItems(plt)
|
window, canvas, wplt = getWinstonItems(plt)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user