Compare commits
151 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b1835a91af | |||
| 0a8d88a4fe | |||
| e2adcbb486 | |||
| aee13d295c | |||
| 6677e0e0a0 | |||
| 9d64914e62 | |||
| d136977fc4 | |||
| 7fb995094e | |||
| f002f66890 | |||
| 9de3ed8cf0 | |||
| 7ff843ec1a | |||
| b181788dc2 | |||
| 81302c1e9d | |||
| 77fbf3eb51 | |||
| 837c0c06ed | |||
| 93e7bc2a2e | |||
| 702ab3c504 | |||
| b9dea42be6 | |||
| ae608d4d78 | |||
| 5e8c88d657 | |||
| 9bbe0f9414 | |||
| f290748c72 | |||
| 96821f6303 | |||
| d290c6702a | |||
| 2877cb7160 | |||
| 14fd3c94b5 | |||
| f615a5d05e | |||
| 04a4357684 | |||
| a4c25321d8 | |||
| 068282af55 | |||
| 24078661c9 | |||
| 54670d4259 | |||
| bc276acb96 | |||
| 9e8869acf1 | |||
| c39f5e1483 | |||
| f41a09b68e | |||
| 4416fc919e | |||
| 5ed913ba5e | |||
| f4329a9483 | |||
| 24a4c31f0d | |||
| 2b1c4685d2 | |||
| 980a92c625 | |||
| 54923c082c | |||
| 7ce783705a | |||
| e23cf3377e | |||
| bed9beafdc | |||
| fe1b759787 | |||
| 755a70bf77 | |||
| c58de34e63 | |||
| c798fe6822 | |||
| 5f4dfdd5d2 | |||
| 1f7043e02a | |||
| c651be7a12 | |||
| 0cc15102fb | |||
| 22aaefd1a0 | |||
| 8638626ff5 | |||
| 24fa5c8cbe | |||
| 90d054c2ec | |||
| 555145a650 | |||
| ec17d557a7 | |||
| 792df32e69 | |||
| adc96917fc | |||
| 9b0e35b4b1 | |||
| 9d652c8fe2 | |||
| 1be5794e05 | |||
| 0e561e1cd6 | |||
| 4475c38140 | |||
| cf02408620 | |||
| 87ab1d9ca4 | |||
| 9c317b8c3f | |||
| ea18b11475 | |||
| 17afa11723 | |||
| fc660e3486 | |||
| dbc12bb9ba | |||
| 2c1f58e773 | |||
| 2bde412fa3 | |||
| 03a9fc3419 | |||
| 2ca7324a45 | |||
| cf381880a5 | |||
| 12230f1fc9 | |||
| 6145214734 | |||
| 412801821f | |||
| c65c7ae252 | |||
| c3511005c7 | |||
| 31ea149820 | |||
| a0aa702725 | |||
| ac1e82075c | |||
| 65649ade14 | |||
| 34135f8e6b | |||
| 31c8a04856 | |||
| 234f9b202e | |||
| 4035c0bbe0 | |||
| 03a228fbe7 | |||
| 6e3de26477 | |||
| d892c57596 | |||
| 576ed7b7b3 | |||
| 966dede6e8 | |||
| af32590314 | |||
| 475eb8f263 | |||
| 8a40ac8991 | |||
| 3335bf21fa | |||
| 011f51fbd9 | |||
| 333714911c | |||
| f165423527 | |||
| 428fbb9cb9 | |||
| 342f9c60b2 | |||
| e13070cd6d | |||
| 76bb6bab96 | |||
| ff7b147888 | |||
| 55a598b796 | |||
| f63eac9a73 | |||
| 8d7c4cd108 | |||
| 99f608defb | |||
| 34596ada49 | |||
| 60c8f6f578 | |||
| 959da6c5ae | |||
| 5c127f945f | |||
| 74ec733444 | |||
| f560884436 | |||
| f68f82e3f4 | |||
| 56bd8006bc | |||
| ca062c3ce2 | |||
| 90aba32ca5 | |||
| e164a8274a | |||
| 23b25d4954 | |||
| bc7c8993c0 | |||
| 9db7de8373 | |||
| f8fddb49e2 | |||
| 991b2e7ca5 | |||
| 54cd96e5e0 | |||
| 599f91860a | |||
| d59564999c | |||
| 5a87adaa7f | |||
| 4e6150fe1e | |||
| 553125713d | |||
| 5583d9f315 | |||
| 20df4967a4 | |||
| 6a30435071 | |||
| 5776ff1fdf | |||
| bbb00816f1 | |||
| 3b1c409fd7 | |||
| ee68798de3 | |||
| 3ae8dc9bd7 | |||
| e9dca92c11 | |||
| 98cce223e9 | |||
| 1d7a470f78 | |||
| 461d5efc4b | |||
| 705dbf60fa | |||
| bb180ad59a | |||
| 463e1bcb90 | |||
| 22ac2df595 |
+1
-1
@@ -4,7 +4,7 @@ os:
|
||||
- linux
|
||||
- osx
|
||||
julia:
|
||||
- release
|
||||
- 0.5
|
||||
- nightly
|
||||
matrix:
|
||||
allow_failures:
|
||||
|
||||
@@ -3,11 +3,138 @@
|
||||
|
||||
#### notes on release changes, ongoing development, and future planned work
|
||||
|
||||
- All new development should target 0.7!
|
||||
- All new development should target 0.9!
|
||||
- Minor version 0.8 is the last one to support Julia 0.4!!
|
||||
- Critical bugfixes only
|
||||
- `backports` branch is for Julia 0.4
|
||||
|
||||
---
|
||||
|
||||
## 0.8 (current master/dev)
|
||||
## 0.9 (current master/dev)
|
||||
|
||||
#### 0.9.5
|
||||
|
||||
- added dependency on PlotThemes
|
||||
- set_theme --> theme
|
||||
- remove Compat from REQUIRE
|
||||
- warning for DataFrames without StatPlots
|
||||
- closeall exported and implemented for gr/pyplot
|
||||
- fix DateTime recipe
|
||||
- reset theme with theme(:none)
|
||||
- fix link_axes! for nested subplots
|
||||
- fix plotly lims for log scale
|
||||
|
||||
#### 0.9.4
|
||||
|
||||
- optimizations surrounding Subplot.series_list
|
||||
- better Atom support, support plotlyjs
|
||||
- gr:
|
||||
- gks_wstype defaults and gr_set_output
|
||||
- heatmap uses GR.drawimage
|
||||
- histogram2d puts NaN for zeros
|
||||
- improved support of NaN in heatmaps
|
||||
- rebuilt spy recipes to output scatters with marker_z set
|
||||
- deprecate png support in plotly... point to plotlyjs
|
||||
- fixes:
|
||||
- axis widen with lims set
|
||||
- reset_extrema, setxyz
|
||||
- bar plot widen
|
||||
- better tick padding
|
||||
- consistent tick rotation
|
||||
- consistent aspect_ratio
|
||||
- pyplot dpi
|
||||
- plotly horizontal bars
|
||||
- handle series attributes when combining subplots
|
||||
- gr images transposed
|
||||
- converted Date/DateTime to new type recipe approach for arrays
|
||||
- issues closed include: #505 #513 #479 #523 #526 #529
|
||||
|
||||
#### 0.9.3
|
||||
|
||||
- support pdf and eps in plotlyjs backend
|
||||
- allow curly after grid: `@layout [a b; grid(4,4){0.8h}]`
|
||||
- add_backend redesign
|
||||
|
||||
#### 0.9.2
|
||||
|
||||
- glvisualize backend (@SimonDanisch)
|
||||
- too much to list! ready for alpha testing
|
||||
- Volume and volume seriestype
|
||||
- Atom: support for PlotPane and proper gui display
|
||||
- gr:
|
||||
- clims
|
||||
- aspect ratio
|
||||
- pgfplots:
|
||||
- fixes for ticks, axes, and more
|
||||
- pyplot:
|
||||
- font families
|
||||
- colorbar guide
|
||||
- pixel marker
|
||||
- unicodeplots
|
||||
- basic support for shapes
|
||||
- improved add_backend
|
||||
- refactor of is_supported methods
|
||||
- element-wise type recipes (see https://github.com/tbreloff/Plots.jl/issues/460#issuecomment-248428908)
|
||||
- several other fixes/improvements
|
||||
|
||||
#### 0.9.1
|
||||
|
||||
- Pkg.dir --> dirname (@tkelman)
|
||||
- `axis = nothing` magic
|
||||
- fixes:
|
||||
- clim for line_z
|
||||
- sticks default range for log scale
|
||||
- rotate method
|
||||
- pyplot heatmap
|
||||
- spurious scale warnings
|
||||
- gr image/alpha
|
||||
- plotly.js path
|
||||
- orientation extrema
|
||||
- bar, reset orientation
|
||||
- switch transpose_z to use permutedims
|
||||
- skinny x/+ markers
|
||||
- ticks in pgfplots
|
||||
- eps in savefig (@anriseth)
|
||||
- add_backend convenience
|
||||
- type recipes for Date/DateTime (@maximsch2)
|
||||
- mirror attribute and twinx convenience
|
||||
- Axis.sp --> Axis.sps
|
||||
- recipe postprocessing for allowing aliases and magic args in recipe bodies
|
||||
|
||||
|
||||
|
||||
#### 0.9.0
|
||||
|
||||
- fixes to cycle
|
||||
- add back single function recipe: `plot!(cos)`
|
||||
- new axis formatter attribute... accepts functions to convert numbers to strings
|
||||
- fix for inset plots
|
||||
- GR:
|
||||
- fillrange fix
|
||||
- annotations fix
|
||||
- force double buffering in display
|
||||
|
||||
---
|
||||
|
||||
## 0.8
|
||||
|
||||
#### 0.8.2 (backported bug fixes for julia 0.4)
|
||||
|
||||
- plotly ticks fix
|
||||
- unicodeplots size fix
|
||||
- remove mkdir call in tests
|
||||
|
||||
#### 0.8.1
|
||||
|
||||
- manual drawing of axes/ticks/labels
|
||||
- get_ticks uses optimize_ticks and Showoff
|
||||
- changed PLOTS_DEFAULTS to be a global variable, not ENV key
|
||||
- parameterized Segments for pushing tuples
|
||||
- fix to axis extrema for Bool/nothing
|
||||
- GR:
|
||||
- manually draw 2D axes... fixes several issues and missing features
|
||||
- fontsize fix
|
||||
- PGFPlots: pass axis syle
|
||||
|
||||
#### 0.8.0
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
julia 0.4
|
||||
julia 0.5
|
||||
|
||||
RecipesBase
|
||||
PlotUtils
|
||||
PlotThemes
|
||||
Reexport
|
||||
Compat
|
||||
FixedSizeArrays
|
||||
Measures
|
||||
Showoff
|
||||
|
||||
+11
-8
@@ -1,11 +1,9 @@
|
||||
environment:
|
||||
matrix:
|
||||
# Releases
|
||||
- JULIAVERSION: "stable/win32"
|
||||
- JULIAVERSION: "stable/win64"
|
||||
# Nightlies
|
||||
- JULIAVERSION: "download/win32"
|
||||
- JULIAVERSION: "download/win64"
|
||||
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
|
||||
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
|
||||
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
|
||||
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
|
||||
|
||||
notifications:
|
||||
- provider: Email
|
||||
@@ -14,8 +12,13 @@ notifications:
|
||||
on_build_status_changed: false
|
||||
|
||||
install:
|
||||
# If there's a newer build queued for the same PR, cancel this one
|
||||
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
|
||||
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
|
||||
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
|
||||
throw "There are newer queued builds for this pull request, failing early." }
|
||||
# Download most recent Julia Windows binary
|
||||
- ps: (new-object net.webclient).DownloadFile($("http://status.julialang.org/"+$env:JULIAVERSION), "C:\projects\julia-binary.exe")
|
||||
- ps: (new-object net.webclient).DownloadFile($("http://s3.amazonaws.com/"+$env:JULIAVERSION), "C:\projects\julia-binary.exe")
|
||||
# Run installer silently, output to C:\projects\julia
|
||||
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
|
||||
|
||||
@@ -26,4 +29,4 @@ build_script:
|
||||
|
||||
test_script:
|
||||
# - C:\projects\julia\bin\julia -e "Pkg.test(\"Plots\")"
|
||||
- C:\projects\julia\bin\julia -e "include(Pkg.dir(\"Plots\", \"test\", \"travis_commands.jl\"))"
|
||||
- C:\projects\julia\bin\julia -e "include(Pkg.dir(\"Plots\", \"test\", \"travis_commands.jl\"))"
|
||||
|
||||
+13
-24
@@ -3,14 +3,12 @@ __precompile__()
|
||||
|
||||
module Plots
|
||||
|
||||
using Compat
|
||||
using Reexport
|
||||
# @reexport using Colors
|
||||
# using Requires
|
||||
using FixedSizeArrays
|
||||
@reexport using RecipesBase
|
||||
using Base.Meta
|
||||
@reexport using PlotUtils
|
||||
@reexport using PlotThemes
|
||||
import Showoff
|
||||
|
||||
export
|
||||
@@ -29,15 +27,16 @@ export
|
||||
KW,
|
||||
|
||||
wrap,
|
||||
set_theme,
|
||||
add_theme,
|
||||
theme,
|
||||
|
||||
plot,
|
||||
plot!,
|
||||
update!,
|
||||
|
||||
current,
|
||||
default,
|
||||
with,
|
||||
twinx,
|
||||
|
||||
@userplot,
|
||||
@shorthands,
|
||||
@@ -61,15 +60,21 @@ export
|
||||
xaxis!,
|
||||
yaxis!,
|
||||
|
||||
xlims,
|
||||
ylims,
|
||||
zlims,
|
||||
|
||||
savefig,
|
||||
png,
|
||||
gui,
|
||||
closeall,
|
||||
|
||||
backend,
|
||||
backends,
|
||||
backend_name,
|
||||
backend_object,
|
||||
add_backend,
|
||||
aliases,
|
||||
dataframes,
|
||||
|
||||
Shape,
|
||||
text,
|
||||
@@ -81,14 +86,7 @@ export
|
||||
OHLC,
|
||||
arrow,
|
||||
Segments,
|
||||
|
||||
debugplots,
|
||||
|
||||
supported_args,
|
||||
supported_types,
|
||||
supported_styles,
|
||||
supported_markers,
|
||||
is_subplot_supported,
|
||||
Formatted,
|
||||
|
||||
Animation,
|
||||
frame,
|
||||
@@ -96,8 +94,6 @@ export
|
||||
@animate,
|
||||
@gif,
|
||||
|
||||
spy,
|
||||
|
||||
test_examples,
|
||||
iter_segments,
|
||||
coords,
|
||||
@@ -126,8 +122,8 @@ include("types.jl")
|
||||
include("utils.jl")
|
||||
include("components.jl")
|
||||
include("axes.jl")
|
||||
include("backends.jl")
|
||||
include("args.jl")
|
||||
include("backends.jl")
|
||||
include("themes.jl")
|
||||
include("plot.jl")
|
||||
include("pipeline.jl")
|
||||
@@ -246,11 +242,4 @@ end
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
# if VERSION >= v"0.4.0-dev+5512"
|
||||
# include("precompile.jl")
|
||||
# _precompile_()
|
||||
# end
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
end # module
|
||||
|
||||
+9
-9
@@ -1,12 +1,12 @@
|
||||
|
||||
immutable Animation
|
||||
dir::Compat.ASCIIString
|
||||
frames::Vector{Compat.ASCIIString}
|
||||
dir::String
|
||||
frames::Vector{String}
|
||||
end
|
||||
|
||||
function Animation()
|
||||
tmpdir = convert(Compat.ASCIIString, mktempdir())
|
||||
Animation(tmpdir, Compat.ASCIIString[])
|
||||
tmpdir = convert(String, mktempdir())
|
||||
Animation(tmpdir, String[])
|
||||
end
|
||||
|
||||
function frame{P<:AbstractPlot}(anim::Animation, plt::P=current())
|
||||
@@ -21,10 +21,10 @@ end
|
||||
|
||||
"Wraps the location of an animated gif so that it can be displayed"
|
||||
immutable AnimatedGif
|
||||
filename::Compat.ASCIIString
|
||||
filename::String
|
||||
end
|
||||
|
||||
function gif(anim::Animation, fn = (isijulia() ? "tmp.gif" : tempname()*".gif"); fps::Integer = 20)
|
||||
function gif(anim::Animation, fn = (isijulia() ? "tmp.gif" : tempname()*".gif"); fps::Integer = 20, loop::Integer = 0)
|
||||
fn = abspath(fn)
|
||||
|
||||
try
|
||||
@@ -36,7 +36,7 @@ function gif(anim::Animation, fn = (isijulia() ? "tmp.gif" : tempname()*".gif");
|
||||
include(file)
|
||||
end
|
||||
# prefix = get(ENV, "MAGICK_CONFIGURE_PATH", "")
|
||||
run(`convert -delay $speed -loop 0 $(joinpath(anim.dir, "*.png")) -alpha off $fn`)
|
||||
run(`convert -delay $speed -loop $loop $(joinpath(anim.dir, "*.png")) -alpha off $fn`)
|
||||
|
||||
catch err
|
||||
warn("""Tried to create gif using convert (ImageMagick), but got error: $err
|
||||
@@ -44,7 +44,7 @@ function gif(anim::Animation, fn = (isijulia() ? "tmp.gif" : tempname()*".gif");
|
||||
Will try ffmpeg, but it's lower quality...)""")
|
||||
|
||||
# low quality
|
||||
run(`ffmpeg -v 0 -framerate $fps -i $(anim.dir)/%06d.png -y $fn`)
|
||||
run(`ffmpeg -v 0 -framerate $fps -loop $loop -i $(anim.dir)/%06d.png -y $fn`)
|
||||
# run(`ffmpeg -v warning -i "fps=$fps,scale=320:-1:flags=lanczos"`)
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ end
|
||||
|
||||
|
||||
# write out html to view the gif... note the rand call which is a hack so the image doesn't get cached
|
||||
function Base.writemime(io::IO, ::MIME"text/html", agif::AnimatedGif)
|
||||
function Base.show(io::IO, ::MIME"text/html", agif::AnimatedGif)
|
||||
write(io, "<img src=\"$(relpath(agif.filename))?$(rand())>\" />")
|
||||
end
|
||||
|
||||
|
||||
+4
-1
@@ -85,13 +85,14 @@ const _arg_desc = KW(
|
||||
:grid => "Bool. Show the grid lines?",
|
||||
:annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String or PlotText (created with `text(args...)`) Add one-off text annotations at the x,y coordinates.",
|
||||
:projection => "Symbol or String. '3d' or 'polar'",
|
||||
:aspect_ratio => "Symbol (:equal) or Number (width to height ratio of plot area).",
|
||||
:aspect_ratio => "Symbol (:equal) or Number. Plot area is resized so that 1 y-unit is the same size as `apect_ratio` x-units.",
|
||||
:margin => "Measure (multiply by `mm`, `px`, etc). Base for individual margins... not directly used. Specifies the extra padding around subplots.",
|
||||
:left_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding to the left of the subplot.",
|
||||
:top_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the top of the subplot.",
|
||||
:right_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding to the right of the subplot.",
|
||||
:bottom_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the bottom of the subplot.",
|
||||
:subplot_index => "Integer. Internal (not set by user). Specifies the index of this subplot in the Plot's `plt.subplot` list.",
|
||||
:colorbar_title => "String. Title of colorbar.",
|
||||
|
||||
# axis args
|
||||
:guide => "String. Axis guide (label).",
|
||||
@@ -100,11 +101,13 @@ const _arg_desc = KW(
|
||||
:scale => "Symbol. Scale of the axis: `:none`, `:ln`, `:log2`, `:log10`",
|
||||
:rotation => "Number. Degrees rotation of tick labels.",
|
||||
:flip => "Bool. Should we flip (reverse) the axis?",
|
||||
:formatter => "Function, :scientific, or :auto. A method which converts a number to a string for tick labeling.",
|
||||
:tickfont => "Font. Font of axis tick labels.",
|
||||
:guidefont => "Font. Font of axis guide (label).",
|
||||
:foreground_color_axis => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of axis ticks.",
|
||||
:foreground_color_border => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of plot area border (spines).",
|
||||
:foreground_color_text => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of tick labels.",
|
||||
:foreground_color_guide => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of axis guides (axis labels).",
|
||||
:mirror => "Bool. Switch the side of the tick labels (right or top).",
|
||||
|
||||
)
|
||||
|
||||
+133
-64
@@ -31,7 +31,7 @@ const _axesAliases = Dict{Symbol,Symbol}(
|
||||
)
|
||||
|
||||
const _3dTypes = [
|
||||
:path3d, :scatter3d, :surface, :wireframe, :contour3d
|
||||
:path3d, :scatter3d, :surface, :wireframe, :contour3d, :volume
|
||||
]
|
||||
const _allTypes = vcat([
|
||||
:none, :line, :path, :steppre, :steppost, :sticks, :scatter,
|
||||
@@ -39,7 +39,7 @@ const _allTypes = vcat([
|
||||
:contour, :pie, :shape, :image
|
||||
], _3dTypes)
|
||||
|
||||
@compat const _typeAliases = Dict{Symbol,Symbol}(
|
||||
const _typeAliases = Dict{Symbol,Symbol}(
|
||||
:n => :none,
|
||||
:no => :none,
|
||||
:l => :line,
|
||||
@@ -92,7 +92,7 @@ ispolar(series::Series) = ispolar(series.d[:subplot])
|
||||
# ------------------------------------------------------------
|
||||
|
||||
const _allStyles = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||
@compat const _styleAliases = Dict{Symbol,Symbol}(
|
||||
const _styleAliases = Dict{Symbol,Symbol}(
|
||||
:a => :auto,
|
||||
:s => :solid,
|
||||
:d => :dash,
|
||||
@@ -101,7 +101,7 @@ const _allStyles = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||
)
|
||||
|
||||
const _allMarkers = vcat(:none, :auto, _shape_keys) #sort(collect(keys(_shapes))))
|
||||
@compat const _markerAliases = Dict{Symbol,Symbol}(
|
||||
const _markerAliases = Dict{Symbol,Symbol}(
|
||||
:n => :none,
|
||||
:no => :none,
|
||||
:a => :auto,
|
||||
@@ -123,9 +123,9 @@ const _allMarkers = vcat(:none, :auto, _shape_keys) #sort(collect(keys(_shapes))
|
||||
:dtri => :dtriangle,
|
||||
:downtri => :dtriangle,
|
||||
:downtriangle => :dtriangle,
|
||||
:+ => :cross,
|
||||
# :+ => :cross,
|
||||
:plus => :cross,
|
||||
:x => :xcross,
|
||||
# :x => :xcross,
|
||||
:X => :xcross,
|
||||
:star => :star5,
|
||||
:s => :star5,
|
||||
@@ -143,7 +143,7 @@ const _allMarkers = vcat(:none, :auto, _shape_keys) #sort(collect(keys(_shapes))
|
||||
)
|
||||
|
||||
const _allScales = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
|
||||
@compat const _scaleAliases = Dict{Symbol,Symbol}(
|
||||
const _scaleAliases = Dict{Symbol,Symbol}(
|
||||
:none => :identity,
|
||||
:log => :log10,
|
||||
)
|
||||
@@ -165,7 +165,7 @@ const _series_defaults = KW(
|
||||
:markershape => :none,
|
||||
:markercolor => :match,
|
||||
:markeralpha => nothing,
|
||||
:markersize => 6,
|
||||
:markersize => 4,
|
||||
:markerstrokestyle => :solid,
|
||||
:markerstrokewidth => 1,
|
||||
:markerstrokecolor => :match,
|
||||
@@ -248,6 +248,7 @@ const _subplot_defaults = KW(
|
||||
:right_margin => :match,
|
||||
:bottom_margin => :match,
|
||||
:subplot_index => -1,
|
||||
:colorbar_title => "",
|
||||
)
|
||||
|
||||
const _axis_defaults = KW(
|
||||
@@ -265,6 +266,8 @@ const _axis_defaults = KW(
|
||||
:foreground_color_text => :match, # tick text color,
|
||||
:foreground_color_guide => :match, # guide text color,
|
||||
:discrete_values => [],
|
||||
:formatter => :auto,
|
||||
:mirror => false,
|
||||
)
|
||||
|
||||
const _suppress_warnings = Set{Symbol}([
|
||||
@@ -284,22 +287,24 @@ const _suppress_warnings = Set{Symbol}([
|
||||
# add defaults for the letter versions
|
||||
const _axis_defaults_byletter = KW()
|
||||
for letter in (:x,:y,:z)
|
||||
for k in (
|
||||
:guide,
|
||||
:lims,
|
||||
:ticks,
|
||||
:scale,
|
||||
:rotation,
|
||||
:flip,
|
||||
:link,
|
||||
:tickfont,
|
||||
:guidefont,
|
||||
:foreground_color_axis,
|
||||
:foreground_color_border,
|
||||
:foreground_color_text,
|
||||
:foreground_color_guide,
|
||||
:discrete_values
|
||||
)
|
||||
for k in keys(_axis_defaults)
|
||||
# for k in (
|
||||
# :guide,
|
||||
# :lims,
|
||||
# :ticks,
|
||||
# :scale,
|
||||
# :rotation,
|
||||
# :flip,
|
||||
# :link,
|
||||
# :tickfont,
|
||||
# :guidefont,
|
||||
# :foreground_color_axis,
|
||||
# :foreground_color_border,
|
||||
# :foreground_color_text,
|
||||
# :foreground_color_guide,
|
||||
# :discrete_values,
|
||||
# :formatter,
|
||||
# )
|
||||
_axis_defaults_byletter[Symbol(letter,k)] = :match
|
||||
|
||||
# allow the underscore version too: xguide or x_guide
|
||||
@@ -315,10 +320,8 @@ const _all_defaults = KW[
|
||||
]
|
||||
|
||||
const _all_args = sort(collect(union(map(keys, _all_defaults)...)))
|
||||
supported_args(::AbstractBackend) = error("supported_args not defined") #_all_args
|
||||
supported_args() = supported_args(backend())
|
||||
|
||||
RecipesBase.is_key_supported(k::Symbol) = (k in supported_args())
|
||||
RecipesBase.is_key_supported(k::Symbol) = is_attr_supported(k)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -349,13 +352,16 @@ end
|
||||
add_aliases(:seriescolor, :c, :color, :colour)
|
||||
add_aliases(:linecolor, :lc, :lcolor, :lcolour, :linecolour)
|
||||
add_aliases(:markercolor, :mc, :mcolor, :mcolour, :markercolour)
|
||||
add_aliases(:markerstokecolor, :msc, :mscolor, :mscolour, :markerstokecolour)
|
||||
add_aliases(:markerstrokecolor, :msc, :mscolor, :mscolour, :markerstrokecolour)
|
||||
add_aliases(:markerstrokewidth, :msw, :mswidth)
|
||||
add_aliases(:fillcolor, :fc, :fcolor, :fcolour, :fillcolour)
|
||||
|
||||
add_aliases(:background_color, :bg, :bgcolor, :bg_color, :background,
|
||||
:background_colour, :bgcolour, :bg_colour)
|
||||
add_aliases(:background_color_legend, :bg_legend, :bglegend, :bgcolor_legend, :bg_color_legend, :background_legend,
|
||||
:background_colour_legend, :bgcolour_legend, :bg_colour_legend)
|
||||
add_aliases(:background_color_subplot, :bg_subplot, :bgsubplot, :bgcolor_subplot, :bg_color_subplot, :background_subplot,
|
||||
:background_colour_subplot, :bgcolour_subplot, :bg_colour_subplot)
|
||||
add_aliases(:background_color_inside, :bg_inside, :bginside, :bgcolor_inside, :bg_color_inside, :background_inside,
|
||||
:background_colour_inside, :bgcolour_inside, :bg_colour_inside)
|
||||
add_aliases(:background_color_outside, :bg_outside, :bgoutside, :bgcolor_outside, :bg_color_outside, :background_outside,
|
||||
@@ -364,6 +370,8 @@ add_aliases(:foreground_color, :fg, :fgcolor, :fg_color, :foreground,
|
||||
:foreground_colour, :fgcolour, :fg_colour)
|
||||
add_aliases(:foreground_color_legend, :fg_legend, :fglegend, :fgcolor_legend, :fg_color_legend, :foreground_legend,
|
||||
:foreground_colour_legend, :fgcolour_legend, :fg_colour_legend)
|
||||
add_aliases(:foreground_color_subplot, :fg_subplot, :fgsubplot, :fgcolor_subplot, :fg_color_subplot, :foreground_subplot,
|
||||
:foreground_colour_subplot, :fgcolour_subplot, :fg_colour_subplot)
|
||||
add_aliases(:foreground_color_grid, :fg_grid, :fggrid, :fgcolor_grid, :fg_color_grid, :foreground_grid,
|
||||
:foreground_colour_grid, :fgcolour_grid, :fg_colour_grid, :gridcolor)
|
||||
add_aliases(:foreground_color_title, :fg_title, :fgtitle, :fgcolor_title, :fg_color_title, :foreground_title,
|
||||
@@ -453,6 +461,7 @@ end
|
||||
`default(key)` returns the current default value for that key
|
||||
`default(key, value)` sets the current default value for that key
|
||||
`default(; kw...)` will set the current default value for each key/value pair
|
||||
`default(d, key)` returns the key from d if it exists, otherwise `default(key)`
|
||||
"""
|
||||
|
||||
function default(k::Symbol)
|
||||
@@ -489,6 +498,11 @@ function default(; kw...)
|
||||
end
|
||||
end
|
||||
|
||||
function default(d::KW, k::Symbol)
|
||||
get(d, k, default(k))
|
||||
end
|
||||
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -604,7 +618,7 @@ function processFillArg(d::KW, arg)
|
||||
d[:fillrange] = arg
|
||||
end
|
||||
# d[:fillrange] = fr
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
_replace_markershape(shape::Symbol) = get(_markerAliases, shape, shape)
|
||||
@@ -624,6 +638,21 @@ end
|
||||
function preprocessArgs!(d::KW)
|
||||
replaceAliases!(d, _keyAliases)
|
||||
|
||||
# clear all axis stuff
|
||||
if haskey(d, :axis) && d[:axis] in (:none, nothing, false)
|
||||
d[:ticks] = nothing
|
||||
d[:foreground_color_border] = RGBA(0,0,0,0)
|
||||
d[:grid] = false
|
||||
delete!(d, :axis)
|
||||
end
|
||||
# for letter in (:x, :y, :z)
|
||||
# asym = Symbol(letter, :axis)
|
||||
# if haskey(d, asym) || d[asym] in (:none, nothing, false)
|
||||
# d[Symbol(letter, :ticks)] = nothing
|
||||
# d[Symbol(letter, :foreground_color_border)] = RGBA(0,0,0,0)
|
||||
# end
|
||||
# end
|
||||
|
||||
# handle axis args
|
||||
for letter in (:x, :y, :z)
|
||||
asym = Symbol(letter, :axis)
|
||||
@@ -669,7 +698,7 @@ function preprocessArgs!(d::KW)
|
||||
a = d[:arrow]
|
||||
d[:arrow] = if a == true
|
||||
arrow()
|
||||
elseif a == false
|
||||
elseif a in (false, nothing, :none)
|
||||
nothing
|
||||
elseif !(typeof(a) <: Arrow)
|
||||
arrow(wraptuple(a)...)
|
||||
@@ -679,9 +708,9 @@ function preprocessArgs!(d::KW)
|
||||
end
|
||||
|
||||
|
||||
if get(d, :arrow, false) == true
|
||||
d[:arrow] = arrow()
|
||||
end
|
||||
# if get(d, :arrow, false) == true
|
||||
# d[:arrow] = arrow()
|
||||
# end
|
||||
|
||||
# legends
|
||||
if haskey(d, :legend)
|
||||
@@ -747,43 +776,51 @@ end
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
const _already_warned = Set()
|
||||
const _already_warned = Dict{Symbol,Set{Symbol}}()
|
||||
const _to_warn = Set{Symbol}()
|
||||
|
||||
function warnOnUnsupported_args(pkg::AbstractBackend, d::KW)
|
||||
for k in sortedkeys(d)
|
||||
k in supported_args(pkg) && continue
|
||||
empty!(_to_warn)
|
||||
bend = backend_name(pkg)
|
||||
already_warned = get!(_already_warned, bend, Set{Symbol}())
|
||||
for k in keys(d)
|
||||
is_attr_supported(pkg, k) && continue
|
||||
k in _suppress_warnings && continue
|
||||
if d[k] != default(k)
|
||||
if !((pkg, k) in _already_warned)
|
||||
push!(_already_warned, (pkg,k))
|
||||
warn("Keyword argument $k not supported with $pkg. Choose from: $(supported_args(pkg))")
|
||||
end
|
||||
k in already_warned || push!(_to_warn, k)
|
||||
end
|
||||
end
|
||||
|
||||
if !isempty(_to_warn)
|
||||
for k in sort(collect(_to_warn))
|
||||
push!(already_warned, k)
|
||||
warn("Keyword argument $k not supported with $pkg. Choose from: $(supported_attrs(pkg))")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_markershape_supported(pkg::AbstractBackend, shape::Symbol) = shape in supported_markers(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, shape::Symbol) = shape in supported_markers(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])
|
||||
|
||||
function warnOnUnsupported(pkg::AbstractBackend, d::KW)
|
||||
(d[:seriestype] == :none
|
||||
|| d[:seriestype] in supported_types(pkg)
|
||||
|| warn("seriestype $(d[:seriestype]) is unsupported with $pkg. Choose from: $(supported_types(pkg))"))
|
||||
(d[:linestyle] in supported_styles(pkg)
|
||||
|| warn("linestyle $(d[:linestyle]) is unsupported with $pkg. Choose from: $(supported_styles(pkg))"))
|
||||
(d[:markershape] == :none
|
||||
|| _markershape_supported(pkg, d[:markershape])
|
||||
|| warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supported_markers(pkg))"))
|
||||
if !is_seriestype_supported(pkg, d[:seriestype])
|
||||
warn("seriestype $(d[:seriestype]) is unsupported with $pkg. Choose from: $(supported_seriestypes(pkg))")
|
||||
end
|
||||
if !is_style_supported(pkg, d[:linestyle])
|
||||
warn("linestyle $(d[:linestyle]) is unsupported with $pkg. Choose from: $(supported_styles(pkg))")
|
||||
end
|
||||
if !is_marker_supported(pkg, d[:markershape])
|
||||
warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supported_markers(pkg))")
|
||||
end
|
||||
end
|
||||
|
||||
function warnOnUnsupported_scales(pkg::AbstractBackend, d::KW)
|
||||
for k in (:xscale, :yscale, :zscale, :scale)
|
||||
if haskey(d, k)
|
||||
v = d[k]
|
||||
v = get(_scaleAliases, v, v)
|
||||
if !(v in supported_scales(pkg))
|
||||
warn("scale $(d[k]) is unsupported with $pkg. Choose from: $(supported_scales(pkg))")
|
||||
if !is_scale_supported(pkg, v)
|
||||
warn("scale $v is unsupported with $pkg. Choose from: $(supported_scales(pkg))")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -922,7 +959,7 @@ function Base.getindex(axis::Axis, k::Symbol)
|
||||
v = axis.d[k]
|
||||
if v == :match
|
||||
if haskey(_match_map2, k)
|
||||
axis.sp[_match_map2[k]]
|
||||
axis.sps[1][_match_map2[k]]
|
||||
else
|
||||
axis[_match_map[k]]
|
||||
end
|
||||
@@ -948,6 +985,27 @@ Base.get(series::Series, k::Symbol, v) = get(series.d, k, v)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
function fg_color(d::KW)
|
||||
fg = default(d, :foreground_color)
|
||||
if fg == :auto
|
||||
bg = plot_color(default(d, :background_color))
|
||||
fg = isdark(bg) ? colorant"white" : colorant"black"
|
||||
else
|
||||
plot_color(fg)
|
||||
end
|
||||
end
|
||||
|
||||
function fg_color_sp(d::KW)
|
||||
fgsp = default(d, :foreground_color_subplot)
|
||||
if fg == :match
|
||||
fg_color(d)
|
||||
else
|
||||
plot_color(fgsp)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
# update attr from an input dictionary
|
||||
function _update_plot_args(plt::Plot, d_in::KW)
|
||||
for (k,v) in _plot_defaults
|
||||
@@ -955,13 +1013,16 @@ function _update_plot_args(plt::Plot, d_in::KW)
|
||||
end
|
||||
|
||||
# handle colors
|
||||
bg = plot_color(plt.attr[:background_color])
|
||||
fg = plt.attr[:foreground_color]
|
||||
if fg == :auto
|
||||
fg = isdark(bg) ? colorant"white" : colorant"black"
|
||||
end
|
||||
plt.attr[:background_color] = bg
|
||||
plt.attr[:foreground_color] = plot_color(fg)
|
||||
d = plt.attr
|
||||
plt[:background_color] = plot_color(d[:background_color])
|
||||
plt[:foreground_color] = fg_color(d)
|
||||
# bg = plot_color(plt.attr[:background_color])
|
||||
# fg = plt.attr[:foreground_color]
|
||||
# if fg == :auto
|
||||
# fg = isdark(bg) ? colorant"white" : colorant"black"
|
||||
# end
|
||||
# plt.attr[:background_color] = bg
|
||||
# plt.attr[:foreground_color] = plot_color(fg)
|
||||
color_or_nothing!(plt.attr, :background_color_outside)
|
||||
end
|
||||
|
||||
@@ -1088,6 +1149,8 @@ end
|
||||
function getSeriesRGBColor(c, α, sp::Subplot, n::Int)
|
||||
if c == :auto
|
||||
c = autopick(sp[:color_palette], n)
|
||||
elseif isa(c, Int)
|
||||
c = autopick(sp[:color_palette], c)
|
||||
end
|
||||
plot_color(c, α)
|
||||
end
|
||||
@@ -1115,7 +1178,14 @@ function _add_defaults!(d::KW, plt::Plot, sp::Subplot, commandIndex::Int)
|
||||
end
|
||||
|
||||
# this is how many series belong to this subplot
|
||||
plotIndex = count(series -> series.d[:subplot] === sp && series.d[:primary], plt.series_list)
|
||||
# plotIndex = count(series -> series.d[:subplot] === sp && series.d[:primary], plt.series_list)
|
||||
plotIndex = 0
|
||||
for series in sp.series_list
|
||||
if series[:primary]
|
||||
plotIndex += 1
|
||||
end
|
||||
end
|
||||
# plotIndex = count(series -> series[:primary], sp.series_list)
|
||||
if get(d, :primary, true)
|
||||
plotIndex += 1
|
||||
end
|
||||
@@ -1181,4 +1251,3 @@ function _add_defaults!(d::KW, plt::Plot, sp::Subplot, commandIndex::Int)
|
||||
_replace_linewidth(d)
|
||||
d
|
||||
end
|
||||
|
||||
|
||||
+70
-38
@@ -23,13 +23,13 @@ function Axis(sp::Subplot, letter::Symbol, args...; kw...)
|
||||
lk = Symbol(letter, k)
|
||||
lv = _axis_defaults_byletter[lk]
|
||||
d[k] = (lv == :match ? v : lv)
|
||||
end
|
||||
end
|
||||
|
||||
# merge!(d, _axis_defaults)
|
||||
d[:discrete_values] = []
|
||||
|
||||
# update the defaults
|
||||
update!(Axis(sp, d), args...; kw...)
|
||||
update!(Axis([sp], d), args...; kw...)
|
||||
end
|
||||
|
||||
function get_axis(sp::Subplot, letter::Symbol)
|
||||
@@ -73,6 +73,9 @@ function process_axis_arg!(d::KW, arg, letter = "")
|
||||
elseif typeof(arg) <: Number
|
||||
d[Symbol(letter,:rotation)] = arg
|
||||
|
||||
elseif typeof(arg) <: Function
|
||||
d[Symbol(letter,:formatter)] = arg
|
||||
|
||||
else
|
||||
warn("Skipped $(letter)axis arg $arg")
|
||||
|
||||
@@ -129,6 +132,12 @@ const _inv_scale_funcs = Dict{Symbol,Function}(
|
||||
:ln => exp,
|
||||
)
|
||||
|
||||
# const _label_func = Dict{Symbol,Function}(
|
||||
# :log10 => x -> "10^$x",
|
||||
# :log2 => x -> "2^$x",
|
||||
# :ln => x -> "e^$x",
|
||||
# )
|
||||
|
||||
const _label_func = Dict{Symbol,Function}(
|
||||
:log10 => x -> "10^$x",
|
||||
:log2 => x -> "2^$x",
|
||||
@@ -141,41 +150,44 @@ invscalefunc(scale::Symbol) = x -> get(_inv_scale_funcs, scale, identity)(Float6
|
||||
labelfunc(scale::Symbol, backend::AbstractBackend) = get(_label_func, scale, string)
|
||||
|
||||
function optimal_ticks_and_labels(axis::Axis, ticks = nothing)
|
||||
lims = axis_limits(axis)
|
||||
amin,amax = axis_limits(axis)
|
||||
|
||||
# scale the limits
|
||||
scale = axis[:scale]
|
||||
scaled_lims = map(scalefunc(scale), lims)
|
||||
# @show lims scaled_lims
|
||||
sf = scalefunc(scale)
|
||||
|
||||
# get a list of well-laid-out ticks
|
||||
cv = if ticks == nothing
|
||||
optimize_ticks(scaled_lims...,
|
||||
scaled_ticks = if ticks == nothing
|
||||
optimize_ticks(
|
||||
sf(amin),
|
||||
sf(amax);
|
||||
k_min = 5, # minimum number of ticks
|
||||
k_max = 8, # maximum number of ticks
|
||||
# span_buffer = 0.0 # padding buffer in case nice ticks are closeby
|
||||
)[1]
|
||||
else
|
||||
ticks
|
||||
map(sf, filter(t -> amin <= t <= amax, ticks))
|
||||
end
|
||||
unscaled_ticks = map(invscalefunc(scale), scaled_ticks)
|
||||
|
||||
# # expand to ensure we see all the ticks
|
||||
# expand_extrema!(axis, cv)
|
||||
|
||||
# rescale and return values and labels
|
||||
# @show cv
|
||||
ticklabels = if any(isfinite, cv)
|
||||
map(labelfunc(scale, backend()), Showoff.showoff(cv, :plain))
|
||||
labels = if any(isfinite, unscaled_ticks)
|
||||
formatter = axis[:formatter]
|
||||
if formatter == :auto
|
||||
# the default behavior is to make strings of the scaled values and then apply the labelfunc
|
||||
map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, :plain))
|
||||
elseif formatter == :scientific
|
||||
Showoff.showoff(unscaled_ticks, :scientific)
|
||||
else
|
||||
# there was an override for the formatter... use that on the unscaled ticks
|
||||
map(formatter, unscaled_ticks)
|
||||
end
|
||||
else
|
||||
UTF8String[]
|
||||
# no finite ticks to show...
|
||||
String[]
|
||||
end
|
||||
|
||||
tickvals = map(invscalefunc(scale), cv)
|
||||
# @show tickvals ticklabels
|
||||
# ticklabels = Showoff.showoff(tickvals, scale == :log10 ? :scientific : :auto)
|
||||
tickvals, ticklabels
|
||||
# basestr = scale == :log10 ? "10^" : scale == :log2 ? "2^" : scale == :ln ? "e^" : ""
|
||||
# tickvals, ["$basestr$cvi" for cvi in cv]
|
||||
# @show unscaled_ticks labels
|
||||
# labels = Showoff.showoff(unscaled_ticks, scale == :log10 ? :scientific : :auto)
|
||||
unscaled_ticks, labels
|
||||
end
|
||||
|
||||
# return (continuous_values, discrete_values) for the ticks on this axis
|
||||
@@ -212,6 +224,17 @@ end
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
function reset_extrema!(sp::Subplot)
|
||||
for asym in (:x,:y,:z)
|
||||
sp[Symbol(asym,:axis)][:extrema] = Extrema()
|
||||
end
|
||||
for series in sp.series_list
|
||||
expand_extrema!(sp, series.d)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function expand_extrema!(ex::Extrema, v::Number)
|
||||
ex.emin = min(v, ex.emin)
|
||||
ex.emax = max(v, ex.emax)
|
||||
@@ -243,11 +266,22 @@ end
|
||||
|
||||
|
||||
function expand_extrema!(sp::Subplot, d::KW)
|
||||
vert = isvertical(d)
|
||||
|
||||
# first expand for the data
|
||||
for letter in (:x, :y, :z)
|
||||
data = d[letter]
|
||||
axis = sp.attr[Symbol(letter, "axis")]
|
||||
if eltype(data) <: Number || (isa(data, Surface) && all(di -> isa(di, Number), data.surf))
|
||||
data = d[if vert
|
||||
letter
|
||||
else
|
||||
letter == :x ? :y : letter == :y ? :x : :z
|
||||
end]
|
||||
axis = sp[Symbol(letter, "axis")]
|
||||
|
||||
if isa(data, Volume)
|
||||
expand_extrema!(sp[:xaxis], data.x_extents)
|
||||
expand_extrema!(sp[:yaxis], data.y_extents)
|
||||
expand_extrema!(sp[:zaxis], data.z_extents)
|
||||
elseif eltype(data) <: Number || (isa(data, Surface) && all(di -> isa(di, Number), data.surf))
|
||||
if !(eltype(data) <: Number)
|
||||
# huh... must have been a mis-typed surface? lets swap it out
|
||||
data = d[letter] = Surface(Matrix{Float64}(data.surf))
|
||||
@@ -269,7 +303,6 @@ function expand_extrema!(sp::Subplot, d::KW)
|
||||
# end
|
||||
|
||||
# expand for fillrange
|
||||
vert = isvertical(d)
|
||||
fr = d[:fillrange]
|
||||
if fr == nothing && d[:seriestype] == :bar
|
||||
fr = 0.0
|
||||
@@ -294,8 +327,6 @@ function expand_extrema!(sp::Subplot, d::KW)
|
||||
if bw == nothing
|
||||
bw = d[:bar_width] = mean(diff(data))
|
||||
end
|
||||
# @show data bw
|
||||
|
||||
axis = sp.attr[Symbol(dsym, :axis)]
|
||||
expand_extrema!(axis, maximum(data) + 0.5maximum(bw))
|
||||
expand_extrema!(axis, minimum(data) - 0.5minimum(bw))
|
||||
@@ -322,10 +353,12 @@ end
|
||||
# so lazy out and don't widen
|
||||
function default_should_widen(axis::Axis)
|
||||
should_widen = false
|
||||
if axis[:scale] == :identity
|
||||
for series in series_list(axis.sp)
|
||||
if series.d[:seriestype] in (:scatter,) || series.d[:markershape] != :none
|
||||
should_widen = true
|
||||
if axis[:scale] == :identity && !is_2tuple(axis[:lims])
|
||||
for sp in axis.sps
|
||||
for series in series_list(sp)
|
||||
if series.d[:seriestype] in (:scatter,) || series.d[:markershape] != :none
|
||||
should_widen = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -440,11 +473,11 @@ function axis_drawing_info(sp::Subplot)
|
||||
t2 = invf(f(ymax) - 0.015*(f(ymax)-f(ymin)))
|
||||
|
||||
push!(spine_segs, (xmin,ymin), (xmax,ymin)) # bottom spine
|
||||
push!(spine_segs, (xmin,ymax), (xmax,ymax)) # top spine
|
||||
# push!(spine_segs, (xmin,ymax), (xmax,ymax)) # top spine
|
||||
for xtick in xticks[1]
|
||||
push!(spine_segs, (xtick, ymin), (xtick, t1)) # bottom tick
|
||||
push!(grid_segs, (xtick, t1), (xtick, t2)) # vertical grid
|
||||
push!(spine_segs, (xtick, ymax), (xtick, t2)) # top tick
|
||||
# push!(spine_segs, (xtick, ymax), (xtick, t2)) # top tick
|
||||
end
|
||||
end
|
||||
|
||||
@@ -455,14 +488,13 @@ function axis_drawing_info(sp::Subplot)
|
||||
t2 = invf(f(xmax) - 0.015*(f(xmax)-f(xmin)))
|
||||
|
||||
push!(spine_segs, (xmin,ymin), (xmin,ymax)) # left spine
|
||||
push!(spine_segs, (xmax,ymin), (xmax,ymax)) # right spine
|
||||
# push!(spine_segs, (xmax,ymin), (xmax,ymax)) # right spine
|
||||
for ytick in yticks[1]
|
||||
push!(spine_segs, (xmin, ytick), (t1, ytick)) # left tick
|
||||
push!(grid_segs, (t1, ytick), (t2, ytick)) # horizontal grid
|
||||
push!(spine_segs, (xmax, ytick), (t2, ytick)) # right tick
|
||||
# push!(spine_segs, (xmax, ytick), (t2, ytick)) # right tick
|
||||
end
|
||||
end
|
||||
|
||||
xticks, yticks, spine_segs, grid_segs
|
||||
end
|
||||
|
||||
|
||||
+82
-39
@@ -26,24 +26,18 @@ macro init_backend(s)
|
||||
end)
|
||||
end
|
||||
|
||||
@init_backend Immerse
|
||||
@init_backend Gadfly
|
||||
@init_backend PyPlot
|
||||
@init_backend Qwt
|
||||
@init_backend UnicodePlots
|
||||
@init_backend Winston
|
||||
@init_backend Bokeh
|
||||
@init_backend Plotly
|
||||
@init_backend PlotlyJS
|
||||
@init_backend GR
|
||||
@init_backend GLVisualize
|
||||
@init_backend PGFPlots
|
||||
|
||||
include("backends/web.jl")
|
||||
# include("backends/supported.jl")
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
function add_backend(pkg::Symbol)
|
||||
info("To do a standard install of $pkg, copy and run this:\n\n")
|
||||
println(add_backend_string(_backend_instance(pkg)))
|
||||
println()
|
||||
end
|
||||
add_backend_string(b::AbstractBackend) = warn("No custom install defined for $(backend_name(b))")
|
||||
|
||||
# don't do anything as a default
|
||||
_create_backend_figure(plt::Plot) = nothing
|
||||
_prepare_plot_object(plt::Plot) = nothing
|
||||
@@ -57,15 +51,26 @@ _before_layout_calcs(plt::Plot) = nothing
|
||||
title_padding(sp::Subplot) = sp[:title] == "" ? 0mm : sp[:titlefont].pointsize * pt
|
||||
guide_padding(axis::Axis) = axis[:guide] == "" ? 0mm : axis[:guidefont].pointsize * pt
|
||||
|
||||
# TODO: this should account for both tick font and the size/length/rotation of tick labels
|
||||
# account for the size/length/rotation of tick labels
|
||||
function tick_padding(axis::Axis)
|
||||
ptsz = axis[:tickfont].pointsize * pt
|
||||
if axis[:ticks] in (nothing,false)
|
||||
ticks = get_ticks(axis)
|
||||
if ticks == nothing
|
||||
0mm
|
||||
elseif axis[:letter] == :x
|
||||
2mm + ptsz
|
||||
else
|
||||
8mm
|
||||
vals, labs = ticks
|
||||
ptsz = axis[:tickfont].pointsize * pt
|
||||
|
||||
# we need to compute the size of the ticks generically
|
||||
# this means computing the bounding box and then getting the width/height
|
||||
longest_label = maximum(length(lab) for lab in labs)
|
||||
labelwidth = 0.8longest_label * ptsz
|
||||
|
||||
# generalize by "rotating" y labels
|
||||
rot = axis[:rotation] + (axis[:letter] == :y ? 90 : 0)
|
||||
|
||||
# now compute the generalized "height" after rotation as the "opposite+adjacent" of 2 triangles
|
||||
hgt = abs(sind(rot)) * labelwidth + abs(cosd(rot)) * ptsz + 1mm
|
||||
hgt
|
||||
end
|
||||
end
|
||||
|
||||
@@ -77,6 +82,15 @@ function _update_min_padding!(sp::Subplot)
|
||||
toppad = sp[:top_margin] + title_padding(sp)
|
||||
rightpad = sp[:right_margin]
|
||||
bottompad = tick_padding(sp[:xaxis]) + sp[:bottom_margin] + guide_padding(sp[:xaxis])
|
||||
|
||||
# switch them?
|
||||
if sp[:xaxis][:mirror]
|
||||
bottompad, toppad = toppad, bottompad
|
||||
end
|
||||
if sp[:yaxis][:mirror]
|
||||
leftpad, rightpad = rightpad, leftpad
|
||||
end
|
||||
|
||||
# @show (leftpad, toppad, rightpad, bottompad)
|
||||
sp.minpad = (leftpad, toppad, rightpad, bottompad)
|
||||
end
|
||||
@@ -140,14 +154,15 @@ function backend()
|
||||
sym = CURRENT_BACKEND.sym
|
||||
if !(sym in _initialized_backends)
|
||||
|
||||
# initialize
|
||||
println("[Plots.jl] Initializing backend: ", sym)
|
||||
# # initialize
|
||||
# println("[Plots.jl] Initializing backend: ", sym)
|
||||
|
||||
inst = _backend_instance(sym)
|
||||
try
|
||||
_initialize_backend(inst)
|
||||
catch err
|
||||
warn("Couldn't initialize $sym. (might need to install it?)")
|
||||
add_backend(sym)
|
||||
rethrow(err)
|
||||
end
|
||||
|
||||
@@ -164,12 +179,14 @@ function backend(pkg::AbstractBackend)
|
||||
CURRENT_BACKEND.sym = backend_name(pkg)
|
||||
warn_on_deprecated_backend(CURRENT_BACKEND.sym)
|
||||
CURRENT_BACKEND.pkg = pkg
|
||||
backend()
|
||||
end
|
||||
|
||||
function backend(modname::Symbol)
|
||||
warn_on_deprecated_backend(modname)
|
||||
CURRENT_BACKEND.sym = modname
|
||||
CURRENT_BACKEND.pkg = _backend_instance(modname)
|
||||
backend()
|
||||
end
|
||||
|
||||
const _deprecated_backends = [:qwt, :winston, :bokeh, :gadfly, :immerse]
|
||||
@@ -180,23 +197,7 @@ function warn_on_deprecated_backend(bsym::Symbol)
|
||||
end
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
supported_types(::AbstractBackend) = []
|
||||
supported_styles(::AbstractBackend) = [:solid]
|
||||
supported_markers(::AbstractBackend) = [:none]
|
||||
supported_scales(::AbstractBackend) = [:identity]
|
||||
is_subplot_supported(::AbstractBackend) = false
|
||||
is_string_supported(::AbstractBackend) = false
|
||||
nativeImagesSupported(b::AbstractBackend) = :image in supported_types(b)
|
||||
|
||||
supported_types() = supported_types(backend())
|
||||
supported_styles() = supported_styles(backend())
|
||||
supported_markers() = supported_markers(backend())
|
||||
supported_scales() = supported_scales(backend())
|
||||
is_subplot_supported() = is_subplot_supported(backend())
|
||||
is_string_supported() = is_string_supported(backend())
|
||||
nativeImagesSupported() = nativeImagesSupported(backend())
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
@@ -226,7 +227,7 @@ const _base_supported_args = [
|
||||
:subplot_index,
|
||||
:discrete_values,
|
||||
:projection,
|
||||
|
||||
|
||||
]
|
||||
|
||||
function merge_with_base_supported(v::AVec)
|
||||
@@ -238,5 +239,47 @@ function merge_with_base_supported(v::AVec)
|
||||
end
|
||||
end
|
||||
end
|
||||
v
|
||||
Set(v)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# @init_backend Immerse
|
||||
# @init_backend Gadfly
|
||||
@init_backend PyPlot
|
||||
# @init_backend Qwt
|
||||
@init_backend UnicodePlots
|
||||
# @init_backend Winston
|
||||
# @init_backend Bokeh
|
||||
@init_backend Plotly
|
||||
@init_backend PlotlyJS
|
||||
@init_backend GR
|
||||
@init_backend GLVisualize
|
||||
@init_backend PGFPlots
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
# create the various `is_xxx_supported` and `supported_xxxs` methods
|
||||
# by default they pass through to checking membership in `_gr_xxx`
|
||||
for s in (:attr, :seriestype, :marker, :style, :scale)
|
||||
f = Symbol("is_", s, "_supported")
|
||||
f2 = Symbol("supported_", s, "s")
|
||||
@eval begin
|
||||
$f(::AbstractBackend, $s) = false
|
||||
$f(bend::AbstractBackend, $s::AbstractVector) = all(v -> $f(bend, v), $s)
|
||||
$f($s) = $f(backend(), $s)
|
||||
$f2() = $f2(backend())
|
||||
end
|
||||
|
||||
for bend in backends()
|
||||
bend_type = typeof(_backend_instance(bend))
|
||||
v = Symbol("_", bend, "_", s)
|
||||
@eval begin
|
||||
$f(::$bend_type, $s::Symbol) = $s in $v
|
||||
$f2(::$bend_type) = $v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# is_subplot_supported(::AbstractBackend) = false
|
||||
# is_subplot_supported() = is_subplot_supported(backend())
|
||||
|
||||
+1205
-267
File diff suppressed because it is too large
Load Diff
+151
-60
@@ -3,7 +3,8 @@
|
||||
|
||||
# significant contributions by @jheinen
|
||||
|
||||
supported_args(::GRBackend) = merge_with_base_supported([
|
||||
|
||||
const _gr_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend, :background_color_inside, :background_color_outside,
|
||||
:foreground_color_legend, :foreground_color_grid, :foreground_color_axis,
|
||||
@@ -30,17 +31,23 @@ supported_args(::GRBackend) = merge_with_base_supported([
|
||||
:inset_subplots,
|
||||
:bar_width,
|
||||
])
|
||||
supported_types(::GRBackend) = [
|
||||
const _gr_seriestype = [
|
||||
:path, :scatter,
|
||||
:heatmap, :pie, :image,
|
||||
:contour, :path3d, :scatter3d, :surface, :wireframe,
|
||||
:shape
|
||||
]
|
||||
supported_styles(::GRBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||
supported_markers(::GRBackend) = vcat(_allMarkers, Shape)
|
||||
supported_scales(::GRBackend) = [:identity, :log10]
|
||||
is_subplot_supported(::GRBackend) = true
|
||||
const _gr_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||
const _gr_marker = _allMarkers
|
||||
const _gr_scale = [:identity, :log10]
|
||||
is_marker_supported(::GRBackend, shape::Shape) = true
|
||||
|
||||
function add_backend_string(::GRBackend)
|
||||
"""
|
||||
Pkg.add("GR")
|
||||
Pkg.build("GR")
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::GRBackend; kw...)
|
||||
@eval begin
|
||||
@@ -74,6 +81,8 @@ const gr_markertype = KW(
|
||||
:octagon => -24,
|
||||
:cross => 2,
|
||||
:xcross => 5,
|
||||
:+ => 2,
|
||||
:x => 5,
|
||||
:star4 => -25,
|
||||
:star5 => -26,
|
||||
:star6 => -27,
|
||||
@@ -197,14 +206,14 @@ function gr_polaraxes(rmin, rmax)
|
||||
GR.drawarc(-r, r, -r, r, 0, 359)
|
||||
end
|
||||
end
|
||||
for alpha in 0:45:315
|
||||
a = alpha + 90
|
||||
for α in 0:45:315
|
||||
a = α + 90
|
||||
sinf = sin(a * pi / 180)
|
||||
cosf = cos(a * pi / 180)
|
||||
GR.polyline([sinf, 0], [cosf, 0])
|
||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_HALF)
|
||||
x, y = GR.wctondc(1.1 * sinf, 1.1 * cosf)
|
||||
GR.textext(x, y, string(alpha, "^o"))
|
||||
GR.textext(x, y, string(α, "^o"))
|
||||
end
|
||||
GR.restorestate()
|
||||
end
|
||||
@@ -328,10 +337,11 @@ end
|
||||
const _gr_point_mult = zeros(1)
|
||||
|
||||
# set the font attributes... assumes _gr_point_mult has been populated already
|
||||
function gr_set_font(f::Font; halign = f.halign, valign = f.valign, color = f.color)
|
||||
function gr_set_font(f::Font; halign = f.halign, valign = f.valign,
|
||||
color = f.color, rotation = f.rotation)
|
||||
family = lowercase(f.family)
|
||||
GR.setcharheight(_gr_point_mult[1] * f.pointsize)
|
||||
GR.setcharup(sin(f.rotation), cos(f.rotation))
|
||||
GR.setcharup(sind(-rotation), cosd(-rotation))
|
||||
if haskey(gr_font_family, family)
|
||||
GR.settextfontprec(100 + gr_font_family[family], GR.TEXT_PRECISION_STRING)
|
||||
end
|
||||
@@ -339,6 +349,14 @@ function gr_set_font(f::Font; halign = f.halign, valign = f.valign, color = f.co
|
||||
GR.settextalign(gr_halign[halign], gr_valign[valign])
|
||||
end
|
||||
|
||||
function gr_nans_to_infs!(z)
|
||||
for (i,zi) in enumerate(z)
|
||||
if zi == NaN
|
||||
z[i] = Inf
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
# viewport plot area
|
||||
|
||||
@@ -463,6 +481,28 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
# the viewports for this subplot
|
||||
viewport_subplot = gr_viewport_from_bbox(bbox(sp), w, h, viewport_canvas)
|
||||
viewport_plotarea[:] = gr_viewport_from_bbox(plotarea(sp), w, h, viewport_canvas)
|
||||
# get data limits
|
||||
data_lims = gr_xy_axislims(sp)
|
||||
|
||||
ratio = sp[:aspect_ratio]
|
||||
if ratio != :none
|
||||
if ratio == :equal
|
||||
ratio = 1
|
||||
end
|
||||
viewport_ratio = (viewport_plotarea[2] - viewport_plotarea[1]) / (viewport_plotarea[4] - viewport_plotarea[3])
|
||||
window_ratio = (data_lims[2] - data_lims[1]) / (data_lims[4] - data_lims[3]) / ratio
|
||||
if window_ratio < viewport_ratio
|
||||
viewport_center = 0.5 * (viewport_plotarea[1] + viewport_plotarea[2])
|
||||
viewport_size = (viewport_plotarea[2] - viewport_plotarea[1]) * window_ratio / viewport_ratio
|
||||
viewport_plotarea[1] = viewport_center - 0.5 * viewport_size
|
||||
viewport_plotarea[2] = viewport_center + 0.5 * viewport_size
|
||||
elseif window_ratio > viewport_ratio
|
||||
viewport_center = 0.5 * (viewport_plotarea[3] + viewport_plotarea[4])
|
||||
viewport_size = (viewport_plotarea[4] - viewport_plotarea[3]) * viewport_ratio / window_ratio
|
||||
viewport_plotarea[3] = viewport_center - 0.5 * viewport_size
|
||||
viewport_plotarea[4] = viewport_center + 0.5 * viewport_size
|
||||
end
|
||||
end
|
||||
|
||||
# fill in the plot area background
|
||||
bg = plot_color(sp[:background_color_inside])
|
||||
@@ -500,8 +540,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
yaxis = sp[:yaxis]
|
||||
zaxis = sp[:zaxis]
|
||||
|
||||
# get data limits and set the scale flags and window
|
||||
data_lims = gr_xy_axislims(sp)
|
||||
# set the scale flags and window
|
||||
xmin, xmax, ymin, ymax = data_lims
|
||||
scale = 0
|
||||
xtick, ytick = 1, 1
|
||||
@@ -541,6 +580,11 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
if is3d(sp)
|
||||
zmin, zmax = gr_lims(zaxis, true)
|
||||
clims = sp[:clims]
|
||||
if is_2tuple(clims)
|
||||
isfinite(clims[1]) && (zmin = clims[1])
|
||||
isfinite(clims[2]) && (zmax = clims[2])
|
||||
end
|
||||
GR.setspace(zmin, zmax, 40, 70)
|
||||
xtick = GR.tick(xmin, xmax) / 2
|
||||
ytick = GR.tick(ymin, ymax) / 2
|
||||
@@ -558,6 +602,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
elseif ispolar(sp)
|
||||
r = gr_set_viewport_polar()
|
||||
rmin, rmax = GR.adjustrange(minimum(r), maximum(r))
|
||||
# rmin, rmax = axis_limits(sp[:yaxis])
|
||||
gr_polaraxes(rmin, rmax)
|
||||
|
||||
elseif draw_axes
|
||||
@@ -585,22 +630,32 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
if !(xticks in (nothing, false))
|
||||
# x labels
|
||||
flip = sp[:yaxis][:flip]
|
||||
gr_set_font(sp[:xaxis][:tickfont], valign = :top, color = sp[:xaxis][:foreground_color_axis])
|
||||
mirror = sp[:xaxis][:mirror]
|
||||
gr_set_font(sp[:xaxis][:tickfont],
|
||||
valign = (mirror ? :bottom : :top),
|
||||
color = sp[:xaxis][:foreground_color_axis],
|
||||
rotation = sp[:xaxis][:rotation])
|
||||
for (cv, dv) in zip(xticks...)
|
||||
xi, yi = GR.wctondc(cv, flip ? ymax : ymin)
|
||||
# @show cv dv ymin xi yi
|
||||
gr_text(xi, yi-0.01, string(dv))
|
||||
# use xor ($) to get the right y coords
|
||||
xi, yi = GR.wctondc(cv, (flip $ mirror) ? ymax : ymin)
|
||||
# @show cv dv ymin xi yi flip mirror (flip $ mirror)
|
||||
gr_text(xi, yi + (mirror ? 1 : -1) * 2e-3, string(dv))
|
||||
end
|
||||
end
|
||||
|
||||
if !(yticks in (nothing, false))
|
||||
# y labels
|
||||
flip = sp[:xaxis][:flip]
|
||||
gr_set_font(sp[:yaxis][:tickfont], halign = :right, color = sp[:yaxis][:foreground_color_axis])
|
||||
mirror = sp[:yaxis][:mirror]
|
||||
gr_set_font(sp[:yaxis][:tickfont],
|
||||
halign = (mirror ? :left : :right),
|
||||
color = sp[:yaxis][:foreground_color_axis],
|
||||
rotation = sp[:yaxis][:rotation])
|
||||
for (cv, dv) in zip(yticks...)
|
||||
xi, yi = GR.wctondc(flip ? xmax : xmin, cv)
|
||||
# use xor ($) to get the right y coords
|
||||
xi, yi = GR.wctondc((flip $ mirror) ? xmax : xmin, cv)
|
||||
# @show cv dv xmin xi yi
|
||||
gr_text(xi-0.01, yi, string(dv))
|
||||
gr_text(xi + (mirror ? 1 : -1) * 2e-3, yi, string(dv))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -644,8 +699,9 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
end
|
||||
GR.restorestate()
|
||||
|
||||
# TODO: can we remove?
|
||||
gr_set_font(xaxis[:tickfont])
|
||||
|
||||
# this needs to be here to point the colormap to the right indices
|
||||
GR.setcolormap(1000 + GR.COLORMAP_COOLWARM)
|
||||
|
||||
for (idx, series) in enumerate(series_list(sp))
|
||||
@@ -660,6 +716,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
GR.savestate()
|
||||
|
||||
|
||||
# update the bounding window
|
||||
if ispolar(sp)
|
||||
gr_set_viewport_polar()
|
||||
@@ -675,15 +732,10 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
# recompute data
|
||||
if typeof(z) <: Surface
|
||||
if st == :heatmap #&& size(z.surf) == (length(y), length(x))
|
||||
expand_extrema!(sp[:xaxis], (x[1]-0.5*(x[2]-x[1]), x[end]+0.5*(x[end]-x[end-1])))
|
||||
expand_extrema!(sp[:yaxis], (y[1]-0.5*(y[2]-y[1]), y[end]+0.5*(y[end]-y[end-1])))
|
||||
# # coords are centers... turn into edges
|
||||
# xd = diff(x)
|
||||
# x = vcat(x[1]-0.5xd[1], x[1]+xd, x[end]+0.5xd[end])
|
||||
# yd = diff(y)
|
||||
# y = vcat(y[1]-0.5yd[1], y[1]+yd, y[end]+0.5yd[end])
|
||||
end
|
||||
# if st == :heatmap
|
||||
# expand_extrema!(sp[:xaxis], (x[1]-0.5*(x[2]-x[1]), x[end]+0.5*(x[end]-x[end-1])))
|
||||
# expand_extrema!(sp[:yaxis], (y[1]-0.5*(y[2]-y[1]), y[end]+0.5*(y[end]-y[end-1])))
|
||||
# end
|
||||
z = vec(transpose_z(series, z.surf, false))
|
||||
elseif ispolar(sp)
|
||||
if frng != nothing
|
||||
@@ -694,21 +746,19 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
if st in (:path, :scatter)
|
||||
if length(x) > 1
|
||||
|
||||
# do area fill
|
||||
if frng != nothing
|
||||
gr_set_fillcolor(series[:fillcolor]) #, series[:fillalpha])
|
||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||
frng = isa(frng, Number) ? Float64[frng] : frng
|
||||
nx, ny, nf = length(x), length(y), length(frng)
|
||||
n = max(nx, ny)
|
||||
fx, fy = zeros(2n), zeros(2n)
|
||||
for i=1:n
|
||||
fx[i] = fx[end-i+1] = cycle(x,i)
|
||||
fy[i] = cycle(y,i)
|
||||
fy[end-i+1] = cycle(frng,i)
|
||||
fr_from, fr_to = (is_2tuple(frng) ? frng : (y, frng))
|
||||
for (i,rng) in enumerate(iter_segments(series[:x], series[:y]))
|
||||
if length(rng) > 1
|
||||
gr_set_fillcolor(cycle(series[:fillcolor], i))
|
||||
fx = cycle(x, vcat(rng, reverse(rng)))
|
||||
fy = vcat(cycle(fr_from,rng), cycle(fr_to,reverse(rng)))
|
||||
# @show i rng fx fy
|
||||
GR.fillarea(fx, fy)
|
||||
end
|
||||
end
|
||||
GR.fillarea(fx, fy)
|
||||
end
|
||||
|
||||
# draw the line(s)
|
||||
@@ -724,6 +774,11 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
elseif st == :contour
|
||||
zmin, zmax = gr_lims(zaxis, false)
|
||||
clims = sp[:clims]
|
||||
if is_2tuple(clims)
|
||||
isfinite(clims[1]) && (zmin = clims[1])
|
||||
isfinite(clims[2]) && (zmax = clims[2])
|
||||
end
|
||||
if typeof(series[:levels]) <: Array
|
||||
h = series[:levels]
|
||||
else
|
||||
@@ -735,7 +790,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
else
|
||||
GR.contour(x, y, h, z, 1000)
|
||||
end
|
||||
|
||||
|
||||
# create the colorbar of contour levels
|
||||
if sp[:colorbar] != :none
|
||||
gr_set_viewport_cmap(sp)
|
||||
@@ -761,11 +816,19 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
cmap && gr_colorbar(sp)
|
||||
|
||||
elseif st == :heatmap
|
||||
# z = vec(transpose_z(series, z.surf, false))
|
||||
zmin, zmax = gr_lims(zaxis, true)
|
||||
GR.setspace(zmin, zmax, 0, 90)
|
||||
# GR.surface(x, y, z, GR.OPTION_COLORED_MESH)
|
||||
GR.surface(x, y, z, GR.OPTION_HEATMAP)
|
||||
clims = sp[:clims]
|
||||
if is_2tuple(clims)
|
||||
isfinite(clims[1]) && (zmin = clims[1])
|
||||
isfinite(clims[2]) && (zmax = clims[2])
|
||||
end
|
||||
grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad()
|
||||
colors = [grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)] for zi=z]
|
||||
rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 +
|
||||
round(Int, blue(c) * 255) << 16 +
|
||||
round(Int, green(c) * 255) << 8 +
|
||||
round(Int, red(c) * 255) ), colors)
|
||||
GR.drawimage(xmin, xmax, ymin, ymax, length(x), length(y), rgba)
|
||||
cmap && gr_colorbar(sp)
|
||||
|
||||
elseif st in (:path3d, :scatter3d)
|
||||
@@ -809,15 +872,15 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
a2 = round(Int, a1 + (slices[i] / total) * 360.0)
|
||||
GR.setfillcolorind(980 + (i-1) % 20)
|
||||
GR.fillarc(xmin, xmax, ymin, ymax, a1, a2)
|
||||
alpha = 0.5 * (a1 + a2)
|
||||
cosf = r * cos(alpha * pi / 180)
|
||||
sinf = r * sin(alpha * pi / 180)
|
||||
α = 0.5 * (a1 + a2)
|
||||
cosf = r * cos(α * pi / 180)
|
||||
sinf = r * sin(α * pi / 180)
|
||||
x[1] = xcenter + cosf
|
||||
y[1] = ycenter + sinf
|
||||
x[2] = x[1] + 0.1 * cosf
|
||||
y[2] = y[1] + 0.1 * sinf
|
||||
y[3] = y[2]
|
||||
if 90 <= alpha < 270
|
||||
if 90 <= α < 270
|
||||
x[3] = x[2] - 0.05
|
||||
GR.settextalign(GR.TEXT_HALIGN_RIGHT, GR.TEXT_VALIGN_HALF)
|
||||
gr_text(x[3] - 0.01, y[3], string(labels[i]))
|
||||
@@ -852,16 +915,16 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
|
||||
elseif st == :image
|
||||
img = series[:z].surf
|
||||
w, h = size(img)
|
||||
if eltype(img) <: Colors.AbstractGray
|
||||
grey = round(UInt8, float(img) * 255)
|
||||
z = transpose_z(series, series[:z].surf, true)
|
||||
h, w = size(z)
|
||||
if eltype(z) <: Colors.AbstractGray
|
||||
grey = round(UInt8, float(z) * 255)
|
||||
rgba = map(c -> UInt32( 0xff000000 + Int(c)<<16 + Int(c)<<8 + Int(c) ), grey)
|
||||
else
|
||||
rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 +
|
||||
round(Int, blue(c) * 255) << 16 +
|
||||
round(Int, green(c) * 255) << 8 +
|
||||
round(Int, red(c) * 255) ), img)
|
||||
round(Int, red(c) * 255) ), z)
|
||||
end
|
||||
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
|
||||
end
|
||||
@@ -940,9 +1003,22 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
|
||||
# add annotations
|
||||
GR.savestate()
|
||||
# update the bounding window
|
||||
if ispolar(sp)
|
||||
gr_set_viewport_polar()
|
||||
else
|
||||
xmin, xmax, ymin, ymax = data_lims
|
||||
if xmax > xmin && ymax > ymin
|
||||
GR.setwindow(xmin, xmax, ymin, ymax)
|
||||
end
|
||||
end
|
||||
for ann in sp[:annotations]
|
||||
x, y, val = ann
|
||||
x, y = GR.wctondc(x, y)
|
||||
x, y = if is3d(sp)
|
||||
# GR.wc3towc(x, y, z)
|
||||
else
|
||||
GR.wctondc(x, y)
|
||||
end
|
||||
gr_set_font(val.font)
|
||||
gr_text(x, y, val.str)
|
||||
end
|
||||
@@ -959,18 +1035,27 @@ const _gr_mimeformats = Dict(
|
||||
"image/svg+xml" => "svg",
|
||||
)
|
||||
|
||||
const _gr_wstype_default = @static if is_linux()
|
||||
"x11"
|
||||
# "cairox11"
|
||||
elseif is_apple()
|
||||
"quartz"
|
||||
else
|
||||
"use_default"
|
||||
end
|
||||
|
||||
const _gr_wstype = Ref(get(ENV, "GKS_WSTYPE", _gr_wstype_default))
|
||||
gr_set_output(wstype::String) = (_gr_wstype[] = wstype)
|
||||
|
||||
for (mime, fmt) in _gr_mimeformats
|
||||
@eval function _writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
||||
@eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
||||
GR.emergencyclosegks()
|
||||
wstype = haskey(ENV, "GKS_WSTYPE") ? ENV["GKS_WSTYPE"] : "0"
|
||||
filepath = tempname() * "." * $fmt
|
||||
ENV["GKS_WSTYPE"] = $fmt
|
||||
ENV["GKS_FILEPATH"] = filepath
|
||||
gr_display(plt)
|
||||
GR.emergencyclosegks()
|
||||
write(io, readall(filepath))
|
||||
ENV["GKS_WSTYPE"] = wstype
|
||||
write(io, readstring(filepath))
|
||||
rm(filepath)
|
||||
end
|
||||
end
|
||||
@@ -987,6 +1072,12 @@ function _display(plt::Plot{GRBackend})
|
||||
println(content)
|
||||
rm(filepath)
|
||||
else
|
||||
ENV["GKS_DOUBLE_BUF"] = true
|
||||
if _gr_wstype[] != "use_default"
|
||||
ENV["GKS_WSTYPE"] = _gr_wstype[]
|
||||
end
|
||||
gr_display(plt)
|
||||
end
|
||||
end
|
||||
|
||||
closeall(::GRBackend) = GR.emergencyclosegks()
|
||||
|
||||
+29
-20
@@ -2,7 +2,7 @@
|
||||
|
||||
# significant contributions by: @pkofod
|
||||
|
||||
supported_args(::PGFPlotsBackend) = merge_with_base_supported([
|
||||
const _pgfplots_attr = merge_with_base_supported([
|
||||
# :annotations,
|
||||
# :background_color_legend,
|
||||
:background_color_inside,
|
||||
@@ -32,15 +32,20 @@ supported_args(::PGFPlotsBackend) = merge_with_base_supported([
|
||||
:aspect_ratio,
|
||||
# :match_dimensions,
|
||||
])
|
||||
supported_types(::PGFPlotsBackend) = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour]
|
||||
supported_styles(::PGFPlotsBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||
supported_markers(::PGFPlotsBackend) = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape)
|
||||
supported_scales(::PGFPlotsBackend) = [:identity, :ln, :log2, :log10]
|
||||
is_subplot_supported(::PGFPlotsBackend) = false
|
||||
const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour]
|
||||
const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||
const _pgfplots_marker = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape)
|
||||
const _pgfplots_scale = [:identity, :ln, :log2, :log10]
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend_string(::PGFPlotsBackend)
|
||||
"""
|
||||
Pkg.add("PGFPlots")
|
||||
Pkg.build("PGFPlots")
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::PGFPlotsBackend; kw...)
|
||||
@eval begin
|
||||
@@ -64,6 +69,8 @@ const _pgfplots_markers = KW(
|
||||
:none => "none",
|
||||
:cross => "+",
|
||||
:xcross => "x",
|
||||
:+ => "+",
|
||||
:x => "x",
|
||||
:utriangle => "triangle*",
|
||||
:dtriangle => "triangle*",
|
||||
:circle => "*",
|
||||
@@ -147,6 +154,8 @@ function pgf_series(sp::Subplot, series::Series)
|
||||
# add to legend?
|
||||
if sp[:legend] != :none && should_add_to_legend(series)
|
||||
kw[:legendentry] = d[:label]
|
||||
else
|
||||
push!(style, "forget plot")
|
||||
end
|
||||
|
||||
# function args
|
||||
@@ -225,6 +234,12 @@ function pgf_axis(sp::Subplot, letter)
|
||||
kw[Symbol(letter,:max)] = lims[2]
|
||||
end
|
||||
|
||||
if !(axis[:ticks] in (nothing, false, :none, :auto))
|
||||
ticks = get_ticks(axis)
|
||||
push!(style, string(letter, "tick = {", join(ticks[1],","), "}"))
|
||||
push!(style, string(letter, "ticklabels = {", join(ticks[2],","), "}"))
|
||||
end
|
||||
|
||||
# return the style list and KW args
|
||||
style, kw
|
||||
end
|
||||
@@ -232,7 +247,7 @@ end
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
function _make_pgf_plot!(plt::Plot)
|
||||
function _update_plot_object(plt::Plot{PGFPlotsBackend})
|
||||
plt.o = PGFPlots.Axis[]
|
||||
for sp in plt.subplots
|
||||
# first build the PGFPlots.Axis object
|
||||
@@ -243,10 +258,8 @@ function _make_pgf_plot!(plt::Plot)
|
||||
for letter in (:x, :y, :z)
|
||||
if letter != :z || is3d(sp)
|
||||
axisstyle, axiskw = pgf_axis(sp, letter)
|
||||
append!(style, axisstyle)
|
||||
merge!(kw, axiskw)
|
||||
for sty in axisstyle
|
||||
push!(style, sty)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,13 +269,13 @@ function _make_pgf_plot!(plt::Plot)
|
||||
push!(style, """
|
||||
xshift = $(left(bb).value)mm,
|
||||
yshift = $((height(bb) - (bottom(bb))).value)mm,
|
||||
width = $(width(bb).value)mm,
|
||||
height = $(height(bb).value)mm,
|
||||
axis background/.style={fill=$(pgf_color(sp[:background_color_inside])[1])}
|
||||
""")
|
||||
kw[:width] = "$(width(bb).value)mm"
|
||||
kw[:height] = "$(height(bb).value)mm"
|
||||
|
||||
if sp[:title] != ""
|
||||
push!(style, "title = $(sp[:title])")
|
||||
kw[:title] = "$(sp[:title])"
|
||||
end
|
||||
|
||||
sp[:grid] && push!(style, "grid = major")
|
||||
@@ -288,14 +301,11 @@ function _make_pgf_plot!(plt::Plot)
|
||||
end
|
||||
|
||||
|
||||
function _writemime(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsBackend})
|
||||
_make_pgf_plot!(plt)
|
||||
writemime(io, mime, plt.o)
|
||||
function _show(io::IO, mime::MIME"image/svg+xml", plt::Plot{PGFPlotsBackend})
|
||||
show(io, mime, plt.o)
|
||||
end
|
||||
|
||||
function _writemime(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsBackend})
|
||||
_make_pgf_plot!(plt)
|
||||
|
||||
function _show(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsBackend})
|
||||
# prepare the object
|
||||
pgfplt = PGFPlots.plot(plt.o)
|
||||
|
||||
@@ -312,7 +322,6 @@ end
|
||||
|
||||
function _display(plt::Plot{PGFPlotsBackend})
|
||||
# prepare the object
|
||||
_make_pgf_plot!(plt)
|
||||
pgfplt = PGFPlots.plot(plt.o)
|
||||
|
||||
# save an svg
|
||||
|
||||
+97
-33
@@ -1,7 +1,7 @@
|
||||
|
||||
# https://plot.ly/javascript/getting-started
|
||||
|
||||
supported_args(::PlotlyBackend) = merge_with_base_supported([
|
||||
const _plotly_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend, :background_color_inside, :background_color_outside,
|
||||
:foreground_color_legend, :foreground_color_guide,
|
||||
@@ -26,34 +26,43 @@ supported_args(::PlotlyBackend) = merge_with_base_supported([
|
||||
# :overwrite_figure,
|
||||
:polar,
|
||||
:normalize, :weights,
|
||||
# :contours, :aspect_ratio,
|
||||
# :contours,
|
||||
:aspect_ratio,
|
||||
:hover,
|
||||
:inset_subplots,
|
||||
:bar_width,
|
||||
])
|
||||
|
||||
supported_types(::PlotlyBackend) = [
|
||||
const _plotly_seriestype = [
|
||||
:path, :scatter, :bar, :pie, :heatmap,
|
||||
:contour, :surface, :path3d, :scatter3d, :shape, :scattergl,
|
||||
:contour, :surface, :wireframe, :path3d, :scatter3d, :shape, :scattergl,
|
||||
]
|
||||
supported_styles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||
supported_markers(::PlotlyBackend) = [
|
||||
const _plotly_style = [:auto, :solid, :dash, :dot, :dashdot]
|
||||
const _plotly_marker = [
|
||||
:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle,
|
||||
:cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline
|
||||
]
|
||||
supported_scales(::PlotlyBackend) = [:identity, :log10]
|
||||
const _plotly_scale = [:identity, :log10]
|
||||
is_subplot_supported(::PlotlyBackend) = true
|
||||
is_string_supported(::PlotlyBackend) = true
|
||||
# is_string_supported(::PlotlyBackend) = true
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend_string(::PlotlyBackend)
|
||||
"""
|
||||
Pkg.build("Plots")
|
||||
"""
|
||||
end
|
||||
|
||||
|
||||
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
|
||||
|
||||
function _initialize_backend(::PlotlyBackend; kw...)
|
||||
@eval begin
|
||||
import JSON
|
||||
JSON._print(io::IO, state::JSON.State, dt::Union{Date,DateTime}) = print(io, '"', dt, '"')
|
||||
|
||||
_js_path = Pkg.dir("Plots", "deps", "plotly-latest.min.js")
|
||||
_js_code = open(@compat(readstring), _js_path, "r")
|
||||
_js_code = open(readstring, _plotly_js_path, "r")
|
||||
|
||||
# borrowed from https://github.com/plotly/plotly.py/blob/2594076e29584ede2d09f2aa40a8a195b3f3fc66/plotly/offline/offline.py#L64-L71 c/o @spencerlyon2
|
||||
_js_script = """
|
||||
@@ -108,7 +117,7 @@ function plotly_annotation_dict(x, y, ptxt::PlotText; xref="paper", yref="paper"
|
||||
:font => plotly_font(ptxt.font),
|
||||
:xanchor => ptxt.font.halign == :hcenter ? :center : ptxt.font.halign,
|
||||
:yanchor => ptxt.font.valign == :vcenter ? :middle : ptxt.font.valign,
|
||||
:rotation => ptxt.font.rotation,
|
||||
:rotation => -ptxt.font.rotation,
|
||||
))
|
||||
end
|
||||
|
||||
@@ -143,11 +152,41 @@ function plotly_scale(scale::Symbol)
|
||||
end
|
||||
end
|
||||
|
||||
function shrink_by(lo, sz, ratio)
|
||||
amt = 0.5 * (1.0 - ratio) * sz
|
||||
lo + amt, sz - 2amt
|
||||
end
|
||||
|
||||
function plotly_apply_aspect_ratio(sp::Subplot, plotarea, pcts)
|
||||
aspect_ratio = sp[:aspect_ratio]
|
||||
if aspect_ratio != :none
|
||||
if aspect_ratio == :equal
|
||||
aspect_ratio = 1.0
|
||||
end
|
||||
xmin,xmax = axis_limits(sp[:xaxis])
|
||||
ymin,ymax = axis_limits(sp[:yaxis])
|
||||
want_ratio = ((xmax-xmin) / (ymax-ymin)) / aspect_ratio
|
||||
parea_ratio = width(plotarea) / height(plotarea)
|
||||
if want_ratio > parea_ratio
|
||||
# need to shrink y
|
||||
ratio = parea_ratio / want_ratio
|
||||
pcts[2], pcts[4] = shrink_by(pcts[2], pcts[4], ratio)
|
||||
elseif want_ratio < parea_ratio
|
||||
# need to shrink x
|
||||
ratio = want_ratio / parea_ratio
|
||||
pcts[1], pcts[3] = shrink_by(pcts[1], pcts[3], ratio)
|
||||
end
|
||||
pcts
|
||||
end
|
||||
pcts
|
||||
end
|
||||
|
||||
|
||||
# this method gets the start/end in percentage of the canvas for this axis direction
|
||||
function plotly_domain(sp::Subplot, letter)
|
||||
figw, figh = sp.plt[:size]
|
||||
pcts = bbox_to_pcts(sp.plotarea, figw*px, figh*px)
|
||||
pcts = plotly_apply_aspect_ratio(sp, sp.plotarea, pcts)
|
||||
i1,i2 = (letter == :x ? (1,3) : (2,4))
|
||||
[pcts[i1], pcts[i1]+pcts[i2]]
|
||||
end
|
||||
@@ -159,6 +198,7 @@ function plotly_axis(axis::Axis, sp::Subplot)
|
||||
:title => axis[:guide],
|
||||
:showgrid => sp[:grid],
|
||||
:zeroline => false,
|
||||
:ticks => "inside",
|
||||
)
|
||||
|
||||
if letter in (:x,:y)
|
||||
@@ -166,10 +206,7 @@ function plotly_axis(axis::Axis, sp::Subplot)
|
||||
ax[:anchor] = "$(letter==:x ? :y : :x)$(plotly_subplot_index(sp))"
|
||||
end
|
||||
|
||||
rot = axis[:rotation]
|
||||
if rot != 0
|
||||
ax[:tickangle] = rot
|
||||
end
|
||||
ax[:tickangle] = -axis[:rotation]
|
||||
|
||||
if !(axis[:ticks] in (nothing, :none))
|
||||
ax[:titlefont] = plotly_font(axis[:guidefont], axis[:foreground_color_guide])
|
||||
@@ -181,7 +218,7 @@ function plotly_axis(axis::Axis, sp::Subplot)
|
||||
# lims
|
||||
lims = axis[:lims]
|
||||
if lims != :auto && limsType(lims) == :limits
|
||||
ax[:range] = lims
|
||||
ax[:range] = map(scalefunc(axis[:scale]), lims)
|
||||
end
|
||||
|
||||
# flip
|
||||
@@ -191,7 +228,7 @@ function plotly_axis(axis::Axis, sp::Subplot)
|
||||
|
||||
# ticks
|
||||
ticks = get_ticks(axis)
|
||||
if ticks != :auto && ax[:type] != "-"
|
||||
if ticks != :auto
|
||||
ttype = ticksType(ticks)
|
||||
if ttype == :ticks
|
||||
ax[:tickmode] = "array"
|
||||
@@ -222,6 +259,7 @@ function plotly_layout(plt::Plot)
|
||||
for sp in plt.subplots
|
||||
spidx = plotly_subplot_index(sp)
|
||||
|
||||
|
||||
# add an annotation for the title... positioned horizontally relative to plotarea,
|
||||
# but vertically just below the top of the subplot bounding box
|
||||
if sp[:title] != ""
|
||||
@@ -241,8 +279,6 @@ function plotly_layout(plt::Plot)
|
||||
|
||||
d_out[:plot_bgcolor] = rgba_string(sp[:background_color_inside])
|
||||
|
||||
# TODO: x/y axis tick values/labels
|
||||
|
||||
# if any(is3d, seriesargs)
|
||||
if is3d(sp)
|
||||
d_out[:scene] = KW(
|
||||
@@ -307,6 +343,7 @@ plotly_colorscale(c, α) = plotly_colorscale(cgrad(alpha=α), α)
|
||||
const _plotly_markers = KW(
|
||||
:rect => "square",
|
||||
:xcross => "x",
|
||||
:x => "x",
|
||||
:utriangle => "triangle-up",
|
||||
:dtriangle => "triangle-down",
|
||||
:star5 => "star-triangle-up",
|
||||
@@ -332,8 +369,13 @@ function plotly_close_shapes(x, y)
|
||||
end
|
||||
|
||||
plotly_data(v) = collect(v)
|
||||
plotly_data(surf::Surface) = surf.surf
|
||||
plotly_data{R<:Rational}(v::AbstractArray{R}) = float(v)
|
||||
|
||||
plotly_surface_data(series::Series, a::AbstractVector) = a
|
||||
plotly_surface_data(series::Series, a::AbstractMatrix) = transpose_z(series, a, false)
|
||||
plotly_surface_data(series::Series, a::Surface) = plotly_surface_data(series, a.surf)
|
||||
|
||||
# get a dictionary representing the series params (d is the Plots-dict, d_out is the Plotly-dict)
|
||||
function plotly_series(plt::Plot, series::Series)
|
||||
st = series[:seriestype]
|
||||
@@ -357,6 +399,13 @@ function plotly_series(plt::Plot, series::Series)
|
||||
hasmarker = isscatter || series[:markershape] != :none
|
||||
hasline = st in (:path, :path3d)
|
||||
|
||||
# for surface types, set the data
|
||||
if st in (:heatmap, :contour, :surface, :wireframe)
|
||||
for letter in [:x,:y,:z]
|
||||
d_out[letter] = plotly_surface_data(series, series[letter])
|
||||
end
|
||||
end
|
||||
|
||||
# set the "type"
|
||||
if st in (:path, :scatter, :scattergl)
|
||||
d_out[:type] = st==:scattergl ? "scattergl" : "scatter"
|
||||
@@ -375,17 +424,21 @@ function plotly_series(plt::Plot, series::Series)
|
||||
|
||||
elseif st == :bar
|
||||
d_out[:type] = "bar"
|
||||
d_out[:x], d_out[:y] = x, y
|
||||
d_out[:orientation] = isvertical(series) ? "v" : "h"
|
||||
d_out[:x], d_out[:y], d_out[:orientation] = if isvertical(series)
|
||||
x, y, "v"
|
||||
else
|
||||
y, x, "h"
|
||||
end
|
||||
d_out[:marker] = KW(:color => rgba_string(series[:fillcolor]))
|
||||
|
||||
elseif st == :heatmap
|
||||
d_out[:type] = "heatmap"
|
||||
d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
|
||||
# d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
|
||||
d_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
|
||||
|
||||
elseif st == :contour
|
||||
d_out[:type] = "contour"
|
||||
d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
|
||||
# d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
|
||||
# d_out[:showscale] = series[:colorbar] != :none
|
||||
d_out[:ncontours] = series[:levels]
|
||||
d_out[:contours] = KW(:coloring => series[:fillrange] != nothing ? "fill" : "lines")
|
||||
@@ -393,8 +446,18 @@ function plotly_series(plt::Plot, series::Series)
|
||||
|
||||
elseif st in (:surface, :wireframe)
|
||||
d_out[:type] = "surface"
|
||||
d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
|
||||
d_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
|
||||
# d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
|
||||
if st == :wireframe
|
||||
d_out[:hidesurface] = true
|
||||
wirelines = KW(
|
||||
:show => true,
|
||||
:color => rgba_string(series[:linecolor]),
|
||||
:highlightwidth => series[:linewidth],
|
||||
)
|
||||
d_out[:contours] = KW(:x => wirelines, :y => wirelines, :z => wirelines)
|
||||
else
|
||||
d_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
|
||||
end
|
||||
|
||||
elseif st == :pie
|
||||
d_out[:type] = "pie"
|
||||
@@ -466,10 +529,10 @@ end
|
||||
|
||||
function plotly_series_shapes(plt::Plot, series::Series)
|
||||
d_outs = []
|
||||
|
||||
|
||||
# TODO: create a d_out for each polygon
|
||||
# x, y = series[:x], series[:y]
|
||||
|
||||
|
||||
# these are the axes that the series should be mapped to
|
||||
spidx = plotly_subplot_index(series[:subplot])
|
||||
base_d = KW()
|
||||
@@ -477,7 +540,7 @@ function plotly_series_shapes(plt::Plot, series::Series)
|
||||
base_d[:yaxis] = "y$spidx"
|
||||
base_d[:name] = series[:label]
|
||||
# base_d[:legendgroup] = series[:label]
|
||||
|
||||
|
||||
x, y = plotly_data(series[:x]), plotly_data(series[:y])
|
||||
for (i,rng) in enumerate(iter_segments(x,y))
|
||||
length(rng) < 2 && continue
|
||||
@@ -537,7 +600,7 @@ end
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function html_head(plt::Plot{PlotlyBackend})
|
||||
"<script src=\"$(Pkg.dir("Plots","deps","plotly-latest.min.js"))\"></script>"
|
||||
"<script src=\"$(joinpath(dirname(@__FILE__),"..","..","deps","plotly-latest.min.js"))\"></script>"
|
||||
end
|
||||
|
||||
function html_body(plt::Plot{PlotlyBackend}, style = nothing)
|
||||
@@ -567,11 +630,12 @@ end
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
function _writemime(io::IO, ::MIME"image/png", plt::Plot{PlotlyBackend})
|
||||
writemime_png_from_html(io, plt)
|
||||
function _show(io::IO, ::MIME"image/png", plt::Plot{PlotlyBackend})
|
||||
# show_png_from_html(io, plt)
|
||||
error("png output from the plotly backend is not supported. Please use plotlyjs instead.")
|
||||
end
|
||||
|
||||
function _writemime(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyBackend})
|
||||
function _show(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyBackend})
|
||||
write(io, html_head(plt) * html_body(plt))
|
||||
end
|
||||
|
||||
|
||||
+33
-12
@@ -1,16 +1,29 @@
|
||||
|
||||
# https://github.com/spencerlyon2/PlotlyJS.jl
|
||||
|
||||
supported_args(::PlotlyJSBackend) = supported_args(PlotlyBackend())
|
||||
supported_types(::PlotlyJSBackend) = supported_types(PlotlyBackend())
|
||||
supported_styles(::PlotlyJSBackend) = supported_styles(PlotlyBackend())
|
||||
supported_markers(::PlotlyJSBackend) = supported_markers(PlotlyBackend())
|
||||
supported_scales(::PlotlyJSBackend) = supported_scales(PlotlyBackend())
|
||||
is_subplot_supported(::PlotlyJSBackend) = true
|
||||
is_string_supported(::PlotlyJSBackend) = true
|
||||
const _plotlyjs_attr = _plotly_attr
|
||||
const _plotlyjs_seriestype = _plotly_seriestype
|
||||
const _plotlyjs_style = _plotly_style
|
||||
const _plotlyjs_marker = _plotly_marker
|
||||
const _plotlyjs_scale = _plotly_scale
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function add_backend_string(::PlotlyJSBackend)
|
||||
"""
|
||||
if !Plots.is_installed("PlotlyJS")
|
||||
Pkg.add("PlotlyJS")
|
||||
end
|
||||
if !Plots.is_installed("Rsvg")
|
||||
Pkg.add("Rsvg")
|
||||
end
|
||||
import Blink
|
||||
Blink.AtomShell.install()
|
||||
"""
|
||||
end
|
||||
|
||||
|
||||
function _initialize_backend(::PlotlyJSBackend; kw...)
|
||||
@eval begin
|
||||
import PlotlyJS
|
||||
@@ -43,10 +56,15 @@ end
|
||||
|
||||
function _series_updated(plt::Plot{PlotlyJSBackend}, series::Series)
|
||||
xsym, ysym = (ispolar(series) ? (:t,:r) : (:x,:y))
|
||||
kw = KW(xsym => (series.d[:x],), ysym => (series.d[:y],))
|
||||
z = series[:z]
|
||||
if z != nothing
|
||||
kw[:z] = (transpose_z(series, series[:z].surf, false),)
|
||||
end
|
||||
PlotlyJS.restyle!(
|
||||
plt.o,
|
||||
findfirst(plt.series_list, series),
|
||||
KW(xsym => (series.d[:x],), ysym => (series.d[:y],))
|
||||
kw
|
||||
)
|
||||
end
|
||||
|
||||
@@ -63,15 +81,18 @@ end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function _writemime(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyJSBackend})
|
||||
writemime(io, MIME("text/html"), plt.o)
|
||||
function _show(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyJSBackend})
|
||||
show(io, MIME("text/html"), plt.o)
|
||||
end
|
||||
|
||||
function _writemime(io::IO, ::MIME"image/png", plt::Plot{PlotlyJSBackend})
|
||||
tmpfn = tempname() * ".png"
|
||||
function plotlyjs_save_hack(io::IO, plt::Plot{PlotlyJSBackend}, ext::String)
|
||||
tmpfn = tempname() * "." * ext
|
||||
PlotlyJS.savefig(plt.o, tmpfn)
|
||||
write(io, read(open(tmpfn)))
|
||||
end
|
||||
_show(io::IO, ::MIME"image/png", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "png")
|
||||
_show(io::IO, ::MIME"application/pdf", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "pdf")
|
||||
_show(io::IO, ::MIME"image/eps", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "eps")
|
||||
|
||||
function _display(plt::Plot{PlotlyJSBackend})
|
||||
display(plt.o)
|
||||
|
||||
+80
-51
@@ -2,7 +2,7 @@
|
||||
# https://github.com/stevengj/PyPlot.jl
|
||||
|
||||
|
||||
supported_args(::PyPlotBackend) = merge_with_base_supported([
|
||||
const _pyplot_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color_legend, :background_color_inside, :background_color_outside,
|
||||
:foreground_color_grid, :foreground_color_legend, :foreground_color_title,
|
||||
@@ -31,29 +31,40 @@ supported_args(::PyPlotBackend) = merge_with_base_supported([
|
||||
:clims,
|
||||
:inset_subplots,
|
||||
:dpi,
|
||||
:colorbar_title,
|
||||
])
|
||||
supported_types(::PyPlotBackend) = [
|
||||
const _pyplot_seriestype = [
|
||||
:path, :steppre, :steppost, :shape,
|
||||
:scatter, :hexbin, #:histogram2d, :histogram,
|
||||
# :bar,
|
||||
:heatmap, :pie, :image,
|
||||
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
||||
]
|
||||
supported_styles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||
supported_markers(::PyPlotBackend) = vcat(_allMarkers, Shape)
|
||||
supported_scales(::PyPlotBackend) = [:identity, :ln, :log2, :log10]
|
||||
is_subplot_supported(::PyPlotBackend) = true
|
||||
const _pyplot_style = [:auto, :solid, :dash, :dot, :dashdot]
|
||||
const _pyplot_marker = vcat(_allMarkers, :pixel)
|
||||
const _pyplot_scale = [:identity, :ln, :log2, :log10]
|
||||
is_marker_supported(::PyPlotBackend, shape::Shape) = true
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend_string(::PyPlotBackend)
|
||||
"""
|
||||
if !Plots.is_installed("PyPlot")
|
||||
Pkg.add("PyPlot")
|
||||
end
|
||||
withenv("PYTHON" => "") do
|
||||
Pkg.build("PyPlot")
|
||||
end
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::PyPlotBackend)
|
||||
@eval begin
|
||||
# problem: https://github.com/tbreloff/Plots.jl/issues/308
|
||||
# solution: hack from @stevengj: https://github.com/stevengj/PyPlot.jl/pull/223#issuecomment-229747768
|
||||
otherdisplays = splice!(Base.Multimedia.displays, 2:length(Base.Multimedia.displays))
|
||||
import PyPlot
|
||||
import PyPlot, PyCall
|
||||
import LaTeXStrings: latexstring
|
||||
append!(Base.Multimedia.displays, otherdisplays)
|
||||
|
||||
@@ -106,7 +117,9 @@ py_color(grad::ColorGradient) = py_color(grad.colors)
|
||||
|
||||
function py_colormap(grad::ColorGradient)
|
||||
pyvals = [(z, py_color(grad[z])) for z in grad.values]
|
||||
pycolors.LinearSegmentedColormap[:from_list]("tmp", pyvals)
|
||||
cm = pycolors.LinearSegmentedColormap[:from_list]("tmp", pyvals)
|
||||
cm[:set_bad](color=(0,0,0,0.0), alpha=0.0)
|
||||
cm
|
||||
end
|
||||
py_colormap(c) = py_colormap(cgrad())
|
||||
|
||||
@@ -174,12 +187,13 @@ function py_marker(marker::Symbol)
|
||||
marker == :diamond && return "D"
|
||||
marker == :utriangle && return "^"
|
||||
marker == :dtriangle && return "v"
|
||||
# marker == :cross && return "+"
|
||||
# marker == :xcross && return "x"
|
||||
marker == :+ && return "+"
|
||||
marker == :x && return "x"
|
||||
marker == :star5 && return "*"
|
||||
marker == :pentagon && return "p"
|
||||
marker == :hexagon && return "h"
|
||||
marker == :octagon && return "8"
|
||||
marker == :pixel && return ","
|
||||
haskey(_shapes, marker) && return py_marker(_shapes[marker])
|
||||
|
||||
warn("Unknown marker $marker")
|
||||
@@ -234,6 +248,12 @@ function labelfunc(scale::Symbol, backend::PyPlotBackend)
|
||||
end
|
||||
end
|
||||
|
||||
function py_mask_nans(z)
|
||||
# PyPlot.pywrap(pynp.ma[:masked_invalid](PyPlot.pywrap(z)))
|
||||
PyCall.pycall(pynp.ma[:masked_invalid], Any, z)
|
||||
# pynp.ma[:masked_where](pynp.isnan(z),z)
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
function fix_xy_lengths!(plt::Plot{PyPlotBackend}, series::Series)
|
||||
@@ -344,7 +364,7 @@ function py_bbox_title(ax)
|
||||
end
|
||||
|
||||
function py_dpi_scale(plt::Plot{PyPlotBackend}, ptsz)
|
||||
ptsz * DPI / plt[:dpi]
|
||||
ptsz * plt[:dpi] / DPI
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -398,10 +418,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
||||
sp = series[:subplot]
|
||||
ax = sp.o
|
||||
|
||||
if !(st in supported_types(plt.backend))
|
||||
error("seriestype $(st) is unsupported in PyPlot. Choose from: $(supported_types(plt.backend))")
|
||||
end
|
||||
|
||||
# PyPlot doesn't handle mismatched x/y
|
||||
fix_xy_lengths!(plt, series)
|
||||
|
||||
@@ -458,6 +474,13 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
||||
:linewidth => py_dpi_scale(plt, series[:linewidth]),
|
||||
:linestyle => py_linestyle(st, series[:linestyle])
|
||||
)
|
||||
clims = sp[:clims]
|
||||
if is_2tuple(clims)
|
||||
extrakw = KW()
|
||||
isfinite(clims[1]) && (extrakw[:vmin] = clims[1])
|
||||
isfinite(clims[2]) && (extrakw[:vmax] = clims[2])
|
||||
kw[:norm] = pycolors.Normalize(; extrakw...)
|
||||
end
|
||||
lz = collect(series[:line_z])
|
||||
handle = if is3d(st)
|
||||
for rng in iter_segments(x, y, z)
|
||||
@@ -706,39 +729,28 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
||||
|
||||
if st == :heatmap
|
||||
x, y, z = heatmap_edges(x), heatmap_edges(y), transpose_z(series, z.surf)
|
||||
# if !(eltype(z) <: Number)
|
||||
# z, discrete_colorbar_values = indices_and_unique_values(z)
|
||||
# end
|
||||
|
||||
expand_extrema!(sp[:xaxis], x)
|
||||
expand_extrema!(sp[:yaxis], y)
|
||||
dvals = sp[:zaxis][:discrete_values]
|
||||
if !isempty(dvals)
|
||||
discrete_colorbar_values = dvals
|
||||
end
|
||||
|
||||
clims = sp[:clims]
|
||||
if is_2tuple(clims)
|
||||
isfinite(clims[1]) && (extrakw[:vmin] = clims[1])
|
||||
isfinite(clims[2]) && (extrakw[:vmax] = clims[2])
|
||||
end
|
||||
|
||||
handle = ax[:pcolormesh](x, y, z;
|
||||
zmin, zmax = extrema(z)
|
||||
extrakw[:vmin] = (is_2tuple(clims) && isfinite(clims[1])) ? clims[1] : zmin
|
||||
extrakw[:vmax] = (is_2tuple(clims) && isfinite(clims[2])) ? clims[2] : zmax
|
||||
|
||||
handle = ax[:pcolormesh](x, y, py_mask_nans(z);
|
||||
label = series[:label],
|
||||
zorder = series[:series_plotindex],
|
||||
cmap = py_fillcolormap(series),
|
||||
edgecolors = (series[:linewidth] > 0 ? py_linecolor(series) : "face"),
|
||||
# edgecolors = (series[:linewidth] > 0 ? py_linecolor(series) : "face"),
|
||||
extrakw...
|
||||
)
|
||||
push!(handles, handle)
|
||||
needs_colorbar = true
|
||||
|
||||
# TODO: this should probably be handled generically
|
||||
# expand extrema... handle is a QuadMesh object
|
||||
for path in handle[:properties]()["paths"]
|
||||
verts = path[:vertices]
|
||||
xmin, ymin = minimum(verts, 1)
|
||||
xmax, ymax = maximum(verts, 1)
|
||||
expand_extrema!(sp, xmin, xmax, ymin, ymax)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if st == :shape
|
||||
@@ -781,7 +793,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
||||
# # expand extrema... get list of Wedge objects
|
||||
# for wedge in handle
|
||||
# path = wedge[:get_path]()
|
||||
# for
|
||||
# for
|
||||
lim = 1.1
|
||||
expand_extrema!(sp, -lim, lim, -lim, lim)
|
||||
end
|
||||
@@ -809,7 +821,9 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
||||
# note: the colorbar axis is positioned independently from the subplot axis
|
||||
fig = plt.o
|
||||
cbax = fig[:add_axes]([0.8,0.1,0.03,0.8], label = string(gensym()))
|
||||
sp.attr[:cbar_handle] = fig[:colorbar](handle; cax = cbax, kw...)
|
||||
cb = fig[:colorbar](handle; cax = cbax, kw...)
|
||||
cb[:set_label](sp[:colorbar_title])
|
||||
sp.attr[:cbar_handle] = cb
|
||||
sp.attr[:cbar_ax] = cbax
|
||||
end
|
||||
|
||||
@@ -871,11 +885,13 @@ end
|
||||
function py_compute_axis_minval(axis::Axis)
|
||||
# compute the smallest absolute value for the log scale's linear threshold
|
||||
minval = 1.0
|
||||
sp = axis.sp
|
||||
for series in series_list(axis.sp)
|
||||
v = series.d[axis[:letter]]
|
||||
if !isempty(v)
|
||||
minval = min(minval, minimum(abs(v)))
|
||||
sps = axis.sps
|
||||
for sp in sps
|
||||
for series in series_list(sp)
|
||||
v = series.d[axis[:letter]]
|
||||
if !isempty(v)
|
||||
minval = min(minval, minimum(abs(v)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -935,7 +951,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
fig[:set_size_inches](w/dpi, h/dpi, forward = true)
|
||||
fig[:set_facecolor](py_color(plt[:background_color_outside]))
|
||||
fig[:set_dpi](dpi)
|
||||
|
||||
|
||||
# resize the window
|
||||
PyPlot.plt[:get_current_fig_manager]()[:resize](w, h)
|
||||
|
||||
@@ -973,6 +989,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
end
|
||||
ax[func][:set_text](sp[:title])
|
||||
ax[func][:set_fontsize](py_dpi_scale(plt, sp[:titlefont].pointsize))
|
||||
ax[func][:set_family](sp[:titlefont].family)
|
||||
ax[func][:set_color](py_color(sp[:foreground_color_title]))
|
||||
# ax[:set_title](sp[:title], loc = loc)
|
||||
end
|
||||
@@ -980,8 +997,15 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
# axis attributes
|
||||
for letter in (:x, :y, :z)
|
||||
axissym = Symbol(letter, :axis)
|
||||
axis = sp[axissym]
|
||||
haskey(ax, axissym) || continue
|
||||
axis = sp[axissym]
|
||||
pyaxis = ax[axissym]
|
||||
if axis[:mirror] && letter != :z
|
||||
pos = letter == :x ? "top" : "right"
|
||||
pyaxis[:set_label_position](pos) # the guides
|
||||
pyaxis[:set_ticks_position]("both") # the hash marks
|
||||
pyaxis[Symbol(:tick_, pos)]() # the tick labels
|
||||
end
|
||||
py_set_scale(ax, axis)
|
||||
py_set_lims(ax, axis)
|
||||
py_set_ticks(ax, get_ticks(axis), letter)
|
||||
@@ -989,14 +1013,16 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
if get(axis.d, :flip, false)
|
||||
ax[Symbol("invert_", letter, "axis")]()
|
||||
end
|
||||
ax[axissym][:label][:set_fontsize](py_dpi_scale(plt, axis[:guidefont].pointsize))
|
||||
pyaxis[:label][:set_fontsize](py_dpi_scale(plt, axis[:guidefont].pointsize))
|
||||
pyaxis[:label][:set_family](axis[:guidefont].family)
|
||||
for lab in ax[Symbol("get_", letter, "ticklabels")]()
|
||||
lab[:set_fontsize](py_dpi_scale(plt, axis[:tickfont].pointsize))
|
||||
lab[:set_family](axis[:tickfont].family)
|
||||
lab[:set_rotation](axis[:rotation])
|
||||
end
|
||||
if sp[:grid]
|
||||
fgcolor = py_color(sp[:foreground_color_grid])
|
||||
ax[axissym][:grid](true, color = fgcolor)
|
||||
pyaxis[:grid](true, color = fgcolor)
|
||||
ax[:set_axisbelow](true)
|
||||
end
|
||||
py_set_axis_colors(ax, axis)
|
||||
@@ -1044,7 +1070,7 @@ function _update_min_padding!(sp::Subplot{PyPlotBackend})
|
||||
# optionally add the width of colorbar labels and colorbar to rightpad
|
||||
if haskey(sp.attr, :cbar_ax)
|
||||
bb = py_bbox(sp.attr[:cbar_handle][:ax][:get_yticklabels]())
|
||||
sp.attr[:cbar_width] = _cbar_width + width(bb) + 1mm
|
||||
sp.attr[:cbar_width] = _cbar_width + width(bb) + 1mm + (sp[:colorbar_title] == "" ? 0px : 30px)
|
||||
rightpad = rightpad + sp.attr[:cbar_width]
|
||||
end
|
||||
|
||||
@@ -1121,13 +1147,14 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
loc = get(_pyplot_legend_pos, leg, "best"),
|
||||
scatterpoints = 1,
|
||||
fontsize = py_dpi_scale(plt, sp[:legendfont].pointsize)
|
||||
# family = sp[:legendfont].family
|
||||
# framealpha = 0.6
|
||||
)
|
||||
leg[:set_zorder](1000)
|
||||
|
||||
fgcolor = py_color(sp[:foreground_color_legend])
|
||||
for txt in leg[:get_texts]()
|
||||
PyPlot.plt[:setp](txt, color = fgcolor)
|
||||
PyPlot.plt[:setp](txt, color = fgcolor, family = sp[:legendfont].family)
|
||||
end
|
||||
|
||||
# set some legend properties
|
||||
@@ -1184,16 +1211,18 @@ const _pyplot_mimeformats = Dict(
|
||||
|
||||
|
||||
for (mime, fmt) in _pyplot_mimeformats
|
||||
@eval function _writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PyPlotBackend})
|
||||
@eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PyPlotBackend})
|
||||
fig = plt.o
|
||||
fig.o[:canvas][:print_figure](
|
||||
fig[:canvas][:print_figure](
|
||||
io,
|
||||
format=$fmt,
|
||||
# bbox_inches = "tight",
|
||||
# figsize = map(px2inch, plt[:size]),
|
||||
facecolor = fig.o[:get_facecolor](),
|
||||
facecolor = fig[:get_facecolor](),
|
||||
edgecolor = "none",
|
||||
dpi = plt[:dpi]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
closeall(::PyPlotBackend) = PyPlot.plt[:close]("all")
|
||||
|
||||
@@ -67,7 +67,7 @@ end
|
||||
# "image/png" => "png",
|
||||
# "application/postscript" => "ps",
|
||||
# "image/svg+xml" => "svg"
|
||||
function _writemime(io::IO, ::MIME"image/png", plt::Plot{[PkgName]Backend})
|
||||
function _show(io::IO, ::MIME"image/png", plt::Plot{[PkgName]Backend})
|
||||
end
|
||||
|
||||
# Display/show the plot (open a GUI window, or browser page, for example).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# https://github.com/Evizero/UnicodePlots.jl
|
||||
|
||||
supported_args(::UnicodePlotsBackend) = merge_with_base_supported([
|
||||
const _unicodeplots_attr = merge_with_base_supported([
|
||||
:label,
|
||||
:legend,
|
||||
:seriescolor,
|
||||
@@ -12,21 +12,30 @@ supported_args(::UnicodePlotsBackend) = merge_with_base_supported([
|
||||
:title,
|
||||
:guide, :lims,
|
||||
])
|
||||
supported_types(::UnicodePlotsBackend) = [
|
||||
const _unicodeplots_seriestype = [
|
||||
:path, :scatter,
|
||||
:histogram2d
|
||||
# :bar,
|
||||
:shape,
|
||||
:histogram2d,
|
||||
:spy
|
||||
]
|
||||
supported_styles(::UnicodePlotsBackend) = [:auto, :solid]
|
||||
supported_markers(::UnicodePlotsBackend) = [:none, :auto, :circle]
|
||||
supported_scales(::UnicodePlotsBackend) = [:identity]
|
||||
is_subplot_supported(::UnicodePlotsBackend) = true
|
||||
const _unicodeplots_style = [:auto, :solid]
|
||||
const _unicodeplots_marker = [:none, :auto, :circle]
|
||||
const _unicodeplots_scale = [:identity]
|
||||
|
||||
|
||||
# don't warn on unsupported... there's just too many warnings!!
|
||||
warnOnUnsupported_args(pkg::UnicodePlotsBackend, d::KW) = nothing
|
||||
warnOnUnsupported_args(::UnicodePlotsBackend, d::KW) = nothing
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
function add_backend_string(::UnicodePlotsBackend)
|
||||
"""
|
||||
Pkg.add("UnicodePlots")
|
||||
Pkg.build("UnicodePlots")
|
||||
"""
|
||||
end
|
||||
|
||||
function _initialize_backend(::UnicodePlotsBackend; kw...)
|
||||
@eval begin
|
||||
import UnicodePlots
|
||||
@@ -38,7 +47,7 @@ end
|
||||
|
||||
|
||||
# do all the magic here... build it all at once, since we need to know about all the series at the very beginning
|
||||
function rebuildUnicodePlot!(plt::Plot)
|
||||
function rebuildUnicodePlot!(plt::Plot, width, height)
|
||||
plt.o = []
|
||||
|
||||
for sp in plt.subplots
|
||||
@@ -57,8 +66,28 @@ function rebuildUnicodePlot!(plt::Plot)
|
||||
y = Float64[ylim[1]]
|
||||
|
||||
# create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds
|
||||
width, height = plt[:size]
|
||||
canvas_type = isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas
|
||||
|
||||
# special handling for spy
|
||||
if length(sp.series_list) == 1
|
||||
series = sp.series_list[1]
|
||||
if series[:seriestype] == :spy
|
||||
push!(plt.o, UnicodePlots.spy(
|
||||
series[:z].surf,
|
||||
width = width,
|
||||
height = height,
|
||||
title = sp[:title],
|
||||
canvas = canvas_type
|
||||
))
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
# # make it a bar canvas if plotting bar
|
||||
# if any(series -> series[:seriestype] == :bar, series_list(sp))
|
||||
# canvas_type = UnicodePlots.BarplotGraphics
|
||||
# end
|
||||
|
||||
o = UnicodePlots.Plot(x, y, canvas_type;
|
||||
width = width,
|
||||
height = height,
|
||||
@@ -96,6 +125,10 @@ function addUnicodeSeries!(o, d::KW, addlegend::Bool, xlim, ylim)
|
||||
func = UnicodePlots.lineplot!
|
||||
elseif st == :scatter || d[:markershape] != :none
|
||||
func = UnicodePlots.scatterplot!
|
||||
# elseif st == :bar
|
||||
# func = UnicodePlots.barplot!
|
||||
elseif st == :shape
|
||||
func = UnicodePlots.lineplot!
|
||||
else
|
||||
error("Linestyle $st not supported by UnicodePlots")
|
||||
end
|
||||
@@ -108,12 +141,13 @@ function addUnicodeSeries!(o, d::KW, addlegend::Bool, xlim, ylim)
|
||||
color = d[:linecolor] in UnicodePlots.color_cycle ? d[:linecolor] : :auto
|
||||
|
||||
# add the series
|
||||
x, y = Plots.unzip(collect(filter(xy->isfinite(xy[1])&&isfinite(xy[2]), zip(x,y))))
|
||||
func(o, x, y; color = color, name = label)
|
||||
end
|
||||
|
||||
# -------------------------------
|
||||
|
||||
# since this is such a hack, it's only callable using `png`... should error during normal `writemime`
|
||||
# since this is such a hack, it's only callable using `png`... should error during normal `show`
|
||||
function png(plt::AbstractPlot{UnicodePlotsBackend}, fn::AbstractString)
|
||||
fn = addExtension(fn, "png")
|
||||
|
||||
@@ -122,7 +156,7 @@ function png(plt::AbstractPlot{UnicodePlotsBackend}, fn::AbstractString)
|
||||
gui(plt)
|
||||
|
||||
# @osx_only begin
|
||||
@compat @static if is_apple()
|
||||
@static if is_apple()
|
||||
# BEGIN HACK
|
||||
|
||||
# wait while the plot gets drawn
|
||||
@@ -143,21 +177,21 @@ end
|
||||
|
||||
# we don't do very much for subplots... just stack them vertically
|
||||
|
||||
function _update_plot_object(plt::Plot{UnicodePlotsBackend})
|
||||
w, h = plt[:size]
|
||||
plt.attr[:size] = div(w, 10), div(h, 20)
|
||||
plt.attr[:color_palette] = [RGB(0,0,0)]
|
||||
rebuildUnicodePlot!(plt)
|
||||
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
w, h = plt[:size]
|
||||
plt.attr[:color_palette] = [RGB(0,0,0)]
|
||||
rebuildUnicodePlot!(plt, div(w, 10), div(h, 20))
|
||||
end
|
||||
|
||||
function _writemime(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
||||
map(show, plt.o)
|
||||
nothing
|
||||
function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
||||
unicodeplots_rebuild(plt)
|
||||
map(show, plt.o)
|
||||
nothing
|
||||
end
|
||||
|
||||
|
||||
function _display(plt::Plot{UnicodePlotsBackend})
|
||||
map(show, plt.o)
|
||||
nothing
|
||||
unicodeplots_rebuild(plt)
|
||||
map(show, plt.o)
|
||||
nothing
|
||||
end
|
||||
|
||||
|
||||
+4
-4
@@ -20,13 +20,13 @@ function standalone_html(plt::AbstractPlot; title::AbstractString = get(plt.attr
|
||||
end
|
||||
|
||||
function open_browser_window(filename::AbstractString)
|
||||
@compat @static if is_apple()
|
||||
@static if is_apple()
|
||||
return run(`open $(filename)`)
|
||||
end
|
||||
@compat @static if is_linux()
|
||||
@static if is_linux()
|
||||
return run(`xdg-open $(filename)`)
|
||||
end
|
||||
@compat @static if is_windows()
|
||||
@static if is_windows()
|
||||
return run(`$(ENV["COMSPEC"]) /c start $(filename)`)
|
||||
end
|
||||
warn("Unknown OS... cannot open browser window.")
|
||||
@@ -51,7 +51,7 @@ function html_to_png(html_fn, png_fn, w, h)
|
||||
run(`wkhtmltoimage -f png -q --width $w --height $h --disable-smart-width $html_fn $png_fn`)
|
||||
end
|
||||
|
||||
function writemime_png_from_html(io::IO, plt::AbstractPlot)
|
||||
function show_png_from_html(io::IO, plt::AbstractPlot)
|
||||
# write html to a temporary file
|
||||
html_fn = write_temp_html(plt)
|
||||
|
||||
|
||||
+43
-4
@@ -47,7 +47,7 @@ end
|
||||
|
||||
"get an array of tuples of points on a circle with radius `r`"
|
||||
function partialcircle(start_θ, end_θ, n = 20, r=1)
|
||||
@compat(Tuple{Float64,Float64})[(r*cos(u),r*sin(u)) for u in linspace(start_θ, end_θ, n)]
|
||||
Tuple{Float64,Float64}[(r*cos(u),r*sin(u)) for u in linspace(start_θ, end_θ, n)]
|
||||
end
|
||||
|
||||
"interleave 2 vectors into each other (like a zipper's teeth)"
|
||||
@@ -119,6 +119,8 @@ const _shape_keys = Symbol[
|
||||
:star8,
|
||||
:vline,
|
||||
:hline,
|
||||
:+,
|
||||
:x,
|
||||
]
|
||||
|
||||
const _shapes = KW(
|
||||
@@ -209,8 +211,9 @@ function rotate!(shape::Shape, Θ::Real, c = center(shape))
|
||||
x, y = shape_coords(shape)
|
||||
cx, cy = c
|
||||
for i=1:length(x)
|
||||
x[i] = rotate_x(x[i], y[i], Θ, cx, cy)
|
||||
y[i] = rotate_y(x[i], y[i], Θ, cx, cy)
|
||||
xi = rotate_x(x[i], y[i], Θ, cx, cy)
|
||||
yi = rotate_y(x[i], y[i], Θ, cx, cy)
|
||||
x[i], y[i] = xi, yi
|
||||
end
|
||||
shape
|
||||
end
|
||||
@@ -415,6 +418,35 @@ immutable SurfaceFunction <: AbstractSurface
|
||||
f::Function
|
||||
end
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# # I don't want to clash with ValidatedNumerics, but this would be nice:
|
||||
# ..(a::T, b::T) = (a,b)
|
||||
|
||||
immutable Volume{T}
|
||||
v::Array{T,3}
|
||||
x_extents::Tuple{T,T}
|
||||
y_extents::Tuple{T,T}
|
||||
z_extents::Tuple{T,T}
|
||||
end
|
||||
|
||||
default_extents{T}(::Type{T}) = (zero(T), one(T))
|
||||
|
||||
function Volume{T}(v::Array{T,3},
|
||||
x_extents = default_extents(T),
|
||||
y_extents = default_extents(T),
|
||||
z_extents = default_extents(T))
|
||||
Volume(v, x_extents, y_extents, z_extents)
|
||||
end
|
||||
|
||||
Base.Array(vol::Volume) = vol.v
|
||||
for f in (:length, :size)
|
||||
@eval Base.$f(vol::Volume, args...) = $f(vol.v, args...)
|
||||
end
|
||||
Base.copy{T}(vol::Volume{T}) = Volume{T}(copy(vol.v), vol.x_extents, vol.y_extents, vol.z_extents)
|
||||
Base.eltype{T}(vol::Volume{T}) = T
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# style is :open or :closed (for now)
|
||||
@@ -465,6 +497,13 @@ function add_arrows(func::Function, x::AVec, y::AVec)
|
||||
end
|
||||
end
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
"Represents data values with formatting that should apply to the tick labels."
|
||||
immutable Formatted{T}
|
||||
data::T
|
||||
formatter::Function
|
||||
end
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
@@ -472,7 +511,7 @@ type BezierCurve{T <: FixedSizeArrays.Vec}
|
||||
control_points::Vector{T}
|
||||
end
|
||||
|
||||
@compat function (bc::BezierCurve)(t::Real)
|
||||
function (bc::BezierCurve)(t::Real)
|
||||
p = zero(P2)
|
||||
n = length(bc.control_points)-1
|
||||
for i in 0:n
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# https://github.com/bokeh/Bokeh.jl
|
||||
|
||||
|
||||
supported_args(::BokehBackend) = merge_with_base_supported([
|
||||
supported_attrs(::BokehBackend) = merge_with_base_supported([
|
||||
# :annotations,
|
||||
# :axis,
|
||||
# :background_color,
|
||||
@@ -194,7 +194,7 @@ end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{BokehBackend})
|
||||
function Base.show(io::IO, ::MIME"image/png", plt::AbstractPlot{BokehBackend})
|
||||
# TODO: write a png to io
|
||||
warn("mime png not implemented")
|
||||
end
|
||||
@@ -2,7 +2,7 @@
|
||||
# https://github.com/dcjones/Gadfly.jl
|
||||
|
||||
|
||||
supported_args(::GadflyBackend) = merge_with_base_supported([
|
||||
supported_attrs(::GadflyBackend) = merge_with_base_supported([
|
||||
:annotations,
|
||||
:background_color, :foreground_color, :color_palette,
|
||||
:group, :label, :seriestype,
|
||||
@@ -41,7 +41,7 @@ function _initialize_backend(::GadflyBackend; kw...)
|
||||
@eval begin
|
||||
import Gadfly, Compose
|
||||
export Gadfly, Compose
|
||||
include(joinpath(Pkg.dir("Plots"), "src", "backends", "gadfly_shapes.jl"))
|
||||
include(joinpath(dirname(@__FILE__), "gadfly_shapes.jl"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -244,7 +244,7 @@ function addToGadflyLegend(plt::Plot, d::KW)
|
||||
|
||||
# add the legend if needed
|
||||
if all(g -> !isa(g, Gadfly.Guide.ManualColorKey), gplt.guides)
|
||||
unshift!(gplt.guides, Gadfly.Guide.manual_color_key("", @compat(AbstractString)[], Color[]))
|
||||
unshift!(gplt.guides, Gadfly.Guide.manual_color_key("", AbstractString[], Color[]))
|
||||
end
|
||||
|
||||
# now add the series to the legend
|
||||
@@ -456,7 +456,7 @@ function updateGadflyAxisFlips(gplt, d::KW, xlims, ylims, xfunc, yfunc)
|
||||
end
|
||||
|
||||
|
||||
function findGuideAndSet(gplt, t::DataType, args...; kw...) #s::@compat(AbstractString))
|
||||
function findGuideAndSet(gplt, t::DataType, args...; kw...)
|
||||
for (i,guide) in enumerate(gplt.guides)
|
||||
if isa(guide, t)
|
||||
gplt.guides[i] = t(args...; kw...)
|
||||
@@ -537,7 +537,7 @@ end
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
function createGadflyAnnotationObject(x, y, val::@compat(AbstractString))
|
||||
function createGadflyAnnotationObject(x, y, val::AbstractString)
|
||||
Gadfly.Guide.annotation(Compose.compose(
|
||||
Compose.context(),
|
||||
Compose.text(x, y, val)
|
||||
@@ -558,7 +558,7 @@ function createGadflyAnnotationObject(x, y, txt::PlotText)
|
||||
))
|
||||
end
|
||||
|
||||
function _add_annotations{X,Y,V}(plt::Plot{GadflyBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
|
||||
function _add_annotations{X,Y,V}(plt::Plot{GadflyBackend}, anns::AVec{Tuple{X,Y,V}})
|
||||
for ann in anns
|
||||
push!(plt.o.guides, createGadflyAnnotationObject(ann...))
|
||||
end
|
||||
@@ -677,7 +677,7 @@ setGadflyDisplaySize(plt::Plot) = setGadflyDisplaySize(plt.attr[:size]...)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
function dowritemime{P<:Union{GadflyBackend,ImmerseBackend}}(io::IO, func, plt::AbstractPlot{P})
|
||||
function doshow{P<:Union{GadflyBackend,ImmerseBackend}}(io::IO, func, plt::AbstractPlot{P})
|
||||
gplt = getGadflyContext(plt)
|
||||
setGadflyDisplaySize(plt)
|
||||
Gadfly.draw(func(io, Compose.default_graphic_width, Compose.default_graphic_height), gplt)
|
||||
@@ -692,9 +692,9 @@ getGadflyWriteFunc(::MIME"application/x-tex") = Gadfly.PGF
|
||||
getGadflyWriteFunc(m::MIME) = error("Unsupported in Gadfly/Immerse: ", m)
|
||||
|
||||
for mime in (MIME"image/png", MIME"image/svg+xml", MIME"application/pdf", MIME"application/postscript", MIME"application/x-tex")
|
||||
@eval function Base.writemime{P<:Union{GadflyBackend,ImmerseBackend}}(io::IO, ::$mime, plt::AbstractPlot{P})
|
||||
@eval function Base.show{P<:Union{GadflyBackend,ImmerseBackend}}(io::IO, ::$mime, plt::AbstractPlot{P})
|
||||
func = getGadflyWriteFunc($mime())
|
||||
dowritemime(io, func, plt)
|
||||
doshow(io, func, plt)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# https://github.com/JuliaGraphics/Immerse.jl
|
||||
|
||||
supported_args(::ImmerseBackend) = supported_args(GadflyBackend())
|
||||
supported_attrs(::ImmerseBackend) = supported_attrs(GadflyBackend())
|
||||
supported_types(::ImmerseBackend) = supported_types(GadflyBackend())
|
||||
supported_styles(::ImmerseBackend) = supported_styles(GadflyBackend())
|
||||
supported_markers(::ImmerseBackend) = supported_markers(GadflyBackend())
|
||||
@@ -14,7 +14,7 @@ function _initialize_backend(::ImmerseBackend; kw...)
|
||||
@eval begin
|
||||
import Immerse, Gadfly, Compose, Gtk
|
||||
export Immerse, Gadfly, Compose, Gtk
|
||||
include(joinpath(Pkg.dir("Plots"), "src", "backends", "gadfly_shapes.jl"))
|
||||
include(joinpath(dirname(@__FILE__), "gadfly_shapes.jl"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function _add_annotations{X,Y,V}(plt::Plot{ImmerseBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
|
||||
function _add_annotations{X,Y,V}(plt::Plot{ImmerseBackend}, anns::AVec{Tuple{X,Y,V}})
|
||||
for ann in anns
|
||||
push!(getGadflyContext(plt).guides, createGadflyAnnotationObject(ann...))
|
||||
end
|
||||
@@ -2,7 +2,7 @@
|
||||
# https://github.com/tbreloff/Qwt.jl
|
||||
|
||||
|
||||
supported_args(::QwtBackend) = merge_with_base_supported([
|
||||
supported_attrs(::QwtBackend) = merge_with_base_supported([
|
||||
:annotations,
|
||||
:linecolor,
|
||||
:fillrange,
|
||||
@@ -39,7 +39,7 @@ end
|
||||
|
||||
# -------------------------------
|
||||
|
||||
@compat const _qwtAliases = KW(
|
||||
const _qwtAliases = KW(
|
||||
:bins => :heatmap_n,
|
||||
:fillrange => :fillto,
|
||||
:linewidth => :width,
|
||||
@@ -133,7 +133,7 @@ function updateLimsAndTicks(plt::Plot{QwtBackend}, d::KW, isx::Bool)
|
||||
w = plt.o.widget
|
||||
axisid = Qwt.QWT.QwtPlot[isx ? :xBottom : :yLeft]
|
||||
|
||||
if typeof(lims) <: @compat(Union{Tuple,AVec}) && length(lims) == 2
|
||||
if typeof(lims) <: Union{Tuple,AVec} && length(lims) == 2
|
||||
if isx
|
||||
plt.o.autoscale_x = false
|
||||
else
|
||||
@@ -211,14 +211,14 @@ function createQwtAnnotation(plt::Plot, x, y, val::PlotText)
|
||||
marker[:attach](plt.o.widget)
|
||||
end
|
||||
|
||||
function createQwtAnnotation(plt::Plot, x, y, val::@compat(AbstractString))
|
||||
function createQwtAnnotation(plt::Plot, x, y, val::AbstractString)
|
||||
marker = Qwt.QWT.QwtPlotMarker()
|
||||
marker[:setValue](x, y)
|
||||
marker[:setLabel](Qwt.QWT.QwtText(val))
|
||||
marker[:attach](plt.o.widget)
|
||||
end
|
||||
|
||||
function _add_annotations{X,Y,V}(plt::Plot{QwtBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
|
||||
function _add_annotations{X,Y,V}(plt::Plot{QwtBackend}, anns::AVec{Tuple{X,Y,V}})
|
||||
for ann in anns
|
||||
createQwtAnnotation(plt, ann...)
|
||||
end
|
||||
@@ -242,8 +242,6 @@ end
|
||||
|
||||
# -------------------------------
|
||||
|
||||
# savepng(::QwtBackend, plt::AbstractPlot, fn::@compat(AbstractString), args...) = Qwt.savepng(plt.o, fn)
|
||||
|
||||
# -------------------------------
|
||||
|
||||
# # create the underlying object (each backend will do this differently)
|
||||
@@ -282,13 +280,13 @@ end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function Base.writemime(io::IO, ::MIME"image/png", plt::Plot{QwtBackend})
|
||||
function Base.show(io::IO, ::MIME"image/png", plt::Plot{QwtBackend})
|
||||
Qwt.refresh(plt.o)
|
||||
Qwt.savepng(plt.o, "/tmp/dfskjdhfkh.png")
|
||||
write(io, readall("/tmp/dfskjdhfkh.png"))
|
||||
end
|
||||
|
||||
# function Base.writemime(io::IO, ::MIME"image/png", subplt::Subplot{QwtBackend})
|
||||
# function Base.show(io::IO, ::MIME"image/png", subplt::Subplot{QwtBackend})
|
||||
# for plt in subplt.plts
|
||||
# Qwt.refresh(plt.o)
|
||||
# end
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# credit goes to https://github.com/jverzani for contributing to the first draft of this backend implementation
|
||||
|
||||
supported_args(::WinstonBackend) = merge_with_base_supported([
|
||||
supported_attrs(::WinstonBackend) = merge_with_base_supported([
|
||||
:annotations,
|
||||
:linecolor,
|
||||
:fillrange,
|
||||
@@ -44,13 +44,13 @@ end
|
||||
|
||||
|
||||
## dictionaries for conversion of Plots.jl names to Winston ones.
|
||||
@compat const winston_linestyle = KW(:solid=>"solid",
|
||||
const winston_linestyle = KW(:solid=>"solid",
|
||||
:dash=>"dash",
|
||||
:dot=>"dotted",
|
||||
:dashdot=>"dotdashed"
|
||||
)
|
||||
|
||||
@compat const winston_marker = KW(:none=>".",
|
||||
const winston_marker = KW(:none=>".",
|
||||
:rect => "square",
|
||||
:circle=>"circle",
|
||||
:diamond=>"diamond",
|
||||
@@ -185,7 +185,7 @@ end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
@compat const _winstonNames = KW(
|
||||
const _winstonNames = KW(
|
||||
:xlims => :xrange,
|
||||
:ylims => :yrange,
|
||||
:xscale => :xlog,
|
||||
@@ -213,11 +213,11 @@ end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function createWinstonAnnotationObject(plt::Plot{WinstonBackend}, x, y, val::@compat(AbstractString))
|
||||
function createWinstonAnnotationObject(plt::Plot{WinstonBackend}, x, y, val::AbstractString)
|
||||
Winston.text(x, y, val)
|
||||
end
|
||||
|
||||
function _add_annotations{X,Y,V}(plt::Plot{WinstonBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
|
||||
function _add_annotations{X,Y,V}(plt::Plot{WinstonBackend}, anns::AVec{Tuple{X,Y,V}})
|
||||
for ann in anns
|
||||
createWinstonAnnotationObject(plt, ann...)
|
||||
end
|
||||
@@ -238,10 +238,10 @@ function addWinstonLegend(plt::Plot, wplt)
|
||||
end
|
||||
end
|
||||
|
||||
function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{WinstonBackend})
|
||||
function Base.show(io::IO, ::MIME"image/png", plt::AbstractPlot{WinstonBackend})
|
||||
window, canvas, wplt = getWinstonItems(plt)
|
||||
addWinstonLegend(plt, wplt)
|
||||
writemime(io, "image/png", wplt)
|
||||
show(io, "image/png", wplt)
|
||||
end
|
||||
|
||||
|
||||
+4
-4
@@ -61,7 +61,7 @@ PlotExample("Global",
|
||||
# "Use the `axis` arguments.",
|
||||
# [
|
||||
# :(plot(Vector[randn(100), randn(100)*100], axis = [:l :r], ylabel="LEFT", yrightlabel="RIGHT", xlabel="X", title="TITLE"))
|
||||
# ]),
|
||||
# ]),
|
||||
|
||||
PlotExample("Images",
|
||||
"Plot an image. y-axis is set to flipped",
|
||||
@@ -115,7 +115,7 @@ PlotExample("Line types",
|
||||
PlotExample("Line styles",
|
||||
"",
|
||||
[:(begin
|
||||
styles = filter(s -> s in supported_styles(), [:solid, :dash, :dot, :dashdot, :dashdotdot])'
|
||||
styles = filter(s -> s in Plots.supported_styles(), [:solid, :dash, :dot, :dashdot, :dashdotdot])'
|
||||
n = length(styles)
|
||||
y = cumsum(randn(20,n),1)
|
||||
plot(y, line = (5, styles), label = map(string,styles))
|
||||
@@ -125,7 +125,7 @@ PlotExample("Line styles",
|
||||
PlotExample("Marker types",
|
||||
"",
|
||||
[:(begin
|
||||
markers = filter(m -> m in supported_markers(), Plots._shape_keys)'
|
||||
markers = filter(m -> m in Plots.supported_markers(), Plots._shape_keys)'
|
||||
n = length(markers)
|
||||
x = linspace(0,10,n+2)[2:end-1]
|
||||
y = repmat(reverse(x)', n, 1)
|
||||
@@ -252,7 +252,7 @@ PlotExample("DataFrames",
|
||||
iris = RDatasets.dataset("datasets", "iris")
|
||||
scatter(iris, :SepalLength, :SepalWidth, group=:Species,
|
||||
title = "My awesome plot", xlabel = "Length", ylabel = "Width",
|
||||
marker = (0.5, [:+ :h :star7], 12), bg=RGB(.2,.2,.2))
|
||||
marker = (0.5, [:cross :hex :star7], 12), bg=RGB(.2,.2,.2))
|
||||
end)]
|
||||
),
|
||||
|
||||
|
||||
+89
-34
@@ -9,10 +9,10 @@ to_pixels(m::AbsoluteLength) = m.value / 0.254
|
||||
|
||||
const _cbar_width = 5mm
|
||||
|
||||
@compat Base.:.*(m::Measure, n::Number) = m * n
|
||||
@compat Base.:.*(n::Number, m::Measure) = m * n
|
||||
@compat Base.:-(m::Measure, a::AbstractArray) = map(ai -> m - ai, a)
|
||||
@compat Base.:-(a::AbstractArray, m::Measure) = map(ai -> ai - m, a)
|
||||
Base.:.*(m::Measure, n::Number) = m * n
|
||||
Base.:.*(n::Number, m::Measure) = m * n
|
||||
Base.:-(m::Measure, a::AbstractArray) = map(ai -> m - ai, a)
|
||||
Base.:-(a::AbstractArray, m::Measure) = map(ai -> ai - m, a)
|
||||
Base.zero(::Type{typeof(mm)}) = 0mm
|
||||
Base.one(::Type{typeof(mm)}) = 1mm
|
||||
Base.typemin(::typeof(mm)) = -Inf*mm
|
||||
@@ -20,15 +20,15 @@ Base.typemax(::typeof(mm)) = Inf*mm
|
||||
Base.convert{F<:AbstractFloat}(::Type{F}, l::AbsoluteLength) = convert(F, l.value)
|
||||
|
||||
# TODO: these are unintuitive and may cause tricky bugs
|
||||
# @compat Base.:+(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * (1 + m2.value))
|
||||
# @compat Base.:+(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * (1 + m1.value))
|
||||
# @compat Base.:-(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * (1 - m2.value))
|
||||
# @compat Base.:-(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * (m1.value - 1))
|
||||
# Base.:+(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * (1 + m2.value))
|
||||
# Base.:+(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * (1 + m1.value))
|
||||
# Base.:-(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * (1 - m2.value))
|
||||
# Base.:-(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * (m1.value - 1))
|
||||
|
||||
@compat Base.:*(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * m2.value)
|
||||
@compat Base.:*(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * m1.value)
|
||||
@compat Base.:/(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value / m2.value)
|
||||
@compat Base.:/(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value / m1.value)
|
||||
Base.:*(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * m2.value)
|
||||
Base.:*(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * m1.value)
|
||||
Base.:/(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value / m2.value)
|
||||
Base.:/(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value / m1.value)
|
||||
|
||||
|
||||
Base.zero(::Type{typeof(pct)}) = 0pct
|
||||
@@ -44,11 +44,11 @@ right(bbox::BoundingBox) = left(bbox) + width(bbox)
|
||||
bottom(bbox::BoundingBox) = top(bbox) + height(bbox)
|
||||
Base.size(bbox::BoundingBox) = (width(bbox), height(bbox))
|
||||
|
||||
# @compat Base.:*{T,N}(m1::Length{T,N}, m2::Length{T,N}) = Length{T,N}(m1.value * m2.value)
|
||||
# Base.:*{T,N}(m1::Length{T,N}, m2::Length{T,N}) = Length{T,N}(m1.value * m2.value)
|
||||
ispositive(m::Measure) = m.value > 0
|
||||
|
||||
# union together bounding boxes
|
||||
@compat function Base.:+(bb1::BoundingBox, bb2::BoundingBox)
|
||||
function Base.:+(bb1::BoundingBox, bb2::BoundingBox)
|
||||
# empty boxes don't change the union
|
||||
ispositive(width(bb1)) || return bb2
|
||||
ispositive(height(bb1)) || return bb2
|
||||
@@ -113,9 +113,11 @@ function bbox(x, y, w, h, oarg1::Symbol, originargs::Symbol...)
|
||||
orighor = :left
|
||||
origver = :top
|
||||
for oarg in oargs
|
||||
if oarg in (:left, :right)
|
||||
if oarg == :center
|
||||
orighor = origver = oarg
|
||||
elseif oarg in (:left, :right, :hcenter)
|
||||
orighor = oarg
|
||||
elseif oarg in (:top, :bottom)
|
||||
elseif oarg in (:top, :bottom, :vcenter)
|
||||
origver = oarg
|
||||
else
|
||||
warn("Unused origin arg in bbox construction: $oarg")
|
||||
@@ -132,13 +134,17 @@ function bbox(x, y, width, height; h_anchor = :left, v_anchor = :top)
|
||||
height = make_measure_vert(height)
|
||||
left = if h_anchor == :left
|
||||
x
|
||||
elseif h_anchor in (:center, :hcenter)
|
||||
0.5w - 0.5width + x
|
||||
else
|
||||
1w - x - width
|
||||
1w - x - width
|
||||
end
|
||||
top = if v_anchor == :top
|
||||
y
|
||||
elseif v_anchor in (:center, :vcenter)
|
||||
0.5h - 0.5height + y
|
||||
else
|
||||
1h - y - height
|
||||
1h - y - height
|
||||
end
|
||||
BoundingBox(left, top, width, height)
|
||||
end
|
||||
@@ -239,7 +245,9 @@ function GridLayout(dims...;
|
||||
# convert(Vector{Float64}, widths),
|
||||
# convert(Vector{Float64}, heights),
|
||||
KW(kw))
|
||||
fill!(grid, EmptyLayout(layout))
|
||||
for i in eachindex(grid)
|
||||
grid[i] = EmptyLayout(layout)
|
||||
end
|
||||
layout
|
||||
end
|
||||
|
||||
@@ -256,7 +264,7 @@ rightpad(layout::GridLayout) = layout.minpad[3]
|
||||
bottompad(layout::GridLayout) = layout.minpad[4]
|
||||
|
||||
|
||||
# here's how this works... first we recursively "update the minimum padding" (which
|
||||
# here's how this works... first we recursively "update the minimum padding" (which
|
||||
# means to calculate the minimum size needed from the edge of the subplot to plot area)
|
||||
# for the whole layout tree. then we can compute the "padding borders" of this
|
||||
# layout as the biggest padding of the children on the perimeter. then we need to
|
||||
@@ -311,7 +319,6 @@ function update_child_bboxes!(layout::GridLayout, minimum_perimeter = [0mm,0mm,0
|
||||
minpad_top = map(toppad, layout.grid)
|
||||
minpad_right = map(rightpad, layout.grid)
|
||||
minpad_bottom = map(bottompad, layout.grid)
|
||||
# @show minpad_left minpad_top minpad_right minpad_bottom
|
||||
|
||||
# get the max horizontal (left and right) padding over columns,
|
||||
# and max vertical (bottom and top) padding over rows
|
||||
@@ -320,7 +327,6 @@ function update_child_bboxes!(layout::GridLayout, minimum_perimeter = [0mm,0mm,0
|
||||
pad_top = maximum(minpad_top, 2)
|
||||
pad_right = maximum(minpad_right, 1)
|
||||
pad_bottom = maximum(minpad_bottom, 2)
|
||||
# @show pad_left pad_top pad_right pad_bottom
|
||||
|
||||
# make sure the perimeter match the parent
|
||||
pad_left[1] = max(pad_left[1], minimum_perimeter[1])
|
||||
@@ -331,22 +337,18 @@ function update_child_bboxes!(layout::GridLayout, minimum_perimeter = [0mm,0mm,0
|
||||
# scale this up to the total padding in each direction
|
||||
total_pad_horizontal = sum(pad_left + pad_right)
|
||||
total_pad_vertical = sum(pad_top + pad_bottom)
|
||||
# @show total_pad_horizontal total_pad_vertical
|
||||
|
||||
# now we can compute the total plot area in each direction
|
||||
total_plotarea_horizontal = width(layout) - total_pad_horizontal
|
||||
total_plotarea_vertical = height(layout) - total_pad_vertical
|
||||
# @show total_plotarea_horizontal total_plotarea_vertical
|
||||
|
||||
# recompute widths/heights
|
||||
layout.widths = recompute_lengths(layout.widths)
|
||||
layout.heights = recompute_lengths(layout.heights)
|
||||
# @show layout.widths layout.heights
|
||||
|
||||
# normalize widths/heights so they sum to 1
|
||||
# denom_w = sum(layout.widths)
|
||||
# denom_h = sum(layout.heights)
|
||||
# @show layout.widths layout.heights denom_w, denom_h
|
||||
|
||||
# we have all the data we need... lets compute the plot areas and set the bounding boxes
|
||||
for r=1:nr, c=1:nc
|
||||
@@ -387,7 +389,6 @@ end
|
||||
function update_inset_bboxes!(plt::Plot)
|
||||
for sp in plt.inset_subplots
|
||||
p_area = Measures.resolve(plotarea(sp.parent), sp[:relative_bbox])
|
||||
# @show bbox(sp.parent) sp[:relative_bbox] p_area
|
||||
plotarea!(sp, p_area)
|
||||
|
||||
bbox!(sp, bbox(
|
||||
@@ -436,7 +437,7 @@ end
|
||||
function layout_args(d::KW, n_override::Integer)
|
||||
layout, n = layout_args(get(d, :layout, n_override))
|
||||
if n != n_override
|
||||
error("When doing layout, n != n_override. You're probably trying to force existing plots into a layout that doesn't fit them.")
|
||||
error("When doing layout, n ($n) != n_override ($(n_override)). You're probably trying to force existing plots into a layout that doesn't fit them.")
|
||||
end
|
||||
layout, n
|
||||
end
|
||||
@@ -502,6 +503,12 @@ function build_layout(layout::GridLayout, n::Integer)
|
||||
i += 1
|
||||
elseif isa(l, GridLayout)
|
||||
# sub-grid
|
||||
if get(l.attr, :width, :auto) != :auto
|
||||
layout.widths[c] = attr(l,:width)
|
||||
end
|
||||
if get(l.attr, :height, :auto) != :auto
|
||||
layout.heights[r] = attr(l,:height)
|
||||
end
|
||||
l, sps, m = build_layout(l, n-i)
|
||||
append!(subplots, sps)
|
||||
merge!(spmap, m)
|
||||
@@ -538,6 +545,12 @@ function build_layout(layout::GridLayout, numsp::Integer, plts::AVec{Plot})
|
||||
i += length(plt.subplots)
|
||||
elseif isa(l, GridLayout)
|
||||
# sub-grid
|
||||
if get(l.attr, :width, :auto) != :auto
|
||||
layout.widths[c] = attr(l,:width)
|
||||
end
|
||||
if get(l.attr, :height, :auto) != :auto
|
||||
layout.heights[r] = attr(l,:height)
|
||||
end
|
||||
l, sps, m = build_layout(l, numsp-i, plts)
|
||||
append!(subplots, sps)
|
||||
merge!(spmap, m)
|
||||
@@ -597,7 +610,7 @@ function create_grid(expr::Expr)
|
||||
create_grid_curly(expr)
|
||||
else
|
||||
# if it's something else, just return that (might be an existing layout?)
|
||||
expr
|
||||
esc(expr)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -634,13 +647,18 @@ function create_grid_vcat(expr::Expr)
|
||||
end
|
||||
|
||||
function create_grid_curly(expr::Expr)
|
||||
s = expr.args[1]
|
||||
kw = KW()
|
||||
for (i,arg) in enumerate(expr.args[2:end])
|
||||
add_layout_pct!(kw, arg, i, length(expr.args)-1)
|
||||
end
|
||||
# @show kw
|
||||
:(EmptyLayout(label = $(QuoteNode(s)), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto)))))
|
||||
s = expr.args[1]
|
||||
if isa(s, Expr) && s.head == :call && s.args[1] == :grid
|
||||
create_grid(:(grid($(s.args[2:end]...), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto))))))
|
||||
elseif isa(s, Symbol)
|
||||
:(EmptyLayout(label = $(QuoteNode(s)), width = $(get(kw, :w, QuoteNode(:auto))), height = $(get(kw, :h, QuoteNode(:auto)))))
|
||||
else
|
||||
error("Unknown use of curly brackets: $expr")
|
||||
end
|
||||
end
|
||||
|
||||
function create_grid(s::Symbol)
|
||||
@@ -654,20 +672,42 @@ end
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# make all reference the same axis extrema/values
|
||||
# make all reference the same axis extrema/values.
|
||||
# merge subplot lists.
|
||||
function link_axes!(axes::Axis...)
|
||||
a1 = axes[1]
|
||||
for i=2:length(axes)
|
||||
a2 = axes[i]
|
||||
expand_extrema!(a1, extrema(a2))
|
||||
for k in (:extrema, :discrete_values, :continuous_values, :discrete_map)
|
||||
a2[k] = a1[k]
|
||||
end
|
||||
|
||||
# make a2's subplot list refer to a1's and add any missing values
|
||||
sps2 = a2.sps
|
||||
for sp in sps2
|
||||
sp in a1.sps || push!(a1.sps, sp)
|
||||
end
|
||||
a2.sps = a1.sps
|
||||
end
|
||||
end
|
||||
|
||||
# figure out which subplots to link
|
||||
function link_subplots(a::AbstractArray{AbstractLayout}, axissym::Symbol)
|
||||
subplots = []
|
||||
for l in a
|
||||
if isa(l, Subplot)
|
||||
push!(subplots, l)
|
||||
elseif isa(l, GridLayout) && size(l) == (1,1)
|
||||
push!(subplots, l[1,1])
|
||||
end
|
||||
end
|
||||
subplots
|
||||
end
|
||||
|
||||
# for some vector or matrix of layouts, filter only the Subplots and link those axes
|
||||
function link_axes!(a::AbstractArray{AbstractLayout}, axissym::Symbol)
|
||||
subplots = filter(l -> isa(l, Subplot), a)
|
||||
subplots = link_subplots(a, axissym)
|
||||
axes = [sp.attr[axissym] for sp in subplots]
|
||||
if length(axes) > 0
|
||||
link_axes!(axes...)
|
||||
@@ -709,3 +749,18 @@ function link_axes!(layout::GridLayout, link::Symbol)
|
||||
link_axes!(l, link)
|
||||
end
|
||||
end
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
"Adds a new, empty subplot overlayed on top of `sp`, with a mirrored y-axis and linked x-axis."
|
||||
function twinx(sp::Subplot)
|
||||
sp[:right_margin] = max(sp[:right_margin], 30px)
|
||||
plot!(sp.plt, inset = (sp[:subplot_index], bbox(0,0,1,1)))
|
||||
twinsp = sp.plt.subplots[end]
|
||||
twinsp[:yaxis][:mirror] = true
|
||||
twinsp[:background_color_inside] = RGBA{Float64}(0,0,0,0)
|
||||
link_axes!(sp[:xaxis], twinsp[:xaxis])
|
||||
twinsp
|
||||
end
|
||||
|
||||
twinx(plt::Plot = current()) = twinx(plt[1])
|
||||
|
||||
+74
-49
@@ -5,7 +5,7 @@ defaultOutputFormat(plt::Plot) = "png"
|
||||
function png(plt::Plot, fn::AbstractString)
|
||||
fn = addExtension(fn, "png")
|
||||
io = open(fn, "w")
|
||||
writemime(io, MIME("image/png"), plt)
|
||||
show(io, MIME("image/png"), plt)
|
||||
close(io)
|
||||
end
|
||||
png(fn::AbstractString) = png(current(), fn)
|
||||
@@ -13,7 +13,7 @@ png(fn::AbstractString) = png(current(), fn)
|
||||
function svg(plt::Plot, fn::AbstractString)
|
||||
fn = addExtension(fn, "svg")
|
||||
io = open(fn, "w")
|
||||
writemime(io, MIME("image/svg+xml"), plt)
|
||||
show(io, MIME("image/svg+xml"), plt)
|
||||
close(io)
|
||||
end
|
||||
svg(fn::AbstractString) = svg(current(), fn)
|
||||
@@ -22,7 +22,7 @@ svg(fn::AbstractString) = svg(current(), fn)
|
||||
function pdf(plt::Plot, fn::AbstractString)
|
||||
fn = addExtension(fn, "pdf")
|
||||
io = open(fn, "w")
|
||||
writemime(io, MIME("application/pdf"), plt)
|
||||
show(io, MIME("application/pdf"), plt)
|
||||
close(io)
|
||||
end
|
||||
pdf(fn::AbstractString) = pdf(current(), fn)
|
||||
@@ -31,16 +31,23 @@ pdf(fn::AbstractString) = pdf(current(), fn)
|
||||
function ps(plt::Plot, fn::AbstractString)
|
||||
fn = addExtension(fn, "ps")
|
||||
io = open(fn, "w")
|
||||
writemime(io, MIME("application/postscript"), plt)
|
||||
show(io, MIME("application/postscript"), plt)
|
||||
close(io)
|
||||
end
|
||||
ps(fn::AbstractString) = ps(current(), fn)
|
||||
|
||||
function eps(plt::Plot, fn::AbstractString)
|
||||
fn = addExtension(fn, "eps")
|
||||
io = open(fn, "w")
|
||||
writemime(io, MIME("image/eps"), plt)
|
||||
close(io)
|
||||
end
|
||||
eps(fn::AbstractString) = eps(current(), fn)
|
||||
|
||||
function tex(plt::Plot, fn::AbstractString)
|
||||
fn = addExtension(fn, "tex")
|
||||
io = open(fn, "w")
|
||||
writemime(io, MIME("application/x-tex"), plt)
|
||||
show(io, MIME("application/x-tex"), plt)
|
||||
close(io)
|
||||
end
|
||||
tex(fn::AbstractString) = tex(current(), fn)
|
||||
@@ -49,11 +56,12 @@ tex(fn::AbstractString) = tex(current(), fn)
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
@compat const _savemap = Dict(
|
||||
const _savemap = Dict(
|
||||
"png" => png,
|
||||
"svg" => svg,
|
||||
"pdf" => pdf,
|
||||
"ps" => ps,
|
||||
"eps" => eps,
|
||||
"tex" => tex,
|
||||
)
|
||||
|
||||
@@ -126,29 +134,31 @@ const _mimeformats = Dict(
|
||||
const _best_html_output_type = KW(
|
||||
:pyplot => :png,
|
||||
:unicodeplots => :txt,
|
||||
:glvisualize => :png
|
||||
)
|
||||
|
||||
# a backup for html... passes to svg or png depending on the html_output_format arg
|
||||
function Base.writemime(io::IO, ::MIME"text/html", plt::Plot)
|
||||
function Base.show(io::IO, ::MIME"text/html", plt::Plot)
|
||||
output_type = Symbol(plt.attr[:html_output_format])
|
||||
if output_type == :auto
|
||||
output_type = get(_best_html_output_type, backend_name(plt.backend), :svg)
|
||||
end
|
||||
if output_type == :png
|
||||
# info("writing png to html output")
|
||||
print(io, "<img src=\"data:image/png;base64,", base64encode(writemime, MIME("image/png"), plt), "\" />")
|
||||
print(io, "<img src=\"data:image/png;base64,", base64encode(show, MIME("image/png"), plt), "\" />")
|
||||
elseif output_type == :svg
|
||||
# info("writing svg to html output")
|
||||
writemime(io, MIME("image/svg+xml"), plt)
|
||||
show(io, MIME("image/svg+xml"), plt)
|
||||
elseif output_type == :txt
|
||||
writemime(io, MIME("text/plain"), plt)
|
||||
show(io, MIME("text/plain"), plt)
|
||||
else
|
||||
error("only png or svg allowed. got: $output_type")
|
||||
end
|
||||
end
|
||||
|
||||
function _writemime(io::IO, m, plt::Plot)
|
||||
warn("_writemime is not defined for this backend. m=", string(m))
|
||||
function _show{B}(io::IO, m, plt::Plot{B})
|
||||
# Base.show_backtrace(STDOUT, backtrace())
|
||||
warn("_show is not defined for this backend. m=", string(m))
|
||||
end
|
||||
function _display(plt::Plot)
|
||||
warn("_display is not defined for this backend.")
|
||||
@@ -156,19 +166,21 @@ end
|
||||
|
||||
# for writing to io streams... first prepare, then callback
|
||||
for mime in keys(_mimeformats)
|
||||
@eval function Base.writemime(io::IO, m::MIME{Symbol($mime)}, plt::Plot)
|
||||
@eval function Base.show{B}(io::IO, m::MIME{Symbol($mime)}, plt::Plot{B})
|
||||
prepare_output(plt)
|
||||
_writemime(io, m, plt)
|
||||
_show(io, m, plt)
|
||||
end
|
||||
end
|
||||
|
||||
closeall() = closeall(backend())
|
||||
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# A backup, if no PNG generation is defined, is to try to make a PDF and use FileIO to convert
|
||||
|
||||
if is_installed("FileIO")
|
||||
@eval import FileIO
|
||||
function _writemime(io::IO, ::MIME"image/png", plt::Plot)
|
||||
function _show(io::IO, ::MIME"image/png", plt::Plot)
|
||||
fn = tempname()
|
||||
|
||||
# first save a pdf file
|
||||
@@ -192,12 +204,12 @@ end
|
||||
|
||||
# function html_output_format(fmt)
|
||||
# if fmt == "png"
|
||||
# @eval function Base.writemime(io::IO, ::MIME"text/html", plt::Plot)
|
||||
# print(io, "<img src=\"data:image/png;base64,", base64(writemime, MIME("image/png"), plt), "\" />")
|
||||
# @eval function Base.show(io::IO, ::MIME"text/html", plt::Plot)
|
||||
# print(io, "<img src=\"data:image/png;base64,", base64(show, MIME("image/png"), plt), "\" />")
|
||||
# end
|
||||
# elseif fmt == "svg"
|
||||
# @eval function Base.writemime(io::IO, ::MIME"text/html", plt::Plot)
|
||||
# writemime(io, MIME("image/svg+xml"), plt)
|
||||
# @eval function Base.show(io::IO, ::MIME"text/html", plt::Plot)
|
||||
# show(io, MIME("image/svg+xml"), plt)
|
||||
# end
|
||||
# else
|
||||
# error("only png or svg allowed. got: $fmt")
|
||||
@@ -210,7 +222,7 @@ end
|
||||
# IJulia
|
||||
# ---------------------------------------------------------
|
||||
|
||||
const _ijulia_output = Compat.ASCIIString["text/html"]
|
||||
const _ijulia_output = String["text/html"]
|
||||
|
||||
function setup_ijulia()
|
||||
# override IJulia inline display
|
||||
@@ -225,12 +237,12 @@ function setup_ijulia()
|
||||
end
|
||||
function IJulia.display_dict(plt::Plot)
|
||||
global _ijulia_output
|
||||
Dict{Compat.ASCIIString, ByteString}(_ijulia_output[1] => sprint(writemime, _ijulia_output[1], plt))
|
||||
Dict{String, String}(_ijulia_output[1] => sprint(show, _ijulia_output[1], plt))
|
||||
end
|
||||
|
||||
# default text/plain passes to html... handles Interact issues
|
||||
function Base.writemime(io::IO, m::MIME"text/plain", plt::Plot)
|
||||
writemime(io, MIME("text/html"), plt)
|
||||
function Base.show(io::IO, m::MIME"text/plain", plt::Plot)
|
||||
show(io, MIME("text/html"), plt)
|
||||
end
|
||||
end
|
||||
set_ijulia_output("text/html")
|
||||
@@ -242,35 +254,48 @@ end
|
||||
# ---------------------------------------------------------
|
||||
|
||||
function setup_atom()
|
||||
# @require Atom begin
|
||||
if isatom() && get(ENV, "PLOTS_USE_ATOM_PLOTPANE", false) in (true, 1, "1", "true", "yes")
|
||||
# @eval import Atom, Media
|
||||
@eval import Atom
|
||||
if isatom()
|
||||
@eval import Atom, Media
|
||||
Media.media(Plot, Media.Plot)
|
||||
|
||||
# # connects the render function
|
||||
# for T in (GadflyBackend,ImmerseBackend,PyPlotBackend,GRBackend)
|
||||
# Atom.Media.media(Plot{T}, Atom.Media.Plot)
|
||||
# end
|
||||
Atom.Media.media(Plot, Atom.Media.Graphical)
|
||||
# Atom.Media.media{T <: Union{GadflyBackend,ImmerseBackend,PyPlotBackend,GRBackend}}(Plot{T}, Atom.Media.Plot)
|
||||
|
||||
# Atom.displaysize(::Plot) = (535, 379)
|
||||
# Atom.displaytitle(plt::Plot) = "Plots.jl (backend: $(backend(plt)))"
|
||||
|
||||
# this is like "display"... sends an html div with the plot to the PlotPane
|
||||
function Atom.Media.render(pane::Atom.PlotPane, plt::Plot)
|
||||
@show "here"
|
||||
Atom.Media.render(pane, Atom.div(Atom.d(), Atom.HTML(stringmime(MIME("text/html"), plt))))
|
||||
# default text/plain so it doesn't complain
|
||||
function Base.show{B}(io::IO, ::MIME"text/plain", plt::Plot{B})
|
||||
print(io, "Plot{$B}()")
|
||||
end
|
||||
|
||||
# # force text/plain to output to the PlotPane
|
||||
# function Base.writemime(io::IO, ::MIME"text/plain", plt::Plot)
|
||||
# # writemime(io::IO, MIME("text/html"), plt)
|
||||
# Atom.Media.render(pane)
|
||||
# end
|
||||
function Media.render(e::Atom.Editor, plt::Plot)
|
||||
Media.render(e, nothing)
|
||||
end
|
||||
|
||||
# function Atom.Media.render(pane::Atom.PlotPane, plt::Plot{PlotlyBackend})
|
||||
# html = Media.render(pane, Atom.div(Atom.d(), Atom.HTML(stringmime(MIME("text/html"), plt))))
|
||||
# end
|
||||
if get(ENV, "PLOTS_USE_ATOM_PLOTPANE", true) in (true, 1, "1", "true", "yes")
|
||||
# this is like "display"... sends an html div with the plot to the PlotPane
|
||||
function Media.render(pane::Atom.PlotPane, plt::Plot)
|
||||
# temporarily overwrite size to be Atom.plotsize
|
||||
sz = plt[:size]
|
||||
plt[:size] = Juno.plotsize()
|
||||
Media.render(pane, Atom.div(".fill", Atom.HTML(stringmime(MIME("text/html"), plt))))
|
||||
plt[:size] = sz
|
||||
end
|
||||
else
|
||||
#
|
||||
function Media.render(pane::Atom.PlotPane, plt::Plot)
|
||||
display(Plots.PlotsDisplay(), plt)
|
||||
s = "PlotPane turned off. Unset ENV[\"PLOTS_USE_ATOM_PLOTPANE\"] and restart Julia to enable it."
|
||||
Media.render(pane, Atom.div(Atom.HTML(s)))
|
||||
end
|
||||
end
|
||||
|
||||
# special handling for plotly... use PlotsDisplay
|
||||
function Media.render(pane::Atom.PlotPane, plt::Plot{PlotlyBackend})
|
||||
display(Plots.PlotsDisplay(), plt)
|
||||
s = "PlotPane turned off. The plotly and plotlyjs backends cannot render in the PlotPane due to javascript issues."
|
||||
Media.render(pane, Atom.div(Atom.HTML(s)))
|
||||
end
|
||||
|
||||
# special handling for PlotlyJS to pass through to that render method
|
||||
function Media.render(pane::Atom.PlotPane, plt::Plot{PlotlyJSBackend})
|
||||
Plots.prepare_output(plt)
|
||||
Media.render(pane, plt.o)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+14
-6
@@ -13,7 +13,7 @@ function _expand_seriestype_array(d::KW, args)
|
||||
delete!(d, :seriestype)
|
||||
RecipeData[begin
|
||||
dc = copy(d)
|
||||
dc[:seriestype] = sts[r,:]
|
||||
dc[:seriestype] = sts[r:r,:]
|
||||
RecipeData(dc, args)
|
||||
end for r=1:size(sts,1)]
|
||||
else
|
||||
@@ -95,6 +95,7 @@ function _process_userrecipe(plt::Plot, kw_list::Vector{KW}, recipedata::RecipeD
|
||||
# when the arg tuple is empty, that means there's nothing left to recursively
|
||||
# process... finish up and add to the kw_list
|
||||
kw = recipedata.d
|
||||
preprocessArgs!(kw)
|
||||
_preprocess_userrecipe(kw)
|
||||
warnOnUnsupported_scales(plt.backend, kw)
|
||||
|
||||
@@ -183,6 +184,7 @@ function _process_plotrecipe(plt::Plot, kw::KW, kw_list::Vector{KW}, still_to_pr
|
||||
st = kw[:seriestype] = get(_typeAliases, st, st)
|
||||
datalist = RecipesBase.apply_recipe(kw, Val{st}, plt)
|
||||
for data in datalist
|
||||
preprocessArgs!(data.d)
|
||||
if data.d[:seriestype] == st
|
||||
error("Plot recipe $st returned the same seriestype: $(data.d)")
|
||||
end
|
||||
@@ -242,12 +244,13 @@ function _plot_setup(plt::Plot, d::KW, kw_list::Vector{KW})
|
||||
end
|
||||
sp = Subplot(backend(), parent=parent)
|
||||
sp.plt = plt
|
||||
sp.attr[:relative_bbox] = bb
|
||||
sp.attr[:subplot_index] = length(plt.subplots)
|
||||
push!(plt.subplots, sp)
|
||||
push!(plt.inset_subplots, sp)
|
||||
sp.attr[:relative_bbox] = bb
|
||||
sp.attr[:subplot_index] = length(plt.subplots)
|
||||
end
|
||||
end
|
||||
plt[:inset_subplots] = nothing
|
||||
end
|
||||
|
||||
function _subplot_setup(plt::Plot, d::KW, kw_list::Vector{KW})
|
||||
@@ -352,11 +355,12 @@ function _expand_subplot_extrema(sp::Subplot, d::KW, st::Symbol)
|
||||
end
|
||||
end
|
||||
|
||||
function _add_the_series(plt, d)
|
||||
function _add_the_series(plt, sp, d)
|
||||
warnOnUnsupported_args(plt.backend, d)
|
||||
warnOnUnsupported(plt.backend, d)
|
||||
series = Series(d)
|
||||
push!(plt.series_list, series)
|
||||
push!(sp.series_list, series)
|
||||
_series_added(plt, series)
|
||||
end
|
||||
|
||||
@@ -375,11 +379,11 @@ function _process_seriesrecipe(plt::Plot, d::KW)
|
||||
end
|
||||
|
||||
# if it's natively supported, finalize processing and pass along to the backend, otherwise recurse
|
||||
if st in supported_types()
|
||||
if is_seriestype_supported(st)
|
||||
sp = _prepare_subplot(plt, d)
|
||||
_prepare_annotations(sp, d)
|
||||
_expand_subplot_extrema(sp, d, st)
|
||||
_add_the_series(plt, d)
|
||||
_add_the_series(plt, sp, d)
|
||||
|
||||
else
|
||||
# get a sub list of series for this seriestype
|
||||
@@ -388,6 +392,10 @@ function _process_seriesrecipe(plt::Plot, d::KW)
|
||||
# assuming there was no error, recursively apply the series recipes
|
||||
for data in datalist
|
||||
if isa(data, RecipeData)
|
||||
preprocessArgs!(data.d)
|
||||
if data.d[:seriestype] == st
|
||||
error("The seriestype didn't change in series recipe $st. This will cause a StackOverflow.")
|
||||
end
|
||||
_process_seriesrecipe(plt, data.d)
|
||||
else
|
||||
warn("Unhandled recipe: $(data)")
|
||||
|
||||
+28
-3
@@ -89,8 +89,16 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...)
|
||||
plt.o = _create_backend_figure(plt)
|
||||
plt.init = true
|
||||
|
||||
series_attr = KW()
|
||||
for (k,v) in d
|
||||
if haskey(_series_defaults, k)
|
||||
series_attr[k] = pop!(d,k)
|
||||
end
|
||||
end
|
||||
|
||||
# create the layout and initialize the subplots
|
||||
plt.layout, plt.subplots, plt.spmap = build_layout(layout, num_sp, copy(plts))
|
||||
cmdidx = 1
|
||||
for (idx, sp) in enumerate(plt.subplots)
|
||||
_initialize_subplot(plt, sp)
|
||||
serieslist = series_list(sp)
|
||||
@@ -100,8 +108,11 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...)
|
||||
sp.plt = plt
|
||||
sp.attr[:subplot_index] = idx
|
||||
for series in serieslist
|
||||
merge!(series.d, series_attr)
|
||||
_add_defaults!(series.d, plt, sp, cmdidx)
|
||||
push!(plt.series_list, series)
|
||||
_series_added(plt, series)
|
||||
cmdidx += 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -148,7 +159,12 @@ end
|
||||
# a list of series KW dicts.
|
||||
# note: at entry, we only have those preprocessed args which were passed in... no default values yet
|
||||
function _plot!(plt::Plot, d::KW, args::Tuple)
|
||||
# d[:plot_object] = plt
|
||||
d[:plot_object] = plt
|
||||
|
||||
if !isempty(args) && !isdefined(Main, :StatPlots) &&
|
||||
first(split(string(typeof(args[1])), ".")) == "DataFrames"
|
||||
warn("You're trying to plot a DataFrame, but this functionality is provided by StatPlots")
|
||||
end
|
||||
|
||||
# --------------------------------
|
||||
# "USER RECIPES"
|
||||
@@ -156,6 +172,9 @@ function _plot!(plt::Plot, d::KW, args::Tuple)
|
||||
|
||||
kw_list = _process_userrecipes(plt, d, args)
|
||||
|
||||
# info(1)
|
||||
# map(DD, kw_list)
|
||||
|
||||
|
||||
# --------------------------------
|
||||
# "PLOT RECIPES"
|
||||
@@ -172,6 +191,9 @@ function _plot!(plt::Plot, d::KW, args::Tuple)
|
||||
_process_plotrecipe(plt, next_kw, kw_list, still_to_process)
|
||||
end
|
||||
|
||||
# info(2)
|
||||
# map(DD, kw_list)
|
||||
|
||||
# --------------------------------
|
||||
# Plot/Subplot/Layout setup
|
||||
# --------------------------------
|
||||
@@ -184,7 +206,10 @@ function _plot!(plt::Plot, d::KW, args::Tuple)
|
||||
# --------------------------------
|
||||
# "SERIES RECIPES"
|
||||
# --------------------------------
|
||||
|
||||
|
||||
# info(3)
|
||||
# map(DD, kw_list)
|
||||
|
||||
for kw in kw_list
|
||||
sp::Subplot = kw[:subplot]
|
||||
# idx = get_subplot_index(plt, sp)
|
||||
@@ -242,7 +267,7 @@ function prepare_output(plt::Plot)
|
||||
_update_plot_object(plt)
|
||||
end
|
||||
|
||||
function prepared_object(plt::Plot)
|
||||
function backend_object(plt::Plot)
|
||||
prepare_output(plt)
|
||||
plt.o
|
||||
end
|
||||
|
||||
@@ -1,468 +1,3 @@
|
||||
function _precompile_()
|
||||
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
|
||||
precompile(Plots.py_add_series, (Plots.Plot{Plots.PyPlotBackend}, Plots.Series,))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Float64, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Base.StepRange{Int64, Int64},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Function,))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Plots.OHLC, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Float64, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Base.LinSpace{Float64},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, DataFrames.DataFrame,))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Int64, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Union{UTF8String, ASCIIString}, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Function, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{ASCIIString, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Base.FloatRange{Float64},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any}, Array{Float64, 1},))
|
||||
precompile(Plots._plot!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Array{Float64, 2},))
|
||||
precompile(Plots._add_defaults!, (Base.Dict{Symbol, Any}, Plots.Plot{Plots.UnicodePlotsBackend}, Plots.Subplot{Plots.UnicodePlotsBackend}, Int64,))
|
||||
precompile(Plots._before_layout_calcs, (Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots._apply_series_recipe, (Plots.Plot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._add_defaults!, (Base.Dict{Symbol, Any}, Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend}, Int64,))
|
||||
precompile(Plots._apply_series_recipe, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.setup_ijulia, ())
|
||||
precompile(Plots.call, (Type{Plots.Plot{Plots.UnicodePlotsBackend}}, Plots.UnicodePlotsBackend, Int64, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Array{Plots.Series, 1}, Void, Array{Plots.Subplot, 1}, Base.Dict{Any, Plots.Subplot}, Plots.EmptyLayout, Array{Plots.Subplot, 1}, Bool,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Subplot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.create_grid_vcat, (Expr,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Subplot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.update_child_bboxes!, (Plots.GridLayout, Array{Measures.Length{:mm, Float64}, 1},))
|
||||
precompile(Plots.preprocessArgs!, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.call, (Type{Plots.Plot{Plots.PyPlotBackend}}, Plots.PyPlotBackend, Int64, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Array{Plots.Series, 1}, Void, Array{Plots.Subplot, 1}, Base.Dict{Any, Plots.Subplot}, Plots.EmptyLayout, Array{Plots.Subplot, 1}, Bool,))
|
||||
precompile(Plots.fix_xy_lengths!, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._update_min_padding!, (Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.warnOnUnsupported_args, (Plots.PyPlotBackend, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.build_layout, (Plots.GridLayout, Int64,))
|
||||
precompile(Plots.build_layout, (Plots.GridLayout, Int64, Array{Plots.Plot, 1},))
|
||||
precompile(Plots.warnOnUnsupported, (Plots.UnicodePlotsBackend, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.link_axes!, (Plots.GridLayout, Symbol,))
|
||||
precompile(Plots.warnOnUnsupported, (Plots.PyPlotBackend, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._update_plot_args, (Plots.Plot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.font, (Int64,))
|
||||
precompile(Plots.recompute_lengths, (Array{Measures.Measure, 1},))
|
||||
precompile(Plots._update_plot_object, (Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.font, (Symbol,))
|
||||
precompile(Plots.create_grid, (Expr,))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Void, Int64,))
|
||||
precompile(Plots.pickDefaultBackend, ())
|
||||
precompile(Plots.default_should_widen, (Plots.Axis,))
|
||||
precompile(Plots.setup_atom, ())
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Symbol, Int64,))
|
||||
precompile(Plots.my_hist_2d, (Array{Any, 1}, Array{Float64, 1}, Array{Float64, 1}, Int64,))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, ASCIIString, Int64,))
|
||||
precompile(Plots.create_grid_curly, (Expr,))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Bool, Int64,))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Int64, Int64,))
|
||||
precompile(Plots.my_hist, (Array{Any, 1}, Array{Float64, 1}, Int64,))
|
||||
precompile(Plots.getpctrange, (Int64,))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{Symbol, 1},))
|
||||
precompile(Plots.default, (Symbol,))
|
||||
precompile(Plots.process_axis_arg!, (Base.Dict{Symbol, Any}, Symbol, Symbol,))
|
||||
precompile(Plots.pie_labels, (Plots.Subplot{Plots.PyPlotBackend}, Plots.Series,))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Measures.Length{:mm, Float64}, Int64,))
|
||||
precompile(Plots.py_path, (Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots._update_min_padding!, (Plots.GridLayout,))
|
||||
precompile(Plots.warnOnUnsupported_scales, (Plots.UnicodePlotsBackend, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Plots.Font, Int64,))
|
||||
precompile(Plots.process_axis_arg!, (Base.Dict{Symbol, Any}, Tuple{Int64, Int64}, Symbol,))
|
||||
precompile(Plots.slice_arg!, (Array{Any, 1}, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Symbol, Array{Any, 1}, Int64,))
|
||||
precompile(Plots.default, (Symbol, Tuple{Int64, Int64},))
|
||||
precompile(Plots.warnOnUnsupported_scales, (Plots.PyPlotBackend, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.axis_limits, (Plots.Axis, Bool,))
|
||||
precompile(Plots.default, (Symbol, Bool,))
|
||||
precompile(Plots.getColorZ, (Plots.ColorGradient, Float64,))
|
||||
precompile(Plots._update_plot_args, (Plots.Plot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.call, (Type{Plots.Surface}, Function, Base.FloatRange{Float64}, Base.FloatRange{Float64},))
|
||||
precompile(Plots.font, (Symbol,))
|
||||
precompile(Plots.process_axis_arg!, (Base.Dict{Symbol, Any}, Base.StepRange{Int64, Int64}, Symbol,))
|
||||
precompile(Plots.call, (Array{Any, 1}, Type{Plots.Subplot}, Plots.UnicodePlotsBackend,))
|
||||
precompile(Plots.extractGroupArgs, (Array{ASCIIString, 1}, Array{Float64, 1},))
|
||||
precompile(Plots._update_subplot_args, (Array{Any, 1}, Plots.Plot{Plots.UnicodePlotsBackend}, Plots.Subplot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.call, (Array{Any, 1}, Type{Plots.Subplot}, Plots.PyPlotBackend,))
|
||||
precompile(Plots._update_subplot_args, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.extractGroupArgs, (Array{Union{UTF8String, ASCIIString}, 1},))
|
||||
precompile(Plots.bbox_to_pcts, (Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}}, Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}, Bool,))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.py_marker, (Plots.Shape,))
|
||||
precompile(Plots.getindex, (Plots.Subplot{Plots.UnicodePlotsBackend}, Symbol,))
|
||||
precompile(Plots.getindex, (Plots.Subplot{Plots.PyPlotBackend}, Symbol,))
|
||||
precompile(Plots.discrete_value!, (Plots.Axis, Array{Union{UTF8String, ASCIIString}, 1},))
|
||||
precompile(Plots.prepare_output, (Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.update_inset_bboxes!, (Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.add_layout_pct!, (Base.Dict{Symbol, Any}, Expr, Int64, Int64,))
|
||||
precompile(Plots.process_axis_arg!, (Base.Dict{Symbol, Any}, ASCIIString, Symbol,))
|
||||
precompile(Plots.call, (Type{Plots.Shape}, Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Base.LinSpace{Float64}, Array{Float64, 2},))
|
||||
precompile(Plots.call, (Array{Any, 1}, Type{Plots.EmptyLayout}, Plots.RootLayout,))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Function, Function,))
|
||||
precompile(Plots.should_add_to_legend, (Plots.Series,))
|
||||
precompile(Plots.plot, (Array{Any, 1}, DataFrames.DataFrame, Symbol,))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Plots.OHLC, 1},))
|
||||
precompile(Plots.convertToAnyVector, (Array{Float64, 2}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{ASCIIString, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend}, Array{Float64, 1},))
|
||||
precompile(Plots.processLineArg, (Base.Dict{Symbol, Any}, Symbol,))
|
||||
precompile(Plots.aliasesAndAutopick, (Base.Dict{Symbol, Any}, Symbol, Base.Dict{Symbol, Any}, Array{Symbol, 1}, Int64,))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend}, Array{Int64, 1},))
|
||||
precompile(Plots.pie, (Array{Any, 1}, Array{ASCIIString, 1},))
|
||||
precompile(Plots.aliasesAndAutopick, (Base.Dict{Symbol, Any}, Symbol, Base.Dict{Symbol, Any}, Array{Any, 1}, Int64,))
|
||||
precompile(Plots.merge_with_base_supported, (Array{Symbol, 1},))
|
||||
precompile(Plots.histogram2d, (Array{Any, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Base.StepRange{Int64, Int64}, Array{Float64, 2},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Base.LinSpace{Float64}, Array{Float64, 1},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.font, ())
|
||||
precompile(Plots.plot, (Array{Any, 1}, Base.FloatRange{Float64}, Array{Float64, 1},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Base.FloatRange{Float64}, Base.FloatRange{Float64},))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Function, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.scatter, (Array{Any, 1}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Base.LinSpace{Float64}, Array{Float64, 1},))
|
||||
precompile(Plots.get_zvalues, (Int64,))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Union{UTF8String, ASCIIString}, 1}, Array{Union{UTF8String, ASCIIString}, 1},))
|
||||
precompile(Plots.histogram, (Array{Any, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.hline!, (Array{Any, 1}, Array{Float64, 2},))
|
||||
precompile(Plots.layout_args, (Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.heatmap, (Array{Any, 1}, Array{Union{UTF8String, ASCIIString}, 1},))
|
||||
precompile(Plots._replace_linewidth, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend}, Array{Float64, 2},))
|
||||
precompile(Plots.py_markercolor, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.unzip, (Array{Tuple{Float64, Float64}, 1},))
|
||||
precompile(Plots.link_axes!, (Array{Plots.AbstractLayout, 2}, Symbol,))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend}, Array{Float64, 1},))
|
||||
precompile(Plots.contour, (Array{Any, 1}, Base.FloatRange{Float64},))
|
||||
precompile(Plots.scatter, (Array{Any, 1}, DataFrames.DataFrame,))
|
||||
precompile(Plots.scatter!, (Array{Any, 1}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.scatter!, (Array{Any, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.getxy, (Plots.Plot{Plots.PyPlotBackend}, Int64,))
|
||||
precompile(Plots.plot, (Array{Any, 1}, Array{Float64, 2},))
|
||||
precompile(Plots.get_xy, (Array{Plots.OHLC, 1}, Base.UnitRange{Int64},))
|
||||
precompile(Plots.convertToAnyVector, (Array{Function, 1}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.py_add_annotations, (Plots.Subplot{Plots.PyPlotBackend}, Int64, Float64, Plots.PlotText,))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.get_color_palette, (Symbol, ColorTypes.RGB{Float64}, Int64,))
|
||||
precompile(Plots.py_add_annotations, (Plots.Subplot{Plots.PyPlotBackend}, Float64, Float64, Plots.PlotText,))
|
||||
precompile(Plots.py_colormap, (Plots.ColorGradient, Float64,))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, Plots.Stroke,))
|
||||
precompile(Plots.call, (Type{Plots.ColorVector}, Array{Symbol, 1},))
|
||||
precompile(Plots.py_colormap, (Plots.ColorGradient, Void,))
|
||||
precompile(Plots.py_fillcolor, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.processLineArg, (Base.Dict{Symbol, Any}, Float64,))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Array{Float64, 2},))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, Symbol,))
|
||||
precompile(Plots.call, (Type{Plots.Plot},))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{ColorTypes.RGBA{Float64}, 1},))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Array{Int64, 1},))
|
||||
precompile(Plots.getExtension, (UTF8String,))
|
||||
precompile(Plots.call, (Array{Any, 1}, Type{Plots.EmptyLayout},))
|
||||
precompile(Plots.update!, (Array{Any, 1}, Plots.Axis,))
|
||||
precompile(Plots.frame, (Plots.Animation, Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.link_axes!, (Array{Plots.AbstractLayout, 1}, Symbol,))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{ColorTypes.RGB{Float64}, 1},))
|
||||
precompile(Plots.fakedata, (Int64,))
|
||||
precompile(Plots.plot!, (Array{Any, 1}, Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.py_compute_axis_minval, (Plots.Axis,))
|
||||
precompile(Plots.processLineArg, (Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.command_idx, (Array{Base.Dict{Symbol, Any}, 1}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.getindex, (Plots.Axis, Symbol,))
|
||||
precompile(Plots.__init__, ())
|
||||
precompile(Plots.isvertical, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.getExtension, (ASCIIString,))
|
||||
precompile(Plots.py_marker, (Symbol,))
|
||||
precompile(Plots.py_init_subplot, (Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, ColorTypes.RGBA{Float64},))
|
||||
precompile(Plots.bucket_index, (Float64, Base.LinSpace{Float64},))
|
||||
precompile(Plots.default, (Array{Any, 1},))
|
||||
precompile(Plots.filter_data!, (Base.Dict{Symbol, Any}, Array{Int64, 1},))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{Symbol, 1}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.slice_arg, (Array{Symbol, 2}, Int64,))
|
||||
precompile(Plots.getindex, (Plots.Plot{Plots.UnicodePlotsBackend}, Symbol,))
|
||||
precompile(Plots.plot!, (Array{Any, 1},))
|
||||
precompile(Plots.push!, (Plots.Plot{Plots.PyPlotBackend}, Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, Float64,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Base.FloatRange{Float64},))
|
||||
precompile(Plots.getindex, (Plots.Plot{Plots.PyPlotBackend}, Symbol,))
|
||||
precompile(Plots.handle_dfs, (DataFrames.DataFrame, Base.Dict{Symbol, Any}, ASCIIString, Symbol,))
|
||||
precompile(Plots.filter_data, (Base.UnitRange{Int64}, Array{Int64, 1},))
|
||||
precompile(Plots.call, (Type{Plots.ColorWrapper}, ColorTypes.RGBA{Float64},))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, Array{Symbol, 2},))
|
||||
precompile(Plots.processLineArg, (Base.Dict{Symbol, Any}, Array{Symbol, 2},))
|
||||
precompile(Plots.color_or_nothing!, (Base.Dict{Symbol, Any}, Symbol,))
|
||||
precompile(Plots.processMarkerArg, (Base.Dict{Symbol, Any}, Plots.Shape,))
|
||||
precompile(Plots.py_fillcolormap, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.transpose_z, (Base.Dict{Symbol, Any}, Array{Float64, 2}, Bool,))
|
||||
precompile(Plots.py_linecolor, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.call, (Type{Plots.OHLC}, Float64, Float64, Float64, Float64,))
|
||||
precompile(Plots.setxy!, (Plots.Plot{Plots.PyPlotBackend}, Tuple{Array{Float64, 1}, Array{Float64, 1}}, Int64,))
|
||||
precompile(Plots.push!, (Plots.Segments, Float64, Float64, Float64, Float64,))
|
||||
precompile(Plots.handle_group, (DataFrames.DataFrame, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.lightness_from_background, (ColorTypes.RGB{Float64},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Base.LinSpace{Float64},))
|
||||
precompile(Plots.py_bbox, (Array{Any, 1},))
|
||||
precompile(Plots.py_markerstrokecolor, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.arrow, ())
|
||||
precompile(Plots.convert, (Type{Array{Float64, 1}}, Base.StepRange{Int64, Int64},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Array{Float64, 1},))
|
||||
precompile(Plots.convertLegendValue, (Symbol,))
|
||||
precompile(Plots.slice_arg, (Array{Measures.Length{:mm, Float64}, 2}, Int64,))
|
||||
precompile(Plots.calc_num_subplots, (Plots.GridLayout,))
|
||||
precompile(Plots.processFillArg, (Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.slice_arg, (Array{Plots.ColorWrapper, 2}, Int64,))
|
||||
precompile(Plots.slice_arg, (Array{ASCIIString, 2}, Int64,))
|
||||
precompile(Plots.filter_data, (Array{Float64, 1}, Array{Int64, 1},))
|
||||
precompile(Plots.py_linecolormap, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.discrete_value!, (Plots.Axis, ASCIIString,))
|
||||
precompile(Plots.allShapes, (ColorTypes.RGBA{Float64},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Array{Int64, 1},))
|
||||
precompile(Plots.py_color_fix, (Tuple{Float64, Float64, Float64, Float64}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.discrete_value!, (Plots.Axis, Symbol,))
|
||||
precompile(Plots.push!, (Plots.Segments, Float64, Int64, Int64, Float64,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Plots.Surface{Array{Float64, 2}},))
|
||||
precompile(Plots.heatmap_edges, (Array{Float64, 1},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Base.StepRange{Int64, Int64},))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Plots.Shape, Symbol,))
|
||||
precompile(Plots.py_color, (Plots.ColorWrapper, Float64,))
|
||||
precompile(Plots.call, (Type{Plots.GridLayout}, Int64, Int64,))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, ColorTypes.RGBA{Float64}, Symbol,))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Bool, Symbol,))
|
||||
precompile(Plots.hvline_limits, (Plots.Axis,))
|
||||
precompile(Plots.current, ())
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Float64, Symbol,))
|
||||
precompile(Plots.compute_gridsize, (Int64, Int64, Int64,))
|
||||
precompile(Plots.py_color, (ColorTypes.RGB{Float64}, Void,))
|
||||
precompile(Plots.interpolate_rgb, (ColorTypes.RGBA{Float64}, ColorTypes.RGBA{Float64}, Float64,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Base.UnitRange{Int64},))
|
||||
precompile(Plots.allShapes, (Float64,))
|
||||
precompile(Plots.warn_on_deprecated_backend, (Symbol,))
|
||||
precompile(Plots.py_color_fix, (Tuple{Float64, Float64, Float64, Float64}, Array{Int64, 1},))
|
||||
precompile(Plots.setindex!, (Plots.GridLayout, Plots.EmptyLayout, Int64, Int64,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Tuple{Int64, Int64},))
|
||||
precompile(Plots.allShapes, (Int64,))
|
||||
precompile(Plots.py_markercolormap, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.interpolate_rgb, (ColorTypes.RGB{Float64}, ColorTypes.RGB{Float64}, Float64,))
|
||||
precompile(Plots.get_ticks, (Plots.Axis,))
|
||||
precompile(Plots.backend, ())
|
||||
precompile(Plots.get_xy, (Plots.OHLC{Float64}, Int64, Float64,))
|
||||
precompile(Plots.allShapes, (Plots.Stroke,))
|
||||
precompile(Plots.replaceAliases!, (Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._create_backend_figure, (Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.png, (Plots.Plot{Plots.PyPlotBackend}, UTF8String,))
|
||||
precompile(Plots.processFillArg, (Base.Dict{Symbol, Any}, Symbol,))
|
||||
precompile(Plots.allShapes, (Plots.Shape,))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Plots.Stroke, Symbol,))
|
||||
precompile(Plots.py_color_fix, (Tuple{Float64, Float64, Float64, Float64}, Array{Float64, 1},))
|
||||
precompile(Plots.plot, (Array{Float64, 1},))
|
||||
precompile(Plots.rowsize, (Expr,))
|
||||
precompile(Plots.get_axis, (Plots.Subplot{Plots.PyPlotBackend}, Symbol,))
|
||||
precompile(Plots.png, (Plots.Plot{Plots.PyPlotBackend}, ASCIIString,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Tuple{Float64, Float64},))
|
||||
precompile(Plots._markershape_supported, (Plots.PyPlotBackend, Plots.Shape,))
|
||||
precompile(Plots.processFillArg, (Base.Dict{Symbol, Any}, Bool,))
|
||||
precompile(Plots.supported_types, (Plots.PyPlotBackend,))
|
||||
precompile(Plots.get_axis, (Plots.Subplot{Plots.UnicodePlotsBackend}, Symbol,))
|
||||
precompile(Plots.setindex!, (Plots.GridLayout, Plots.GridLayout, Int64, Int64,))
|
||||
precompile(Plots.plot, ())
|
||||
precompile(Plots.py_color_fix, (Tuple{Float64, Float64, Float64, Float64}, Base.FloatRange{Float64},))
|
||||
precompile(Plots._markershape_supported, (Plots.PyPlotBackend, Symbol,))
|
||||
precompile(Plots.ok, (Float64, Float64, Int64,))
|
||||
precompile(Plots.allShapes, (Symbol,))
|
||||
precompile(Plots._initialize_backend, (Plots.PyPlotBackend,))
|
||||
precompile(Plots.plot, (Plots.Plot{Plots.PyPlotBackend}, Plots.Plot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.bar, (Array{Float64, 1},))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{ColorTypes.RGBA{Float64}, 1}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Int64, Symbol,))
|
||||
precompile(Plots.nanappend!, (Array{Float64, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.autopick, (Array{ColorTypes.RGBA, 1}, Int64,))
|
||||
precompile(Plots.compute_xyz, (Void, Array{Int64, 1}, Void,))
|
||||
precompile(Plots._add_markershape, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots._backend_instance, (Symbol,))
|
||||
precompile(Plots.py_color, (ColorTypes.RGBA{Float64}, Float64,))
|
||||
precompile(Plots.update_child_bboxes!, (Plots.GridLayout,))
|
||||
precompile(Plots._replace_markershape, (Symbol,))
|
||||
precompile(Plots.has_black_border_for_default, (Symbol,))
|
||||
precompile(Plots._filter_input_data!, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.compute_xyz, (Array{Float64, 1}, Array{Float64, 1}, Base.UnitRange{Int64},))
|
||||
precompile(Plots.text, (ASCIIString, Int64, Symbol,))
|
||||
precompile(Plots.allShapes, (Array{Symbol, 2},))
|
||||
precompile(Plots.py_color_fix, (Tuple{Float64, Float64, Float64, Float64}, Base.UnitRange{Int64},))
|
||||
precompile(Plots.replaceAlias!, (Base.Dict{Symbol, Any}, Symbol, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.compute_xyz, (Array{ASCIIString, 1}, Array{Float64, 1}, Void,))
|
||||
precompile(Plots.layout_args, (Int64,))
|
||||
precompile(Plots.text, (ASCIIString, Symbol, Int64,))
|
||||
precompile(Plots.compute_xyz, (Base.FloatRange{Float64}, Base.FloatRange{Float64}, Plots.Surface{Array{Float64, 2}},))
|
||||
precompile(Plots.all3D, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.cycle, (Array{Plots.Subplot, 1}, Int64,))
|
||||
precompile(Plots.compute_xyz, (Base.StepRange{Int64, Int64}, Array{Float64, 1}, Void,))
|
||||
precompile(Plots.plotarea!, (Plots.Subplot{Plots.PyPlotBackend}, Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.like_surface, (Symbol,))
|
||||
precompile(Plots.build_layout, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.compute_xyz, (Array{Union{UTF8String, ASCIIString}, 1}, Array{Union{UTF8String, ASCIIString}, 1}, Plots.Surface{Array{Float64, 2}},))
|
||||
precompile(Plots.py_linestyle, (Symbol, Symbol,))
|
||||
precompile(Plots.plot!, (Array{Float64, 2},))
|
||||
precompile(Plots.plot!, (Plots.Plot{Plots.PyPlotBackend}, Array{Float64, 2},))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{ColorTypes.RGB{Float64}, 1}, Base.LinSpace{Float64},))
|
||||
precompile(Plots.py_color, (ColorTypes.RGBA{Float64}, Void,))
|
||||
precompile(Plots.yaxis!, (ASCIIString, Symbol,))
|
||||
precompile(Plots.compute_xyz, (Base.LinSpace{Float64}, Array{Float64, 1}, Void,))
|
||||
precompile(Plots.isijulia, ())
|
||||
precompile(Plots.addExtension, (UTF8String, ASCIIString,))
|
||||
precompile(Plots.call, (Type{Plots.ColorGradient}, Array{ColorTypes.RGBA{Float64}, 1}, Array{Float64, 1},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Subplot{Plots.PyPlotBackend}, Float64, Float64, Float64, Float64,))
|
||||
precompile(Plots.plotarea!, (Plots.GridLayout, Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.layout_args, (Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.compute_xyz, (Base.FloatRange{Float64}, Array{Float64, 1}, Void,))
|
||||
precompile(Plots.addExtension, (ASCIIString, ASCIIString,))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Symbol, Symbol,))
|
||||
precompile(Plots._initialize_backend, (Plots.PlotlyBackend,))
|
||||
precompile(Plots.push!, (Plots.Plot{Plots.PyPlotBackend}, Int64, Float64, Float64,))
|
||||
precompile(Plots.bbox!, (Plots.Subplot{Plots.PyPlotBackend}, Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.vline!, (Array{Int64, 1},))
|
||||
precompile(Plots.supported_markers, (Plots.PyPlotBackend,))
|
||||
precompile(Plots.bbox!, (Plots.GridLayout, Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.stroke, (Int64,))
|
||||
precompile(Plots.compute_xyz, (Array{Float64, 1}, Array{Float64, 1}, Void,))
|
||||
precompile(Plots.right, (Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.extractGroupArgs, (Symbol, DataFrames.DataFrame, Symbol,))
|
||||
precompile(Plots.generate_colorgradient, (ColorTypes.RGB{Float64},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Extrema, Bool,))
|
||||
precompile(Plots.py_colormap, (Plots.ColorWrapper, Void,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Extrema, Float64,))
|
||||
precompile(Plots.contour, (Base.FloatRange{Float64},))
|
||||
precompile(Plots.bottom, (Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.text, (ASCIIString, Symbol,))
|
||||
precompile(Plots.create_grid, (Symbol,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Bool,))
|
||||
precompile(Plots.handleColors!, (Base.Dict{Symbol, Any}, Array{Symbol, 2}, Symbol,))
|
||||
precompile(Plots.convertToAnyVector, (Void, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.py_dpi_scale, (Plots.Plot{Plots.PyPlotBackend}, Int64,))
|
||||
precompile(Plots.png, (ASCIIString,))
|
||||
precompile(Plots.supported_scales, (Plots.PyPlotBackend,))
|
||||
precompile(Plots.convertColor, (ColorTypes.RGBA{Float64}, Float64,))
|
||||
precompile(Plots.extendSeriesData, (Array{Float64, 1}, Float64,))
|
||||
precompile(Plots.compute_xyz, (Void, Array{Float64, 1}, Void,))
|
||||
precompile(Plots.py_color, (Symbol,))
|
||||
precompile(Plots.expand_extrema!, (Plots.Extrema, Int64,))
|
||||
precompile(Plots.supported_styles, (Plots.PyPlotBackend,))
|
||||
precompile(Plots._initialize_backend, (Plots.UnicodePlotsBackend,))
|
||||
precompile(Plots._initialize_backend, (Plots.GRBackend,))
|
||||
precompile(Plots.is3d, (Symbol,))
|
||||
precompile(Plots.supported_types, (Plots.UnicodePlotsBackend,))
|
||||
precompile(Plots.compute_xyz, (Array{Float64, 1}, Function, Void,))
|
||||
precompile(Plots.py_color, (Symbol, Void,))
|
||||
precompile(Plots.trueOrAllTrue, (Function, Array{Symbol, 2},))
|
||||
precompile(Plots.typemin, (Measures.Length{:mm, Float64},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Float64,))
|
||||
precompile(Plots.get_subplot_index, (Plots.Plot{Plots.UnicodePlotsBackend}, Plots.Subplot{Plots.UnicodePlotsBackend},))
|
||||
precompile(Plots.leftpad, (Plots.GridLayout,))
|
||||
precompile(Plots._update_subplot_args, (Plots.Plot{Plots.UnicodePlotsBackend}, Plots.Subplot{Plots.UnicodePlotsBackend}, Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots.centers, (Base.LinSpace{Float64},))
|
||||
precompile(Plots.expand_extrema!, (Plots.Axis, Int64,))
|
||||
precompile(Plots.text, (ASCIIString,))
|
||||
precompile(Plots.convertColor, (ColorTypes.RGB{Float64},))
|
||||
precompile(Plots.py_color, (Plots.ColorWrapper, Void,))
|
||||
precompile(Plots.py_color, (Plots.ColorWrapper,))
|
||||
precompile(Plots.trueOrAllTrue, (Function, Int64,))
|
||||
precompile(Plots.convertColor, (ColorTypes.RGBA{Float64},))
|
||||
precompile(Plots.extrema, (Plots.Axis,))
|
||||
precompile(Plots.top, (Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.convertColor, (Symbol,))
|
||||
precompile(Plots.size, (Plots.Surface{Array{Float64, 2}},))
|
||||
precompile(Plots.isdark, (ColorTypes.RGB{Float64},))
|
||||
precompile(Plots.rowsize, (Symbol,))
|
||||
precompile(Plots.series_list, (Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.convertToAnyVector, (Array{Float64, 1}, Base.Dict{Symbol, Any},))
|
||||
precompile(Plots.update!, (Plots.Axis,))
|
||||
precompile(Plots.push!, (Plots.Plot{Plots.PyPlotBackend}, Float64, Array{Float64, 1},))
|
||||
precompile(Plots.wraptuple, (Bool,))
|
||||
precompile(Plots.call, (Type{Plots.Shape}, Array{Tuple{Float64, Float64}, 1},))
|
||||
precompile(Plots.slice_arg, (Base.StepRange{Int64, Int64}, Int64,))
|
||||
precompile(Plots.sticks_fillfrom, (Void, Int64,))
|
||||
precompile(Plots.left, (Measures.BoundingBox{Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}, Tuple{Measures.Length{:mm, Float64}, Measures.Length{:mm, Float64}}},))
|
||||
precompile(Plots.gr, ())
|
||||
precompile(Plots.leftpad, (Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.supported_markers, ())
|
||||
precompile(Plots.colorscheme, (Symbol,))
|
||||
precompile(Plots.convertColor, (ColorTypes.RGB{Float64}, Void,))
|
||||
precompile(Plots.isscalar, (Int64,))
|
||||
precompile(Plots.wraptuple, (Int64,))
|
||||
precompile(Plots.call, (Type{Plots.Plot}, Plots.UnicodePlotsBackend, Int64, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Array{Plots.Series, 1}, Void, Array{Plots.Subplot, 1}, Base.Dict{Any, Plots.Subplot}, Plots.EmptyLayout, Array{Plots.Subplot, 1}, Bool,))
|
||||
precompile(Plots.supported_styles, ())
|
||||
precompile(Plots.frame, (Plots.Animation,))
|
||||
precompile(Plots.toppad, (Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.link_axes!, (Plots.Subplot{Plots.UnicodePlotsBackend}, Symbol,))
|
||||
precompile(Plots.convertLegendValue, (Bool,))
|
||||
precompile(Plots.convertColor, (ColorTypes.RGBA{Float64}, Void,))
|
||||
precompile(Plots.plotly, ())
|
||||
precompile(Plots.ispositive, (Measures.Length{:mm, Float64},))
|
||||
precompile(Plots.rightpad, (Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.call, (Type{Plots.GroupBy}, Array{ASCIIString, 1}, Array{Array{Int64, 1}, 1},))
|
||||
precompile(Plots.px2inch, (Int64,))
|
||||
precompile(Plots.slice_arg, (Tuple{Int64, Int64}, Int64,))
|
||||
precompile(Plots.call, (Type{Plots.UnicodePlotsBackend},))
|
||||
precompile(Plots.trueOrAllTrue, (Function, Symbol,))
|
||||
precompile(Plots.bottompad, (Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.annotate!, (Array{Tuple{Int64, Float64, Plots.PlotText}, 1},))
|
||||
precompile(Plots.get_subplot_index, (Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.call, (Type{Plots.Plot}, Plots.PyPlotBackend, Int64, Base.Dict{Symbol, Any}, Base.Dict{Symbol, Any}, Array{Plots.Series, 1}, Void, Array{Plots.Subplot, 1}, Base.Dict{Any, Plots.Subplot}, Plots.EmptyLayout, Array{Plots.Subplot, 1}, Bool,))
|
||||
precompile(Plots.title!, (ASCIIString,))
|
||||
precompile(Plots.slice_arg, (Bool, Int64,))
|
||||
precompile(Plots.wraptuple, (Float64,))
|
||||
precompile(Plots.bottompad, (Plots.GridLayout,))
|
||||
precompile(Plots.py_stepstyle, (Symbol,))
|
||||
precompile(Plots.link_axes!, (Plots.Subplot{Plots.PyPlotBackend}, Symbol,))
|
||||
precompile(Plots.call, (Type{Plots.GRBackend},))
|
||||
precompile(Plots.unicodeplots, ())
|
||||
precompile(Plots.rightpad, (Plots.GridLayout,))
|
||||
precompile(Plots.call, (Type{Plots.PlotlyBackend},))
|
||||
precompile(Plots.py_color, (ColorTypes.RGBA{Float64},))
|
||||
precompile(Plots.toppad, (Plots.GridLayout,))
|
||||
precompile(Plots.calc_edges, (Array{Float64, 1}, Int64,))
|
||||
precompile(Plots.colorscheme, (ColorTypes.RGBA{Float64},))
|
||||
precompile(Plots.slice_arg, (Int64, Int64,))
|
||||
precompile(Plots.pyplot, ())
|
||||
precompile(Plots._update_subplot_args, (Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend}, Base.Dict{Symbol, Any}, Int64,))
|
||||
precompile(Plots._series_added, (Plots.Plot{Plots.PyPlotBackend}, Plots.Series,))
|
||||
precompile(Plots.get_color_palette, (Array{ColorTypes.RGBA, 1}, ColorTypes.RGB{Float64}, Int64,))
|
||||
precompile(Plots._initialize_subplot, (Plots.Plot{Plots.UnicodePlotsBackend}, Plots.Subplot{Plots.UnicodePlotsBackend},))
|
||||
precompile(Plots.slice_arg, (Void, Int64,))
|
||||
precompile(Plots.cycle, (Int64, Int64,))
|
||||
precompile(Plots._initialize_subplot, (Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.call, (Type{Plots.PyPlotBackend},))
|
||||
precompile(Plots.update_child_bboxes!, (Plots.Subplot{Plots.PyPlotBackend}, Array{Measures.Length{:mm, Float64}, 1},))
|
||||
precompile(Plots.filter_data, (Void, Array{Int64, 1},))
|
||||
precompile(Plots.slice_arg, (Symbol, Int64,))
|
||||
precompile(Plots.slice_arg, (ASCIIString, Int64,))
|
||||
precompile(Plots.layout_args, (Plots.GridLayout,))
|
||||
precompile(Plots.wraptuple, (Tuple{},))
|
||||
precompile(Plots.calc_num_subplots, (Plots.EmptyLayout,))
|
||||
precompile(Plots.wraptuple, (Tuple{Symbol, Float64, Plots.Stroke},))
|
||||
precompile(Plots.wraptuple, (Tuple{ASCIIString, Tuple{Int64, Int64}, Base.StepRange{Int64, Int64}, Symbol},))
|
||||
precompile(Plots.wraptuple, (Tuple{Int64, Symbol, Float64, Array{Symbol, 2}},))
|
||||
precompile(Plots.wraptuple, (Tuple{Int64, Array{Symbol, 2}},))
|
||||
precompile(Plots.wraptuple, (Tuple{ASCIIString, Symbol},))
|
||||
precompile(Plots._replace_markershape, (Array{Symbol, 2},))
|
||||
precompile(Plots.wraptuple, (Tuple{Symbol, Int64},))
|
||||
precompile(Plots.wraptuple, (Tuple{Array{Symbol, 2}, Int64},))
|
||||
precompile(Plots.wraptuple, (Tuple{Int64, Symbol, Symbol},))
|
||||
precompile(Plots.wraptuple, (Tuple{Int64, Float64, Symbol, Plots.Stroke},))
|
||||
precompile(Plots.wraptuple, (Tuple{Float64, Array{Symbol, 2}, Int64},))
|
||||
precompile(Plots.py_color, (ColorTypes.RGB{Float64},))
|
||||
precompile(Plots.wraptuple, (Tuple{Int64, Float64, Symbol},))
|
||||
precompile(Plots.tovec, (Array{Float64, 1},))
|
||||
precompile(Plots.get_subplot, (Plots.Plot{Plots.PyPlotBackend}, Plots.Subplot{Plots.PyPlotBackend},))
|
||||
precompile(Plots.eltype, (Plots.Surface{Array{Float64, 2}},))
|
||||
precompile(Plots.nobigs, (Array{Float64, 1},))
|
||||
precompile(Plots.get_subplot, (Plots.Plot{Plots.UnicodePlotsBackend}, Plots.Subplot{Plots.UnicodePlotsBackend},))
|
||||
precompile(Plots.annotations, (Array{Any, 1},))
|
||||
precompile(Plots.wraptuple, (Tuple{Int64, Symbol},))
|
||||
precompile(Plots.colorscheme, (Plots.ColorWrapper,))
|
||||
precompile(Plots.colorscheme, (Plots.ColorGradient,))
|
||||
precompile(Plots.text, (Plots.PlotText,))
|
||||
precompile(Plots._replace_markershape, (Plots.Shape,))
|
||||
precompile(Plots.wraptuple, (Tuple{Array{Symbol, 2}, Int64, Float64, Plots.Stroke},))
|
||||
precompile(Plots.wraptuple, (Tuple{Plots.Shape, Int64, ColorTypes.RGBA{Float64}},))
|
||||
end
|
||||
|
||||
+78
-236
@@ -61,10 +61,10 @@ end
|
||||
# returns :no, :native, or :recipe depending on how it's supported
|
||||
function seriestype_supported(pkg::AbstractBackend, st::Symbol)
|
||||
# is it natively supported
|
||||
if st in supported_types(pkg)
|
||||
if is_seriestype_supported(pkg, st)
|
||||
return :native
|
||||
end
|
||||
|
||||
|
||||
haskey(_series_recipe_deps, st) || return :no
|
||||
|
||||
supported = true
|
||||
@@ -85,7 +85,7 @@ function all_seriestypes()
|
||||
sts = Set{Symbol}(keys(_series_recipe_deps))
|
||||
for bsym in backends()
|
||||
btype = _backendType[bsym]
|
||||
sts = union(sts, Set{Symbol}(supported_types(btype())))
|
||||
sts = union(sts, Set{Symbol}(supported_seriestypes(btype())))
|
||||
end
|
||||
sort(collect(sts))
|
||||
end
|
||||
@@ -93,57 +93,11 @@ end
|
||||
|
||||
# ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
num_series(x::AMat) = size(x,2)
|
||||
num_series(x) = 1
|
||||
|
||||
|
||||
RecipesBase.apply_recipe{T}(d::KW, ::Type{T}, plt::Plot) = throw(MethodError("Unmatched plot recipe: $T"))
|
||||
|
||||
|
||||
# # TODO: remove when StatPlots is ready
|
||||
# if is_installed("DataFrames")
|
||||
# @eval begin
|
||||
# import DataFrames
|
||||
|
||||
# # if it's one symbol, set the guide and return the column
|
||||
# function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, sym::Symbol)
|
||||
# get!(d, Symbol(letter * "guide"), string(sym))
|
||||
# collect(df[sym])
|
||||
# end
|
||||
|
||||
# # if it's an array of symbols, set the labels and return a Vector{Any} of columns
|
||||
# function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, syms::AbstractArray{Symbol})
|
||||
# get!(d, :label, reshape(syms, 1, length(syms)))
|
||||
# Any[collect(df[s]) for s in syms]
|
||||
# end
|
||||
|
||||
# # for anything else, no-op
|
||||
# function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, anything)
|
||||
# anything
|
||||
# end
|
||||
|
||||
# # handle grouping by DataFrame column
|
||||
# function extractGroupArgs(group::Symbol, df::DataFrames.AbstractDataFrame, args...)
|
||||
# extractGroupArgs(collect(df[group]))
|
||||
# end
|
||||
|
||||
# # if a DataFrame is the first arg, lets swap symbols out for columns
|
||||
# @recipe function f(df::DataFrames.AbstractDataFrame, args...)
|
||||
# # if any of these attributes are symbols, swap out for the df column
|
||||
# for k in (:fillrange, :line_z, :marker_z, :markersize, :ribbon, :weights, :xerror, :yerror)
|
||||
# if haskey(d, k) && isa(d[k], Symbol)
|
||||
# d[k] = collect(df[d[k]])
|
||||
# end
|
||||
# end
|
||||
|
||||
# # return a list of new arguments
|
||||
# tuple(Any[handle_dfs(df, d, (i==1 ? "x" : i==2 ? "y" : "z"), arg) for (i,arg) in enumerate(args)]...)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -202,6 +156,7 @@ end
|
||||
|
||||
function make_steps(x, y, st)
|
||||
n = length(x)
|
||||
n == 0 && return zeros(0),zeros(0)
|
||||
newx, newy = zeros(2n-1), zeros(2n-1)
|
||||
for i=1:n
|
||||
idx = 2i-1
|
||||
@@ -261,19 +216,23 @@ end
|
||||
# ---------------------------------------------------------------------------
|
||||
# sticks
|
||||
|
||||
sticks_fillfrom(fr::Void, i::Integer) = 0.0
|
||||
sticks_fillfrom(fr::Number, i::Integer) = fr
|
||||
sticks_fillfrom(fr::AVec, i::Integer) = fr[mod1(i, length(fr))]
|
||||
|
||||
# create vertical line segments from fill
|
||||
@recipe function f(::Type{Val{:sticks}}, x, y, z)
|
||||
n = length(x)
|
||||
fr = d[:fillrange]
|
||||
if fr == nothing
|
||||
yaxis = d[:subplot][:yaxis]
|
||||
fr = if yaxis[:scale] == :identity
|
||||
0.0
|
||||
else
|
||||
min(axis_limits(yaxis)[1], minimum(y))
|
||||
end
|
||||
end
|
||||
newx, newy = zeros(3n), zeros(3n)
|
||||
for i=1:n
|
||||
rng = 3i-2:3i
|
||||
newx[rng] = [x[i], x[i], NaN]
|
||||
newy[rng] = [sticks_fillfrom(fr,i), y[i], NaN]
|
||||
newy[rng] = [cycle(fr,i), y[i], NaN]
|
||||
end
|
||||
x := newx
|
||||
y := newy
|
||||
@@ -300,7 +259,7 @@ end
|
||||
# ---------------------------------------------------------------------------
|
||||
# bezier curves
|
||||
|
||||
# get the value of the curve point at position t
|
||||
# get the value of the curve point at position t
|
||||
function bezier_value(pts::AVec, t::Real)
|
||||
val = 0.0
|
||||
n = length(pts)-1
|
||||
@@ -400,11 +359,18 @@ end
|
||||
push!(yseg, yi, fi, fi, yi, yi)
|
||||
end
|
||||
|
||||
# widen limits out a bit
|
||||
expand_extrema!(axis, widen(extrema(xseg.pts)...))
|
||||
|
||||
# switch back
|
||||
if !isvertical(d)
|
||||
xseg, yseg = yseg, xseg
|
||||
end
|
||||
|
||||
|
||||
# reset orientation
|
||||
orientation := default(:orientation)
|
||||
|
||||
x := xseg.pts
|
||||
y := yseg.pts
|
||||
seriestype := :shape
|
||||
@@ -499,6 +465,11 @@ centers(v::AVec) = 0.5 * (v[1:end-1] + v[2:end])
|
||||
xedges, yedges, counts = my_hist_2d(x, y, d[:bins],
|
||||
normed = d[:normalize],
|
||||
weights = d[:weights])
|
||||
for (i,c) in enumerate(counts)
|
||||
if c == 0
|
||||
counts[i] = NaN
|
||||
end
|
||||
end
|
||||
x := centers(xedges)
|
||||
y := centers(yedges)
|
||||
z := Surface(counts)
|
||||
@@ -524,179 +495,6 @@ end
|
||||
|
||||
# note: don't add dependencies because this really isn't a drop-in replacement
|
||||
|
||||
# # TODO: move boxplots and violin plots to StatPlots when it's ready
|
||||
|
||||
# # ---------------------------------------------------------------------------
|
||||
# # Box Plot
|
||||
|
||||
# const _box_halfwidth = 0.4
|
||||
|
||||
# notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N)
|
||||
|
||||
|
||||
# @recipe function f(::Type{Val{:boxplot}}, x, y, z; notch=false, range=1.5)
|
||||
# xsegs, ysegs = Segments(), Segments()
|
||||
# glabels = sort(collect(unique(x)))
|
||||
# warning = false
|
||||
# outliers_x, outliers_y = zeros(0), zeros(0)
|
||||
# for (i,glabel) in enumerate(glabels)
|
||||
# # filter y
|
||||
# values = y[filter(i -> cycle(x,i) == glabel, 1:length(y))]
|
||||
|
||||
# # compute quantiles
|
||||
# q1,q2,q3,q4,q5 = quantile(values, linspace(0,1,5))
|
||||
|
||||
# # notch
|
||||
# n = notch_width(q2, q4, length(values))
|
||||
|
||||
# # warn on inverted notches?
|
||||
# if notch && !warning && ( (q2>(q3-n)) || (q4<(q3+n)) )
|
||||
# warn("Boxplot's notch went outside hinges. Set notch to false.")
|
||||
# warning = true # Show the warning only one time
|
||||
# end
|
||||
|
||||
# # make the shape
|
||||
# center = discrete_value!(d[:subplot][:xaxis], glabel)[1]
|
||||
# hw = d[:bar_width] == nothing ? _box_halfwidth : 0.5cycle(d[:bar_width], i)
|
||||
# l, m, r = center - hw, center, center + hw
|
||||
|
||||
# # internal nodes for notches
|
||||
# L, R = center - 0.5 * hw, center + 0.5 * hw
|
||||
|
||||
# # outliers
|
||||
# if Float64(range) != 0.0 # if the range is 0.0, the whiskers will extend to the data
|
||||
# limit = range*(q4-q2)
|
||||
# inside = Float64[]
|
||||
# for value in values
|
||||
# if (value < (q2 - limit)) || (value > (q4 + limit))
|
||||
# push!(outliers_y, value)
|
||||
# push!(outliers_x, center)
|
||||
# else
|
||||
# push!(inside, value)
|
||||
# end
|
||||
# end
|
||||
# # change q1 and q5 to show outliers
|
||||
# # using maximum and minimum values inside the limits
|
||||
# q1, q5 = extrema(inside)
|
||||
# end
|
||||
|
||||
# # Box
|
||||
# if notch
|
||||
# push!(xsegs, m, l, r, m, m) # lower T
|
||||
# push!(xsegs, l, l, L, R, r, r, l) # lower box
|
||||
# push!(xsegs, l, l, L, R, r, r, l) # upper box
|
||||
# push!(xsegs, m, l, r, m, m) # upper T
|
||||
|
||||
# push!(ysegs, q1, q1, q1, q1, q2) # lower T
|
||||
# push!(ysegs, q2, q3-n, q3, q3, q3-n, q2, q2) # lower box
|
||||
# push!(ysegs, q4, q3+n, q3, q3, q3+n, q4, q4) # upper box
|
||||
# push!(ysegs, q5, q5, q5, q5, q4) # upper T
|
||||
# else
|
||||
# push!(xsegs, m, l, r, m, m) # lower T
|
||||
# push!(xsegs, l, l, r, r, l) # lower box
|
||||
# push!(xsegs, l, l, r, r, l) # upper box
|
||||
# push!(xsegs, m, l, r, m, m) # upper T
|
||||
|
||||
# push!(ysegs, q1, q1, q1, q1, q2) # lower T
|
||||
# push!(ysegs, q2, q3, q3, q2, q2) # lower box
|
||||
# push!(ysegs, q4, q3, q3, q4, q4) # upper box
|
||||
# push!(ysegs, q5, q5, q5, q5, q4) # upper T
|
||||
# end
|
||||
# end
|
||||
|
||||
# # Outliers
|
||||
# @series begin
|
||||
# seriestype := :scatter
|
||||
# markershape := :circle
|
||||
# markercolor := d[:fillcolor]
|
||||
# markeralpha := d[:fillalpha]
|
||||
# markerstrokecolor := d[:linecolor]
|
||||
# markerstrokealpha := d[:linealpha]
|
||||
# x := outliers_x
|
||||
# y := outliers_y
|
||||
# primary := false
|
||||
# ()
|
||||
# end
|
||||
|
||||
# seriestype := :shape
|
||||
# x := xsegs.pts
|
||||
# y := ysegs.pts
|
||||
# ()
|
||||
# end
|
||||
# @deps boxplot shape scatter
|
||||
|
||||
# # ---------------------------------------------------------------------------
|
||||
# # Violin Plot
|
||||
|
||||
# const _violin_warned = [false]
|
||||
|
||||
# # if the user has KernelDensity installed, use this for violin plots.
|
||||
# # otherwise, just use a histogram
|
||||
# if is_installed("KernelDensity")
|
||||
# @eval import KernelDensity
|
||||
# @eval function violin_coords(y; trim::Bool=false)
|
||||
# kd = KernelDensity.kde(y, npoints = 200)
|
||||
# if trim
|
||||
# xmin, xmax = extrema(y)
|
||||
# inside = Bool[ xmin <= x <= xmax for x in kd.x]
|
||||
# return(kd.density[inside], kd.x[inside])
|
||||
# end
|
||||
# kd.density, kd.x
|
||||
# end
|
||||
# else
|
||||
# @eval function violin_coords(y; trim::Bool=false)
|
||||
# if !_violin_warned[1]
|
||||
# warn("Install the KernelDensity package for best results.")
|
||||
# _violin_warned[1] = true
|
||||
# end
|
||||
# edges, widths = my_hist(y, 10)
|
||||
# centers = 0.5 * (edges[1:end-1] + edges[2:end])
|
||||
# ymin, ymax = extrema(y)
|
||||
# vcat(0.0, widths, 0.0), vcat(ymin, centers, ymax)
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
# @recipe function f(::Type{Val{:violin}}, x, y, z; trim=true)
|
||||
# xsegs, ysegs = Segments(), Segments()
|
||||
# glabels = sort(collect(unique(x)))
|
||||
# for glabel in glabels
|
||||
# widths, centers = violin_coords(y[filter(i -> cycle(x,i) == glabel, 1:length(y))], trim=trim)
|
||||
# isempty(widths) && continue
|
||||
|
||||
# # normalize
|
||||
# widths = _box_halfwidth * widths / maximum(widths)
|
||||
|
||||
# # make the violin
|
||||
# xcenter = discrete_value!(d[:subplot][:xaxis], glabel)[1]
|
||||
# xcoords = vcat(widths, -reverse(widths)) + xcenter
|
||||
# ycoords = vcat(centers, reverse(centers))
|
||||
|
||||
# push!(xsegs, xcoords)
|
||||
# push!(ysegs, ycoords)
|
||||
# end
|
||||
|
||||
# seriestype := :shape
|
||||
# x := xsegs.pts
|
||||
# y := ysegs.pts
|
||||
# ()
|
||||
# end
|
||||
# @deps violin shape
|
||||
|
||||
# # ---------------------------------------------------------------------------
|
||||
# # density
|
||||
|
||||
# @recipe function f(::Type{Val{:density}}, x, y, z; trim=false)
|
||||
# newx, newy = violin_coords(y, trim=trim)
|
||||
# if isvertical(d)
|
||||
# newx, newy = newy, newx
|
||||
# end
|
||||
# x := newx
|
||||
# y := newy
|
||||
# seriestype := :path
|
||||
# ()
|
||||
# end
|
||||
# @deps density path
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# contourf - filled contours
|
||||
@@ -859,7 +657,7 @@ end
|
||||
|
||||
# function apply_series_recipe(d::KW, ::Type{Val{:quiver}})
|
||||
@recipe function f(::Type{Val{:quiver}}, x, y, z)
|
||||
if :arrow in supported_args()
|
||||
if :arrow in supported_attrs()
|
||||
quiver_using_arrows(d)
|
||||
else
|
||||
quiver_using_hack(d)
|
||||
@@ -935,18 +733,62 @@ end
|
||||
# series recipe or moved to PlotRecipes
|
||||
|
||||
|
||||
"Sparsity plot... heatmap of non-zero values of a matrix"
|
||||
function spy{T<:Real}(z::AMat{T}; kw...)
|
||||
mat = map(zi->float(zi!=0), z)'
|
||||
xn, yn = size(mat)
|
||||
heatmap(mat; leg=false, yflip=true, aspect_ratio=:equal,
|
||||
xlim=(0.5, xn+0.5), ylim=(0.5, yn+0.5),
|
||||
kw...)
|
||||
# "Sparsity plot... heatmap of non-zero values of a matrix"
|
||||
# function spy{T<:Real}(z::AMat{T}; kw...)
|
||||
# mat = map(zi->float(zi!=0), z)'
|
||||
# xn, yn = size(mat)
|
||||
# heatmap(mat; leg=false, yflip=true, aspect_ratio=:equal,
|
||||
# xlim=(0.5, xn+0.5), ylim=(0.5, yn+0.5),
|
||||
# kw...)
|
||||
# end
|
||||
|
||||
# Only allow matrices through, and make it seriestype :spy so the backend can
|
||||
# optionally handle it natively.
|
||||
|
||||
@userplot Spy
|
||||
|
||||
@recipe function f(g::Spy)
|
||||
@assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix
|
||||
seriestype := :spy
|
||||
mat = g.args[1]
|
||||
n,m = size(mat)
|
||||
Plots.SliceIt, 1:m, 1:n, Surface(mat)
|
||||
end
|
||||
|
||||
@recipe function f(::Type{Val{:spy}}, x,y,z)
|
||||
yflip := true
|
||||
aspect_ratio := 1
|
||||
rs, cs, zs = findnz(z.surf)
|
||||
xlim := extrema(cs)
|
||||
ylim := extrema(rs)
|
||||
if d[:markershape] == :none
|
||||
markershape := :circle
|
||||
end
|
||||
if d[:markersize] == default(:markersize)
|
||||
markersize := 1
|
||||
end
|
||||
markerstrokewidth := 0
|
||||
marker_z := zs
|
||||
label := ""
|
||||
x := cs
|
||||
y := rs
|
||||
z := nothing
|
||||
seriestype := :scatter
|
||||
()
|
||||
end
|
||||
|
||||
# -------------------------------------------------
|
||||
|
||||
"Adds a+bx... straight line over the current plot"
|
||||
function abline!(plt::Plot, a, b; kw...)
|
||||
plot!(plt, [extrema(plt)...], x -> b + a*x; kw...)
|
||||
end
|
||||
|
||||
abline!(args...; kw...) = abline!(current(), args...; kw...)
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Dates
|
||||
|
||||
@recipe f(::Type{Date}, dt::Date) = (dt -> convert(Int,dt), dt -> string(convert(Date,dt)))
|
||||
@recipe f(::Type{DateTime}, dt::DateTime) = (dt -> convert(Int,dt), dt -> string(convert(DateTime,dt)))
|
||||
|
||||
+95
-31
@@ -6,12 +6,12 @@
|
||||
# This should cut down on boilerplate code and allow more focused dispatch on type
|
||||
# note: returns meta information... mainly for use with automatic labeling from DataFrames for now
|
||||
|
||||
typealias FuncOrFuncs @compat(Union{Function, AVec{Function}})
|
||||
typealias FuncOrFuncs Union{Function, AVec{Function}}
|
||||
|
||||
all3D(d::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image), get(d, :seriestype, :none))
|
||||
|
||||
# missing
|
||||
convertToAnyVector(v::@compat(Void), d::KW) = Any[nothing], nothing
|
||||
convertToAnyVector(v::Void, d::KW) = Any[nothing], nothing
|
||||
|
||||
# fixed number of blank series
|
||||
convertToAnyVector(n::Integer, d::KW) = Any[zeros(0) for i in 1:n], nothing
|
||||
@@ -20,7 +20,7 @@ convertToAnyVector(n::Integer, d::KW) = Any[zeros(0) for i in 1:n], nothing
|
||||
convertToAnyVector{T<:Number}(v::AVec{T}, d::KW) = Any[v], nothing
|
||||
|
||||
# string vector
|
||||
convertToAnyVector{T<:@compat(AbstractString)}(v::AVec{T}, d::KW) = Any[v], nothing
|
||||
convertToAnyVector{T<:AbstractString}(v::AVec{T}, d::KW) = Any[v], nothing
|
||||
|
||||
function convertToAnyVector(v::AMat, d::KW)
|
||||
if all3D(d)
|
||||
@@ -36,11 +36,14 @@ convertToAnyVector(f::Function, d::KW) = Any[f], nothing
|
||||
# surface
|
||||
convertToAnyVector(s::Surface, d::KW) = Any[s], nothing
|
||||
|
||||
# volume
|
||||
convertToAnyVector(v::Volume, d::KW) = Any[v], nothing
|
||||
|
||||
# # vector of OHLC
|
||||
# convertToAnyVector(v::AVec{OHLC}, d::KW) = Any[v], nothing
|
||||
|
||||
# dates
|
||||
convertToAnyVector{D<:Union{Date,DateTime}}(dts::AVec{D}, d::KW) = Any[dts], nothing
|
||||
# # dates
|
||||
# convertToAnyVector{D<:Union{Date,DateTime}}(dts::AVec{D}, d::KW) = Any[dts], nothing
|
||||
|
||||
# list of things (maybe other vectors, functions, or something else)
|
||||
function convertToAnyVector(v::AVec, d::KW)
|
||||
@@ -107,7 +110,21 @@ immutable SliceIt end
|
||||
|
||||
# the catch-all recipes
|
||||
@recipe function f(::Type{SliceIt}, x, y, z)
|
||||
# @show "HERE", typeof((x,y,z))
|
||||
|
||||
# handle data with formatting attached
|
||||
if typeof(x) <: Formatted
|
||||
xformatter := x.formatter
|
||||
x = x.data
|
||||
end
|
||||
if typeof(y) <: Formatted
|
||||
yformatter := y.formatter
|
||||
y = y.data
|
||||
end
|
||||
if typeof(z) <: Formatted
|
||||
zformatter := z.formatter
|
||||
z = z.data
|
||||
end
|
||||
|
||||
xs, _ = convertToAnyVector(x, d)
|
||||
ys, _ = convertToAnyVector(y, d)
|
||||
zs, _ = convertToAnyVector(z, d)
|
||||
@@ -125,21 +142,19 @@ immutable SliceIt end
|
||||
mx = length(xs)
|
||||
my = length(ys)
|
||||
mz = length(zs)
|
||||
# ret = Any[]
|
||||
for i in 1:max(mx, my, mz)
|
||||
# add a new series
|
||||
di = copy(d)
|
||||
xi, yi, zi = xs[mod1(i,mx)], ys[mod1(i,my)], zs[mod1(i,mz)]
|
||||
# @show i, typeof((xi, yi, zi))
|
||||
di[:x], di[:y], di[:z] = compute_xyz(xi, yi, zi)
|
||||
# @show i, typeof((di[:x], di[:y], di[:z]))
|
||||
if mx > 0 && my > 0 && mz > 0
|
||||
for i in 1:max(mx, my, mz)
|
||||
# add a new series
|
||||
di = copy(d)
|
||||
xi, yi, zi = xs[mod1(i,mx)], ys[mod1(i,my)], zs[mod1(i,mz)]
|
||||
di[:x], di[:y], di[:z] = compute_xyz(xi, yi, zi)
|
||||
|
||||
# handle fillrange
|
||||
fr = fillranges[mod1(i,mf)]
|
||||
di[:fillrange] = isa(fr, Function) ? map(fr, di[:x]) : fr
|
||||
# handle fillrange
|
||||
fr = fillranges[mod1(i,mf)]
|
||||
di[:fillrange] = isa(fr, Function) ? map(fr, di[:x]) : fr
|
||||
|
||||
# @show i, di[:x], di[:y], di[:z]
|
||||
push!(series_list, RecipeData(di, ()))
|
||||
push!(series_list, RecipeData(di, ()))
|
||||
end
|
||||
end
|
||||
nothing # don't add a series for the main block
|
||||
end
|
||||
@@ -152,6 +167,38 @@ end
|
||||
|
||||
_apply_type_recipe(d, v) = RecipesBase.apply_recipe(d, typeof(v), v)[1].args[1]
|
||||
|
||||
# Handle type recipes when the recipe is defined on the elements.
|
||||
# This sort of recipe should return a pair of functions... one to convert to number,
|
||||
# and one to format tick values.
|
||||
function _apply_type_recipe(d, v::AbstractArray)
|
||||
args = RecipesBase.apply_recipe(d, typeof(v[1]), v[1])[1].args
|
||||
if length(args) == 2 && typeof(args[1]) <: Function && typeof(args[2]) <: Function
|
||||
numfunc, formatter = args
|
||||
Formatted(map(numfunc, v), formatter)
|
||||
else
|
||||
v
|
||||
end
|
||||
end
|
||||
|
||||
# # special handling for Surface... need to properly unwrap and re-wrap
|
||||
# function _apply_type_recipe(d, v::Surface)
|
||||
# T = eltype(v.surf)
|
||||
# @show T
|
||||
# if T <: Integer || T <: AbstractFloat
|
||||
# v
|
||||
# else
|
||||
# ret = _apply_type_recipe(d, v.surf)
|
||||
# if typeof(ret) <: Formatted
|
||||
# Formatted(Surface(ret.data), ret.formatter)
|
||||
# else
|
||||
# v
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# don't do anything for ints or floats
|
||||
_apply_type_recipe{T<:Union{Integer,AbstractFloat}}(d, v::AbstractArray{T}) = v
|
||||
|
||||
# handle "type recipes" by converting inputs, and then either re-calling or slicing
|
||||
@recipe function f(x, y, z)
|
||||
did_replace = false
|
||||
@@ -210,10 +257,10 @@ end
|
||||
# # 1 argument
|
||||
# # --------------------------------------------------------------------
|
||||
|
||||
@recipe f(n::Integer) = n, n, n
|
||||
@recipe f(n::Integer) = is3d(get(d,:seriestype,:path)) ? (SliceIt, n, n, n) : (SliceIt, n, n, nothing)
|
||||
|
||||
# return a surface if this is a 3d plot, otherwise let it be sliced up
|
||||
@recipe function f{T<:Number}(mat::AMat{T})
|
||||
@recipe function f{T<:Union{Integer,AbstractFloat}}(mat::AMat{T})
|
||||
if all3D(d)
|
||||
n,m = size(mat)
|
||||
SliceIt, 1:m, 1:n, Surface(mat)
|
||||
@@ -222,11 +269,28 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
# if a matrix is wrapped by Formatted, do similar logic, but wrap data with Surface
|
||||
@recipe function f{T<:AbstractMatrix}(fmt::Formatted{T})
|
||||
if all3D(d)
|
||||
mat = fmt.data
|
||||
n,m = size(mat)
|
||||
SliceIt, 1:m, 1:n, Formatted(Surface(mat), fmt.formatter)
|
||||
else
|
||||
SliceIt, nothing, fmt, nothing
|
||||
end
|
||||
end
|
||||
|
||||
# assume this is a Volume, so construct one
|
||||
@recipe function f{T<:Number}(vol::AbstractArray{T,3}, args...)
|
||||
seriestype := :volume
|
||||
SliceIt, nothing, Volume(vol, args...), nothing
|
||||
end
|
||||
|
||||
|
||||
# # images - grays
|
||||
|
||||
@recipe function f{T<:Gray}(mat::AMat{T})
|
||||
if nativeImagesSupported()
|
||||
if is_seriestype_supported(:image)
|
||||
seriestype := :image
|
||||
n, m = size(mat)
|
||||
SliceIt, 1:m, 1:n, Surface(mat)
|
||||
@@ -241,7 +305,7 @@ end
|
||||
# # images - colors
|
||||
|
||||
@recipe function f{T<:Colorant}(mat::AMat{T})
|
||||
if nativeImagesSupported()
|
||||
if is_seriestype_supported(:image)
|
||||
seriestype := :image
|
||||
n, m = size(mat)
|
||||
SliceIt, 1:m, 1:n, Surface(mat)
|
||||
@@ -273,14 +337,15 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
#
|
||||
# # function without range... use the current range of the x-axis
|
||||
|
||||
# @recipe function f(f::FuncOrFuncs)
|
||||
# plt = d[:plot_object]
|
||||
# f, xmin(plt), xmax(plt)
|
||||
# end
|
||||
|
||||
# function without range... use the current range of the x-axis
|
||||
|
||||
@recipe function f(f::FuncOrFuncs)
|
||||
plt = d[:plot_object]
|
||||
xmin,xmax = axis_limits(plt[1][:xaxis])
|
||||
f, xmin, xmax
|
||||
end
|
||||
|
||||
#
|
||||
# # --------------------------------------------------------------------
|
||||
@@ -426,4 +491,3 @@ end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@
|
||||
function Subplot{T<:AbstractBackend}(::T; parent = RootLayout())
|
||||
Subplot{T}(
|
||||
parent,
|
||||
Series[],
|
||||
(20mm, 5mm, 2mm, 10mm),
|
||||
defaultbox,
|
||||
defaultbox,
|
||||
@@ -33,7 +34,7 @@ get_subplot(series::Series) = series.d[:subplot]
|
||||
get_subplot_index(plt::Plot, idx::Integer) = Int(idx)
|
||||
get_subplot_index(plt::Plot, sp::Subplot) = findfirst(_ -> _ === sp, plt.subplots)
|
||||
|
||||
series_list(sp::Subplot) = filter(series -> series.d[:subplot] === sp, sp.plt.series_list)
|
||||
series_list(sp::Subplot) = sp.series_list # filter(series -> series.d[:subplot] === sp, sp.plt.series_list)
|
||||
|
||||
function should_add_to_legend(series::Series)
|
||||
series.d[:primary] && series.d[:label] != "" &&
|
||||
|
||||
+35
-60
@@ -1,65 +1,40 @@
|
||||
|
||||
const _invisible = RGBA(0,0,0,0)
|
||||
function theme(s::Symbol; kw...)
|
||||
# reset?
|
||||
if s == :none || s == :default
|
||||
PlotUtils._default_gradient[] = :inferno
|
||||
default(;
|
||||
bg = :white,
|
||||
bglegend = :match,
|
||||
bginside = :match,
|
||||
bgoutside = :match,
|
||||
fg = :auto,
|
||||
fglegend = :match,
|
||||
fggrid = :match,
|
||||
fgaxis = :match,
|
||||
fgtext = :match,
|
||||
fgborder = :match,
|
||||
fgguide = :match,
|
||||
palette = :auto
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
const _themes = KW(
|
||||
:default => KW(
|
||||
:bg => :white,
|
||||
:bglegend => :match,
|
||||
:bginside => :match,
|
||||
:bgoutside => :match,
|
||||
:fg => :auto,
|
||||
:fglegend => :match,
|
||||
:fggrid => :match,
|
||||
:fgaxis => :match,
|
||||
:fgtext => :match,
|
||||
:fgborder => :match,
|
||||
:fgguide => :match,
|
||||
# update the default gradient and other defaults
|
||||
thm = PlotThemes._themes[s]
|
||||
if thm.gradient != nothing
|
||||
PlotUtils._default_gradient[] = PlotThemes.gradient_name(s)
|
||||
end
|
||||
default(;
|
||||
bg = thm.bg_secondary,
|
||||
bginside = thm.bg_primary,
|
||||
fg = thm.lines,
|
||||
fgtext = thm.text,
|
||||
fgguide = thm.text,
|
||||
fglegend = thm.text,
|
||||
palette = thm.palette,
|
||||
kw...
|
||||
)
|
||||
)
|
||||
|
||||
function add_theme(sym::Symbol, theme::KW)
|
||||
_themes[sym] = theme
|
||||
end
|
||||
|
||||
# add a new theme, using an existing theme as the base
|
||||
function add_theme(sym::Symbol;
|
||||
base = :default, # start with this theme
|
||||
bg = _themes[base][:bg],
|
||||
bglegend = _themes[base][:bglegend],
|
||||
bginside = _themes[base][:bginside],
|
||||
bgoutside = _themes[base][:bgoutside],
|
||||
fg = _themes[base][:fg],
|
||||
fglegend = _themes[base][:fglegend],
|
||||
fggrid = _themes[base][:fggrid],
|
||||
fgaxis = _themes[base][:fgaxis],
|
||||
fgtext = _themes[base][:fgtext],
|
||||
fgborder = _themes[base][:fgborder],
|
||||
fgguide = _themes[base][:fgguide],
|
||||
kw...)
|
||||
_themes[sym] = merge(KW(
|
||||
:bg => bg,
|
||||
:bglegend => bglegend,
|
||||
:bginside => bginside,
|
||||
:bgoutside => bgoutside,
|
||||
:fg => fg,
|
||||
:fglegend => fglegend,
|
||||
:fggrid => fggrid,
|
||||
:fgaxis => fgaxis,
|
||||
:fgtext => fgtext,
|
||||
:fgborder => fgborder,
|
||||
:fgguide => fgguide,
|
||||
), KW(kw))
|
||||
end
|
||||
|
||||
add_theme(:ggplot2,
|
||||
bglegend = _invisible,
|
||||
bginside = :lightgray,
|
||||
fg = :white,
|
||||
fglegend = _invisible,
|
||||
fgtext = :gray,
|
||||
fgguide = :black
|
||||
)
|
||||
|
||||
function set_theme(sym::Symbol)
|
||||
default(; _themes[sym]...)
|
||||
end
|
||||
@deprecate set_theme(s) theme(s)
|
||||
|
||||
+13
-9
@@ -21,11 +21,21 @@ wrap{T}(obj::T) = InputWrapper{T}(obj)
|
||||
Base.isempty(wrapper::InputWrapper) = false
|
||||
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
type Series
|
||||
d::KW
|
||||
end
|
||||
|
||||
attr(series::Series, k::Symbol) = series.d[k]
|
||||
attr!(series::Series, v, k::Symbol) = (series.d[k] = v)
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
# a single subplot
|
||||
type Subplot{T<:AbstractBackend} <: AbstractLayout
|
||||
parent::AbstractLayout
|
||||
series_list::Vector{Series} # arguments for each series
|
||||
minpad::Tuple # leftpad, toppad, rightpad, bottompad
|
||||
bbox::BoundingBox # the canvas area which is available to this subplot
|
||||
plotarea::BoundingBox # the part where the data goes
|
||||
@@ -34,11 +44,13 @@ type Subplot{T<:AbstractBackend} <: AbstractLayout
|
||||
plt # the enclosing Plot object (can't give it a type because of no forward declarations)
|
||||
end
|
||||
|
||||
Base.show(io::IO, sp::Subplot) = print(io, "Subplot{$(sp[:subplot_index])}")
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
# simple wrapper around a KW so we can hold all attributes pertaining to the axis in one place
|
||||
type Axis
|
||||
sp::Subplot
|
||||
sps::Vector{Subplot}
|
||||
d::KW
|
||||
end
|
||||
|
||||
@@ -54,14 +66,6 @@ typealias SubplotMap Dict{Any, Subplot}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
type Series
|
||||
d::KW
|
||||
end
|
||||
|
||||
attr(series::Series, k::Symbol) = series.d[k]
|
||||
attr!(series::Series, v, k::Symbol) = (series.d[k] = v)
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
type Plot{T<:AbstractBackend} <: AbstractPlot{T}
|
||||
backend::T # the backend type
|
||||
|
||||
+90
-16
@@ -131,7 +131,7 @@ function replace_image_with_heatmap{T<:Colorant}(z::Array{T})
|
||||
end
|
||||
|
||||
function imageHack(d::KW)
|
||||
:heatmap in supported_types() || error("Neither :image or :heatmap are supported!")
|
||||
is_seriestype_supported(:heatmap) || error("Neither :image or :heatmap are supported!")
|
||||
d[:seriestype] = :heatmap
|
||||
d[:z], d[:fillcolor] = replace_image_with_heatmap(d[:z].surf)
|
||||
end
|
||||
@@ -243,16 +243,17 @@ Base.cycle(v, idx::Int) = v
|
||||
|
||||
Base.cycle(v::AVec, indices::AVec{Int}) = map(i -> cycle(v,i), indices)
|
||||
Base.cycle(v::AMat, indices::AVec{Int}) = map(i -> cycle(v,i), indices)
|
||||
Base.cycle(v, idx::AVec{Int}) = v
|
||||
Base.cycle(v, indices::AVec{Int}) = fill(v, length(indices))
|
||||
|
||||
Base.cycle(grad::ColorGradient, idx::Int) = cycle(grad.colors, idx)
|
||||
Base.cycle(grad::ColorGradient, indices::AVec{Int}) = cycle(grad.colors, indices)
|
||||
|
||||
makevec(v::AVec) = v
|
||||
makevec{T}(v::T) = T[v]
|
||||
|
||||
"duplicate a single value, or pass the 2-tuple through"
|
||||
maketuple(x::Real) = (x,x)
|
||||
maketuple{T,S}(x::@compat(Tuple{T,S})) = x
|
||||
maketuple{T,S}(x::Tuple{T,S}) = x
|
||||
|
||||
mapFuncOrFuncs(f::Function, u::AVec) = map(f, u)
|
||||
mapFuncOrFuncs(fs::AVec{Function}, u::AVec) = [map(f, u) for f in fs]
|
||||
@@ -386,13 +387,12 @@ isvertical(d::KW) = get(d, :orientation, :vertical) in (:vertical, :v, :vert)
|
||||
isvertical(series::Series) = isvertical(series.d)
|
||||
|
||||
|
||||
# ticksType{T<:Real,S<:Real}(ticks::@compat(Tuple{T,S})) = :limits
|
||||
ticksType{T<:Real}(ticks::AVec{T}) = :ticks
|
||||
ticksType{T<:AbstractString}(ticks::AVec{T}) = :labels
|
||||
ticksType{T<:AVec,S<:AVec}(ticks::@compat(Tuple{T,S})) = :ticks_and_labels
|
||||
ticksType{T<:AVec,S<:AVec}(ticks::Tuple{T,S}) = :ticks_and_labels
|
||||
ticksType(ticks) = :invalid
|
||||
|
||||
limsType{T<:Real,S<:Real}(lims::@compat(Tuple{T,S})) = :limits
|
||||
limsType{T<:Real,S<:Real}(lims::Tuple{T,S}) = :limits
|
||||
limsType(lims::Symbol) = lims == :auto ? :auto : :invalid
|
||||
limsType(lims) = :invalid
|
||||
|
||||
@@ -445,7 +445,8 @@ end
|
||||
# for example: PyPlot sends rows to y, so transpose_on_match should be true
|
||||
function transpose_z(d, z, transpose_on_match::Bool = true)
|
||||
if d[:match_dimensions] == transpose_on_match
|
||||
z'
|
||||
# z'
|
||||
permutedims(z, [2,1])
|
||||
else
|
||||
z
|
||||
end
|
||||
@@ -474,9 +475,22 @@ function make_fillrange_from_ribbon(kw::KW)
|
||||
kw[:fillrange] = make_fillrange_side(y, rib1), make_fillrange_side(y, rib2)
|
||||
end
|
||||
|
||||
function get_sp_lims(sp::Subplot, letter::Symbol)
|
||||
axis_limits(sp[Symbol(letter, :axis)])
|
||||
end
|
||||
xlims(sp::Subplot) = get_sp_lims(sp, :x)
|
||||
ylims(sp::Subplot) = get_sp_lims(sp, :y)
|
||||
zlims(sp::Subplot) = get_sp_lims(sp, :z)
|
||||
xlims(plt::Plot, sp_idx::Int = 1) = xlims(plt[sp_idx])
|
||||
ylims(plt::Plot, sp_idx::Int = 1) = ylims(plt[sp_idx])
|
||||
zlims(plt::Plot, sp_idx::Int = 1) = zlims(plt[sp_idx])
|
||||
xlims(sp_idx::Int = 1) = xlims(current(), sp_idx)
|
||||
ylims(sp_idx::Int = 1) = ylims(current(), sp_idx)
|
||||
zlims(sp_idx::Int = 1) = zlims(current(), sp_idx)
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
wraptuple(x::@compat(Tuple)) = x
|
||||
wraptuple(x::Tuple) = x
|
||||
wraptuple(x) = (x,)
|
||||
|
||||
trueOrAllTrue(f::Function, x::AbstractArray) = all(f, x)
|
||||
@@ -484,7 +498,7 @@ trueOrAllTrue(f::Function, x) = f(x)
|
||||
|
||||
allLineTypes(arg) = trueOrAllTrue(a -> get(_typeAliases, a, a) in _allTypes, arg)
|
||||
allStyles(arg) = trueOrAllTrue(a -> get(_styleAliases, a, a) in _allStyles, arg)
|
||||
allShapes(arg) = trueOrAllTrue(a -> get(_markerAliases, a, a) in _allMarkers, arg) ||
|
||||
allShapes(arg) = trueOrAllTrue(a -> is_marker_supported(get(_markerAliases, a, a)), arg) ||
|
||||
trueOrAllTrue(a -> isa(a, Shape), arg)
|
||||
allAlphas(arg) = trueOrAllTrue(a -> (typeof(a) <: Real && a > 0 && a < 1) ||
|
||||
(typeof(a) <: AbstractFloat && (a == zero(typeof(a)) || a == one(typeof(a)))), arg)
|
||||
@@ -646,26 +660,86 @@ function setxy!{X,Y}(plt::Plot, xy::Tuple{X,Y}, i::Integer)
|
||||
series = plt.series_list[i]
|
||||
series.d[:x], series.d[:y] = xy
|
||||
sp = series.d[:subplot]
|
||||
expand_extrema!(sp.attr[:xaxis], xy[1])
|
||||
expand_extrema!(sp.attr[:yaxis], xy[2])
|
||||
reset_extrema!(sp)
|
||||
_series_updated(plt, series)
|
||||
end
|
||||
function setxyz!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer)
|
||||
series = plt.series_list[i]
|
||||
series.d[:x], series.d[:y], series.d[:z] = xyz
|
||||
sp = series.d[:subplot]
|
||||
expand_extrema!(sp.attr[:xaxis], xyz[1])
|
||||
expand_extrema!(sp.attr[:yaxis], xyz[2])
|
||||
expand_extrema!(sp.attr[:zaxis], xyz[3])
|
||||
reset_extrema!(sp)
|
||||
_series_updated(plt, series)
|
||||
end
|
||||
|
||||
function setxyz!{X,Y,Z<:AbstractMatrix}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer)
|
||||
setxyz!(plt, (xyz[1], xyz[2], Surface(xyz[3])), i)
|
||||
end
|
||||
|
||||
|
||||
# -------------------------------------------------------
|
||||
# indexing notation
|
||||
|
||||
# Base.getindex(plt::Plot, i::Integer) = getxy(plt, i)
|
||||
Base.setindex!{X,Y}(plt::Plot, xy::Tuple{X,Y}, i::Integer) = setxy!(plt, xy, i)
|
||||
Base.setindex!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer) = setxyz!(plt, xyz, i)
|
||||
Base.setindex!{X,Y}(plt::Plot, xy::Tuple{X,Y}, i::Integer) = (setxy!(plt, xy, i); plt)
|
||||
Base.setindex!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer) = (setxyz!(plt, xyz, i); plt)
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
# operate on individual series
|
||||
|
||||
function push_x!(series::Series, xi)
|
||||
push!(series[:x], xi)
|
||||
expand_extrema!(series[:subplot][:xaxis], xi)
|
||||
return
|
||||
end
|
||||
function push_y!(series::Series, yi)
|
||||
push!(series[:y], yi)
|
||||
expand_extrema!(series[:subplot][:yaxis], yi)
|
||||
return
|
||||
end
|
||||
function push_z!(series::Series, zi)
|
||||
push!(series[:z], zi)
|
||||
expand_extrema!(series[:subplot][:zaxis], zi)
|
||||
return
|
||||
end
|
||||
|
||||
function Base.push!(series::Series, yi)
|
||||
x = extendSeriesByOne(series[:x])
|
||||
expand_extrema!(series[:subplot][:xaxis], x[end])
|
||||
series[:x] = x
|
||||
push_y!(series, yi)
|
||||
end
|
||||
Base.push!(series::Series, xi, yi) = (push_x!(series,xi); push_y!(series,yi))
|
||||
Base.push!(series::Series, xi, yi, zi) = (push_x!(series,xi); push_y!(series,yi); push_z!(series,zi))
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
function update!(series::Series; kw...)
|
||||
d = KW(kw)
|
||||
preprocessArgs!(d)
|
||||
for (k,v) in d
|
||||
if haskey(_series_defaults, k)
|
||||
series[k] = v
|
||||
else
|
||||
warn("unused key $k in series update")
|
||||
end
|
||||
end
|
||||
_series_updated(series[:subplot].plt, series)
|
||||
series
|
||||
end
|
||||
|
||||
function update!(sp::Subplot; kw...)
|
||||
d = KW(kw)
|
||||
preprocessArgs!(d)
|
||||
for (k,v) in d
|
||||
if haskey(_subplot_defaults, k)
|
||||
sp[k] = v
|
||||
else
|
||||
warn("unused key $k in subplot update")
|
||||
end
|
||||
end
|
||||
sp
|
||||
end
|
||||
|
||||
# -------------------------------------------------------
|
||||
# push/append for one series
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
julia 0.4
|
||||
|
||||
RecipesBase
|
||||
PlotUtils
|
||||
StatPlots
|
||||
Reexport
|
||||
Measures
|
||||
Showoff
|
||||
FactCheck
|
||||
Images
|
||||
ImageMagick
|
||||
@osx QuartzImageIO
|
||||
GR
|
||||
DataFrames
|
||||
RDatasets
|
||||
VisualRegressionTests
|
||||
UnicodePlots
|
||||
|
||||
+8
-8
@@ -24,7 +24,7 @@ default(size=(500,300))
|
||||
# TODO: use julia's Condition type and the wait() and notify() functions to initialize a Window, then wait() on a condition that
|
||||
# is referenced in a button press callback (the button clicked callback will call notify() on that condition)
|
||||
|
||||
const _current_plots_version = v"0.8.1"
|
||||
const _current_plots_version = v"0.9.6"
|
||||
|
||||
|
||||
function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], eps = 1e-2)
|
||||
@@ -45,7 +45,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is
|
||||
# firgure out version info
|
||||
G = glob(joinpath(relpath(refdir), "*"))
|
||||
# @show refdir fn G
|
||||
slash = (@windows ? "\\" : "/")
|
||||
slash = (@static is_windows() ? "\\" : "/")
|
||||
versions = map(fn -> VersionNumber(split(fn, slash)[end]), G)
|
||||
versions = reverse(sort(versions))
|
||||
versions = filter(v -> v <= _current_plots_version, versions)
|
||||
@@ -78,12 +78,12 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is
|
||||
png(fn)
|
||||
end
|
||||
|
||||
try
|
||||
run(`mkdir -p $newdir`)
|
||||
catch err
|
||||
display(err)
|
||||
end
|
||||
# reffn = joinpath(refdir, "ref$idx.png")
|
||||
# try
|
||||
# run(`mkdir -p $newdir`)
|
||||
# catch err
|
||||
# display(err)
|
||||
# end
|
||||
# # reffn = joinpath(refdir, "ref$idx.png")
|
||||
|
||||
# the test
|
||||
vtest = VisualTest(func, reffn, idx)
|
||||
|
||||
+43
-3
@@ -23,14 +23,16 @@ facts("PyPlot") do
|
||||
@fact pyplot() --> Plots.PyPlotBackend()
|
||||
@fact backend() --> Plots.PyPlotBackend()
|
||||
|
||||
image_comparison_facts(:pyplot, skip=[], eps=img_eps)
|
||||
image_comparison_facts(:pyplot, skip=[25,30], eps=img_eps)
|
||||
end
|
||||
|
||||
facts("GR") do
|
||||
@fact gr() --> Plots.GRBackend()
|
||||
@fact backend() --> Plots.GRBackend()
|
||||
|
||||
# @linux_only image_comparison_facts(:gr, skip=[], eps=img_eps)
|
||||
if is_linux() && isinteractive()
|
||||
image_comparison_facts(:gr, skip=[2,25,30], eps=img_eps)
|
||||
end
|
||||
end
|
||||
|
||||
facts("Plotly") do
|
||||
@@ -38,7 +40,7 @@ facts("Plotly") do
|
||||
@fact backend() --> Plots.PlotlyBackend()
|
||||
|
||||
# # until png generation is reliable on OSX, just test on linux
|
||||
# @linux_only image_comparison_facts(:plotly, only=[1,3,4,7,8,9,10,11,12,14,15,20,22,23,27], eps=img_eps)
|
||||
# @static is_linux() && image_comparison_facts(:plotly, only=[1,3,4,7,8,9,10,11,12,14,15,20,22,23,27], eps=img_eps)
|
||||
end
|
||||
|
||||
|
||||
@@ -85,6 +87,44 @@ facts("Axes") do
|
||||
end
|
||||
|
||||
|
||||
# tests for preprocessing recipes
|
||||
|
||||
# facts("recipes") do
|
||||
|
||||
# user recipe
|
||||
|
||||
# type T end
|
||||
# @recipe function f(::T)
|
||||
# line := (3,0.3,:red)
|
||||
# marker := (20,0.5,:blue,:o)
|
||||
# bg := :yellow
|
||||
# rand(10)
|
||||
# end
|
||||
# plot(T())
|
||||
|
||||
# plot recipe
|
||||
|
||||
# @recipe function f(::Type{Val{:hiplt}},plt::Plot)
|
||||
# line := (3,0.3,:red)
|
||||
# marker := (20,0.5,:blue,:o)
|
||||
# t := :path
|
||||
# bg:=:green
|
||||
# ()
|
||||
# end
|
||||
# plot(rand(10),t=:hiplt)
|
||||
|
||||
# series recipe
|
||||
|
||||
# @recipe function f(::Type{Val{:hi}},x,y,z)
|
||||
# line := (3,0.3,:red)
|
||||
# marker := (20,0.5,:blue,:o)
|
||||
# t := :path
|
||||
# ()
|
||||
# end
|
||||
# plot(rand(10),t=:hiplt)
|
||||
|
||||
# end
|
||||
|
||||
|
||||
|
||||
FactCheck.exitstatus()
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import SnoopCompile
|
||||
# This only needs to be run once (to generate "/tmp/plots_compiles.csv")
|
||||
|
||||
# SnoopCompile.@snoop "/tmp/plots_compiles.csv" begin
|
||||
# include(Pkg.dir("Plots", "test","runtests.jl"))
|
||||
# include(joinpath(dirname(@__FILE__), "runtests.jl"))
|
||||
# end
|
||||
|
||||
# ----------------------------------------------------------
|
||||
@@ -32,5 +32,5 @@ blacklist = ["MIME"]
|
||||
pc, discards = SnoopCompile.parcel(data[end:-1:1,2], subst=subst, blacklist=blacklist)
|
||||
SnoopCompile.write("/tmp/precompile", pc)
|
||||
|
||||
pdir = Pkg.dir("Plots")
|
||||
pdir = joinpath(dirname(@__FILE__), "..")
|
||||
run(`cp /tmp/precompile/precompile_Plots.jl $pdir/src/precompile.jl`)
|
||||
|
||||
Reference in New Issue
Block a user