working on colors and args
This commit is contained in:
parent
d6253c72d4
commit
2de017086d
@ -21,7 +21,7 @@ end
|
|||||||
const examples = PlotExample[
|
const examples = PlotExample[
|
||||||
PlotExample("Lines",
|
PlotExample("Lines",
|
||||||
"A simple line plot of the columns.",
|
"A simple line plot of the columns.",
|
||||||
[:(plot(rand(50,5), w=3))]),
|
[:(plot(cumsum(randn(50,10),1), w=3))]),
|
||||||
PlotExample("Functions",
|
PlotExample("Functions",
|
||||||
"Plot multiple functions. You can also put the function first.",
|
"Plot multiple functions. You can also put the function first.",
|
||||||
[:(plot(0:0.01:4π, [sin,cos]))]),
|
[:(plot(0:0.01:4π, [sin,cos]))]),
|
||||||
@ -36,10 +36,10 @@ const examples = PlotExample[
|
|||||||
[:(plot(rand(10), title="TITLE", xlabel="XLABEL", ylabel="YLABEL", background_color = RGB(0.2,0.2,0.2), xlim=(-3,13), yticks=0:0.1:1))]),
|
[:(plot(rand(10), title="TITLE", xlabel="XLABEL", ylabel="YLABEL", background_color = RGB(0.2,0.2,0.2), xlim=(-3,13), yticks=0:0.1:1))]),
|
||||||
PlotExample("Two-axis",
|
PlotExample("Two-axis",
|
||||||
"Use the `axis` arguments.\n\nNote: Currently only supported with Qwt and PyPlot",
|
"Use the `axis` arguments.\n\nNote: Currently only supported with Qwt and PyPlot",
|
||||||
[:(plot(Vector[randn(100), randn(100)*100]; axis = [:l,:r], ylabel="LEFT", yrightlabel="RIGHT"))]),
|
[:(plot(Vector[randn(100), randn(100)*100]; axis = [:l :r], ylabel="LEFT", yrightlabel="RIGHT"))]),
|
||||||
PlotExample("Vectors w/ pluralized args",
|
PlotExample("Vectors w/ pluralized args",
|
||||||
"Plot multiple series with different numbers of points. Mix arguments that apply to all series (marker/markersize) with arguments unique to each series (colors).",
|
"Plot multiple series with different numbers of points. Mix arguments that apply to all series (marker/markersize) with arguments unique to each series (colors).",
|
||||||
[:(plot(Vector[rand(10), rand(20)]; marker=:ellipse, markersize=8, c=[:red,:blue]))]),
|
[:(plot(Vector[rand(10), rand(20)]; marker=:ellipse, markersize=8, c=(:red, :blue)))]),
|
||||||
PlotExample("Build plot in pieces",
|
PlotExample("Build plot in pieces",
|
||||||
"Start with a base plot...",
|
"Start with a base plot...",
|
||||||
[:(plot(rand(100)/3, reg=true, fill=0))]),
|
[:(plot(rand(100)/3, reg=true, fill=0))]),
|
||||||
@ -51,17 +51,17 @@ const examples = PlotExample[
|
|||||||
[:(heatmap(randn(10000),randn(10000), nbins=100))]),
|
[:(heatmap(randn(10000),randn(10000), nbins=100))]),
|
||||||
PlotExample("Line types",
|
PlotExample("Line types",
|
||||||
"",
|
"",
|
||||||
[:(types = intersect(supportedTypes(), [:line, :path, :steppre, :steppost, :sticks, :scatter])),
|
[:(types = intersect(supportedTypes(), [:line, :path, :steppre, :steppost, :sticks, :scatter])'),
|
||||||
:(n = length(types)),
|
:(n = length(types)),
|
||||||
:(x = Vector[sort(rand(20)) for i in 1:n]),
|
:(x = Vector[sort(rand(20)) for i in 1:n]),
|
||||||
:(y = rand(20,n)),
|
:(y = rand(20,n)),
|
||||||
:(plot(x, y, t=types, lab=map(string,types)))]),
|
:(plot(x, y, line=(types,3), lab=map(string,types), ms=15))]),
|
||||||
PlotExample("Line styles",
|
PlotExample("Line styles",
|
||||||
"",
|
"",
|
||||||
[:(styles = setdiff(supportedStyles(), [:auto])), :(plot(cumsum(randn(20,length(styles)),1); style=:auto, label=map(string,styles), w=5))]),
|
[:(styles = setdiff(supportedStyles(), [:auto])'), :(plot(cumsum(randn(20,length(styles)),1); style=:auto, label=map(string,styles), w=5))]),
|
||||||
PlotExample("Marker types",
|
PlotExample("Marker types",
|
||||||
"",
|
"",
|
||||||
[:(markers = setdiff(supportedMarkers(), [:none,:auto])), :(scatter(0.5:9.5, [fill(i-0.5,10) for i=length(markers):-1:1]; marker=:auto, label=map(string,markers), ms=10))]),
|
[:(markers = setdiff(supportedMarkers(), [:none,:auto])'), :(scatter(0.5:9.5, [fill(i-0.5,10) for i=length(markers):-1:1]; marker=:auto, label=map(string,markers), ms=12))]),
|
||||||
PlotExample("Bar",
|
PlotExample("Bar",
|
||||||
"x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)",
|
"x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)",
|
||||||
[:(bar(randn(1000)))]),
|
[:(bar(randn(1000)))]),
|
||||||
@ -74,7 +74,7 @@ const examples = PlotExample[
|
|||||||
You can define the layout with keyword params... either set the number of plots `n` (and optionally number of rows `nr` or
|
You can define the layout with keyword params... either set the number of plots `n` (and optionally number of rows `nr` or
|
||||||
number of columns `nc`), or you can set the layout directly with `layout`.
|
number of columns `nc`), or you can set the layout directly with `layout`.
|
||||||
""",
|
""",
|
||||||
[:(subplot(randn(100,5), layout=[1,1,3], t=[:line,:hist,:scatter,:step,:bar], nbins=10, leg=false))]),
|
[:(subplot(randn(100,5), layout=[1,1,3], t=[:line :hist :scatter :step :bar], nbins=10, leg=false))]),
|
||||||
PlotExample("Adding to subplots",
|
PlotExample("Adding to subplots",
|
||||||
"Note here the automatic grid layout, as well as the order in which new series are added to the plots.",
|
"Note here the automatic grid layout, as well as the order in which new series are added to the plots.",
|
||||||
[:(subplot(randn(100,5), n=4))]),
|
[:(subplot(randn(100,5), n=4))]),
|
||||||
@ -162,7 +162,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
# make and display one plot
|
# make and display one plot
|
||||||
function test_example(pkgname::Symbol, idx::Int)
|
function test_example(pkgname::Symbol, idx::Int, debug = true)
|
||||||
|
Plots._debugMode.on = debug
|
||||||
println("Testing plot: $pkgname:$idx:$(examples[idx].header)")
|
println("Testing plot: $pkgname:$idx:$(examples[idx].header)")
|
||||||
backend(pkgname)
|
backend(pkgname)
|
||||||
backend()
|
backend()
|
||||||
@ -173,7 +174,7 @@ function test_example(pkgname::Symbol, idx::Int)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# generate all plots and create a dict mapping idx --> plt
|
# generate all plots and create a dict mapping idx --> plt
|
||||||
function test_all_examples(pkgname::Symbol)
|
function test_all_examples(pkgname::Symbol, debug = false)
|
||||||
plts = Dict()
|
plts = Dict()
|
||||||
for i in 1:length(examples)
|
for i in 1:length(examples)
|
||||||
# if examples[i].header == "Subplots" && !subplotSupported()
|
# if examples[i].header == "Subplots" && !subplotSupported()
|
||||||
@ -181,7 +182,7 @@ function test_all_examples(pkgname::Symbol)
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
try
|
try
|
||||||
plt = test_example(pkgname, i)
|
plt = test_example(pkgname, i, debug)
|
||||||
plts[i] = plt
|
plts[i] = plt
|
||||||
catch ex
|
catch ex
|
||||||
# TODO: put error info into markdown?
|
# TODO: put error info into markdown?
|
||||||
@ -280,6 +281,8 @@ function buildReadme()
|
|||||||
Plots.dumpSupportGraphs()
|
Plots.dumpSupportGraphs()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
default(size=(600,400))
|
||||||
|
|
||||||
# run it!
|
# run it!
|
||||||
# note: generate separately so it's easy to comment out
|
# note: generate separately so it's easy to comment out
|
||||||
# @osx_only generate_markdown(:unicodeplots)
|
# @osx_only generate_markdown(:unicodeplots)
|
||||||
|
|||||||
@ -119,23 +119,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 40,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"INFO: Recompiling stale cache file /home/tom/.julia/lib/v0.4/Plots.ji for module Plots.\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"[Plots.jl] Default backend: immerse"
|
"0.0"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -145,344 +138,95 @@
|
|||||||
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
|
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
|
||||||
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
|
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
|
||||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n",
|
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n",
|
||||||
" width=\"250.0mm\" height=\"25.0mm\"\n",
|
" width=\"100.0mm\" height=\"25.0mm\"\n",
|
||||||
" shape-rendering=\"crispEdges\">\n",
|
" shape-rendering=\"crispEdges\">\n",
|
||||||
"<rect x=\"0.0mm\" y=\"0.0mm\"\n",
|
"<rect x=\"0.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#F2F2F2\" stroke=\"none\" />\n",
|
" fill=\"#0000CC\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"2.4752475247524752mm\" y=\"0.0mm\"\n",
|
"<rect x=\"5.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#F0F0F0\" stroke=\"none\" />\n",
|
" fill=\"#4D004D\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"4.9504950495049505mm\" y=\"0.0mm\"\n",
|
"<rect x=\"10.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#EEEEEE\" stroke=\"none\" />\n",
|
" fill=\"#CC7200\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"7.425742574257425mm\" y=\"0.0mm\"\n",
|
"<rect x=\"15.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#EBEBEB\" stroke=\"none\" />\n",
|
" fill=\"#004D00\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"9.900990099009901mm\" y=\"0.0mm\"\n",
|
"<rect x=\"20.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#E9E9E9\" stroke=\"none\" />\n",
|
" fill=\"#CC0000\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"12.376237623762377mm\" y=\"0.0mm\"\n",
|
"<rect x=\"25.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#E7E7E7\" stroke=\"none\" />\n",
|
" fill=\"#002666\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"14.85148514851485mm\" y=\"0.0mm\"\n",
|
"<rect x=\"30.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#E4E4E4\" stroke=\"none\" />\n",
|
" fill=\"#666000\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"17.326732673267326mm\" y=\"0.0mm\"\n",
|
"<rect x=\"35.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#E2E2E2\" stroke=\"none\" />\n",
|
" fill=\"#CC3900\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"19.801980198019802mm\" y=\"0.0mm\"\n",
|
"<rect x=\"40.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#E0E0E0\" stroke=\"none\" />\n",
|
" fill=\"#8C0026\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"22.277227722772277mm\" y=\"0.0mm\"\n",
|
"<rect x=\"45.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#DEDEDE\" stroke=\"none\" />\n",
|
" fill=\"#001399\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"24.752475247524753mm\" y=\"0.0mm\"\n",
|
"<rect x=\"50.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#DBDBDB\" stroke=\"none\" />\n",
|
" fill=\"#003A33\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"27.22772277227723mm\" y=\"0.0mm\"\n",
|
"<rect x=\"55.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#D9D9D9\" stroke=\"none\" />\n",
|
" fill=\"#335600\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"29.7029702970297mm\" y=\"0.0mm\"\n",
|
"<rect x=\"60.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#D7D7D7\" stroke=\"none\" />\n",
|
" fill=\"#996900\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"32.17821782178218mm\" y=\"0.0mm\"\n",
|
"<rect x=\"65.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#D4D4D4\" stroke=\"none\" />\n",
|
" fill=\"#CC5600\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"34.65346534653465mm\" y=\"0.0mm\"\n",
|
"<rect x=\"70.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#D2D2D2\" stroke=\"none\" />\n",
|
" fill=\"#CC1C00\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"37.12871287128713mm\" y=\"0.0mm\"\n",
|
"<rect x=\"75.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#D0D0D0\" stroke=\"none\" />\n",
|
" fill=\"#AC0013\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"39.603960396039604mm\" y=\"0.0mm\"\n",
|
"<rect x=\"80.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#CECECE\" stroke=\"none\" />\n",
|
" fill=\"#6D003A\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"42.07920792079208mm\" y=\"0.0mm\"\n",
|
"<rect x=\"85.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#CBCBCB\" stroke=\"none\" />\n",
|
" fill=\"#000AB3\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"44.554455445544555mm\" y=\"0.0mm\"\n",
|
"<rect x=\"90.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#C9C9C9\" stroke=\"none\" />\n",
|
" fill=\"#001D80\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"47.02970297029703mm\" y=\"0.0mm\"\n",
|
"<rect x=\"95.0mm\" y=\"0.0mm\"\n",
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
" width=\"4.0mm\" height=\"25.0mm\"\n",
|
||||||
" fill=\"#C7C7C7\" stroke=\"none\" />\n",
|
" fill=\"#00304D\" stroke=\"none\" />\n",
|
||||||
"<rect x=\"49.504950495049506mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#C4C4C4\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"51.98019801980198mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#C2C2C2\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"54.45544554455446mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#C0C0C0\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"56.93069306930693mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#BDBDBD\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"59.4059405940594mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#BBBBBB\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"61.88118811881188mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#B9B9B9\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"64.35643564356435mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#B7B7B7\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"66.83168316831683mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#B4B4B4\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"69.3069306930693mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#B2B2B2\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"71.78217821782178mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#B0B0B0\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"74.25742574257426mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#ADADAD\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"76.73267326732673mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#ABABAB\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"79.20792079207921mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#A9A9A9\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"81.68316831683168mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#A7A7A7\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"84.15841584158416mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#A4A4A4\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"86.63366336633663mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#A2A2A2\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"89.10891089108911mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#A0A0A0\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"91.58415841584159mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#9D9D9D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"94.05940594059406mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#9B9B9B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"96.53465346534654mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#999999\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"99.00990099009901mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#969696\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"101.48514851485149mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#949494\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"103.96039603960396mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#929292\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"106.43564356435644mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#909090\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"108.91089108910892mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#8D8D8D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"111.38613861386139mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#8B8B8B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"113.86138613861387mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#898989\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"116.33663366336634mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#868686\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"118.8118811881188mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#848484\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"121.28712871287128mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#828282\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"123.76237623762376mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#808080\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"126.23762376237623mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#7D7D7D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"128.7128712871287mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#7B7B7B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"131.1881188118812mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#797979\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"133.66336633663366mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#767676\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"136.13861386138615mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#747474\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"138.6138613861386mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#727272\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"141.0891089108911mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#6F6F6F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"143.56435643564356mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#6D6D6D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"146.03960396039605mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#6B6B6B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"148.5148514851485mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#696969\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"150.990099009901mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#666666\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"153.46534653465346mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#646464\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"155.94059405940595mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#626262\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"158.41584158415841mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#5F5F5F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"160.89108910891088mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#5D5D5D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"163.36633663366337mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#5B5B5B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"165.84158415841583mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#585858\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"168.31683168316832mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#565656\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"170.79207920792078mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#545454\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"173.26732673267327mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#525252\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"175.74257425742573mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#4F4F4F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"178.21782178217822mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#4D4D4D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"180.69306930693068mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#4B4B4B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"183.16831683168317mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#484848\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"185.64356435643563mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#464646\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"188.11881188118812mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#444444\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"190.59405940594058mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#424242\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"193.06930693069307mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#3F3F3F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"195.54455445544554mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#3D3D3D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"198.01980198019803mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#3B3B3B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"200.4950495049505mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#383838\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"202.97029702970298mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#363636\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"205.44554455445544mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#343434\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"207.92079207920793mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#313131\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"210.3960396039604mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#2F2F2F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"212.87128712871288mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#2D2D2D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"215.34653465346534mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#2B2B2B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"217.82178217821783mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#282828\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"220.2970297029703mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#262626\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"222.77227722772278mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#242424\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"225.24752475247524mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#212121\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"227.72277227722773mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#1F1F1F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"230.1980198019802mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#1D1D1D\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"232.67326732673268mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#1B1B1B\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"235.14851485148515mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#181818\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"237.6237623762376mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#161616\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"240.0990099009901mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#141414\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"242.57425742574256mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#111111\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"245.04950495049505mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#0F0F0F\" stroke=\"none\" />\n",
|
|
||||||
"<rect x=\"247.5247524752475mm\" y=\"0.0mm\"\n",
|
|
||||||
" width=\"2.4752475247524752mm\" height=\"25.0mm\"\n",
|
|
||||||
" fill=\"#0D0D0D\" stroke=\"none\" />\n",
|
|
||||||
"</svg>"
|
"</svg>"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"101-element Array{ColorTypes.RGB{T<:Union{AbstractFloat,FixedPointNumbers.FixedPoint}},1}:\n",
|
"20-element Array{ColorTypes.RGB{T<:Union{AbstractFloat,FixedPointNumbers.FixedPoint}},1}:\n",
|
||||||
" RGB{Float64}(0.95,0.95,0.95) \n",
|
" RGB{Float64}(0.0,0.0,0.8) \n",
|
||||||
" RGB{Float64}(0.941,0.941,0.941)\n",
|
" RGB{Float64}(0.301961,0.0,0.301961)\n",
|
||||||
" RGB{Float64}(0.932,0.932,0.932)\n",
|
" RGB{Float64}(0.8,0.447059,0.0) \n",
|
||||||
" RGB{Float64}(0.923,0.923,0.923)\n",
|
" RGB{Float64}(0.0,0.301961,0.0) \n",
|
||||||
" RGB{Float64}(0.914,0.914,0.914)\n",
|
" RGB{Float64}(0.8,0.0,0.0) \n",
|
||||||
" RGB{Float64}(0.905,0.905,0.905)\n",
|
" RGB{Float64}(0.0,0.15098,0.4) \n",
|
||||||
" RGB{Float64}(0.896,0.896,0.896)\n",
|
" RGB{Float64}(0.4,0.37451,0.0) \n",
|
||||||
" RGB{Float64}(0.887,0.887,0.887)\n",
|
" RGB{Float64}(0.8,0.223529,0.0) \n",
|
||||||
" RGB{Float64}(0.878,0.878,0.878)\n",
|
" RGB{Float64}(0.55098,0.0,0.15098) \n",
|
||||||
" RGB{Float64}(0.869,0.869,0.869)\n",
|
" RGB{Float64}(0.0,0.0754902,0.6) \n",
|
||||||
" RGB{Float64}(0.86,0.86,0.86) \n",
|
" RGB{Float64}(0.0,0.226471,0.2) \n",
|
||||||
" RGB{Float64}(0.851,0.851,0.851)\n",
|
" RGB{Float64}(0.2,0.338235,0.0) \n",
|
||||||
" RGB{Float64}(0.842,0.842,0.842)\n",
|
" RGB{Float64}(0.6,0.410784,0.0) \n",
|
||||||
" ⋮ \n",
|
" RGB{Float64}(0.8,0.335294,0.0) \n",
|
||||||
" RGB{Float64}(0.149,0.149,0.149)\n",
|
" RGB{Float64}(0.8,0.111765,0.0) \n",
|
||||||
" RGB{Float64}(0.14,0.14,0.14) \n",
|
" RGB{Float64}(0.67549,0.0,0.0754902)\n",
|
||||||
" RGB{Float64}(0.131,0.131,0.131)\n",
|
" RGB{Float64}(0.426471,0.0,0.226471)\n",
|
||||||
" RGB{Float64}(0.122,0.122,0.122)\n",
|
" RGB{Float64}(0.0,0.0377451,0.7) \n",
|
||||||
" RGB{Float64}(0.113,0.113,0.113)\n",
|
" RGB{Float64}(0.0,0.113235,0.5) \n",
|
||||||
" RGB{Float64}(0.104,0.104,0.104)\n",
|
" RGB{Float64}(0.0,0.188725,0.3) "
|
||||||
" RGB{Float64}(0.095,0.095,0.095)\n",
|
|
||||||
" RGB{Float64}(0.086,0.086,0.086)\n",
|
|
||||||
" RGB{Float64}(0.077,0.077,0.077)\n",
|
|
||||||
" RGB{Float64}(0.068,0.068,0.068)\n",
|
|
||||||
" RGB{Float64}(0.059,0.059,0.059)\n",
|
|
||||||
" RGB{Float64}(0.05,0.05,0.05) "
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 1,
|
"execution_count": 40,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
},
|
},
|
||||||
@ -490,7 +234,26 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"\n"
|
"\n",
|
||||||
|
"1.0\n",
|
||||||
|
"0.5\n",
|
||||||
|
"0.25\n",
|
||||||
|
"0.75\n",
|
||||||
|
"0.125\n",
|
||||||
|
"0.375\n",
|
||||||
|
"0.625\n",
|
||||||
|
"0.875\n",
|
||||||
|
"0.0625\n",
|
||||||
|
"0.1875\n",
|
||||||
|
"0.3125\n",
|
||||||
|
"0.4375\n",
|
||||||
|
"0.5625\n",
|
||||||
|
"0.6875\n",
|
||||||
|
"0.8125\n",
|
||||||
|
"0.9375\n",
|
||||||
|
"0.03125\n",
|
||||||
|
"0.09375\n",
|
||||||
|
"0.15625\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -498,7 +261,29 @@
|
|||||||
"using Plots\n",
|
"using Plots\n",
|
||||||
"#grad = Plots.ColorGradient([colorant\"blue\", RGB(0.7,0.85,0.7), colorant\"darkred\"], [0,0.5,1])\n",
|
"#grad = Plots.ColorGradient([colorant\"blue\", RGB(0.7,0.85,0.7), colorant\"darkred\"], [0,0.5,1])\n",
|
||||||
"#grad = Plots.ColorGradient(:bluesreds)\n",
|
"#grad = Plots.ColorGradient(:bluesreds)\n",
|
||||||
"grad = Plots.ColorGradient([RGB(.95,.95,.95),RGB(.05,.05,.05)])\n",
|
"#grad = Plots.ColorGradient([RGB(.95,.95,.95),RGB(.05,.05,.05)])\n",
|
||||||
|
"\n",
|
||||||
|
"function darken(c, v=0.2)\n",
|
||||||
|
" rgb = RGB(c)\n",
|
||||||
|
" r = max(0, rgb.r - v)\n",
|
||||||
|
" g = max(0, rgb.g - v)\n",
|
||||||
|
" b = max(0, rgb.b - v)\n",
|
||||||
|
" RGB(r,g,b)\n",
|
||||||
|
"end\n",
|
||||||
|
"function lighten(c, v=0.2)\n",
|
||||||
|
" darken(c, -v)\n",
|
||||||
|
"end\n",
|
||||||
|
"\n",
|
||||||
|
"func = darken\n",
|
||||||
|
"grad = Plots.ColorGradient(map(func, [\n",
|
||||||
|
" colorant\"blue\",\n",
|
||||||
|
" colorant\"green\",\n",
|
||||||
|
" #colorant\"yellow\",\n",
|
||||||
|
" colorant\"orange\",\n",
|
||||||
|
" colorant\"red\",\n",
|
||||||
|
" colorant\"purple\",\n",
|
||||||
|
" ]))\n",
|
||||||
|
"\n",
|
||||||
"#grad = Plots.ColorGradient([\n",
|
"#grad = Plots.ColorGradient([\n",
|
||||||
"# colorant\"lightyellow\",\n",
|
"# colorant\"lightyellow\",\n",
|
||||||
"# colorant\"orange\",\n",
|
"# colorant\"orange\",\n",
|
||||||
@ -506,7 +291,56 @@
|
|||||||
"# #colorant\"black\"\n",
|
"# #colorant\"black\"\n",
|
||||||
"# ])\n",
|
"# ])\n",
|
||||||
"#grad = Plots.ColorGradient(:heat)\n",
|
"#grad = Plots.ColorGradient(:heat)\n",
|
||||||
"colors = RGB[Plots.getColor(grad, x) for x in 0:0.01:1]"
|
"\n",
|
||||||
|
"function getrange(n::Int)\n",
|
||||||
|
" zs = zeros(n)\n",
|
||||||
|
" offset = 0.0\n",
|
||||||
|
" baseoffset = 0.1\n",
|
||||||
|
" z = offset\n",
|
||||||
|
" chg = 0.5\n",
|
||||||
|
" for i in 1:n\n",
|
||||||
|
" zs[i] = z\n",
|
||||||
|
" \n",
|
||||||
|
" z += chg\n",
|
||||||
|
" if z > 1.0\n",
|
||||||
|
" offset += 0.1\n",
|
||||||
|
" if offset > 0.5\n",
|
||||||
|
" baseoffset *= 0.5\n",
|
||||||
|
" offset = baseoffset\n",
|
||||||
|
" end\n",
|
||||||
|
" z = offset\n",
|
||||||
|
"# chg *= 0.5\n",
|
||||||
|
" #z += chg\n",
|
||||||
|
" end\n",
|
||||||
|
" end\n",
|
||||||
|
" zs\n",
|
||||||
|
"end\n",
|
||||||
|
"\n",
|
||||||
|
"function getrange2(n::Int)\n",
|
||||||
|
" n > 0 || error()\n",
|
||||||
|
" n == 1 && return zeros(1)\n",
|
||||||
|
" zs = [0.0, 1.0]\n",
|
||||||
|
" for i in 3:n\n",
|
||||||
|
" sorted = sort(zs)\n",
|
||||||
|
" diffs = diff(sorted)\n",
|
||||||
|
" widestj = 0\n",
|
||||||
|
" widest = 0.0\n",
|
||||||
|
" for (j,d) in enumerate(diffs)\n",
|
||||||
|
" if d > widest\n",
|
||||||
|
" widest = d\n",
|
||||||
|
" widestj = j\n",
|
||||||
|
" end\n",
|
||||||
|
" end\n",
|
||||||
|
" push!(zs, sorted[widestj] + 0.5 * diffs[widestj])\n",
|
||||||
|
" end\n",
|
||||||
|
" zs\n",
|
||||||
|
"end\n",
|
||||||
|
"\n",
|
||||||
|
"#colors = RGB[Plots.getColorZ(grad,z) for z in 0:0.01:1]\n",
|
||||||
|
"#zs = map(z->z%1.0, 0:.285:3)\n",
|
||||||
|
"zs = getrange2(20)\n",
|
||||||
|
"map(println, zs)\n",
|
||||||
|
"colors = RGB[Plots.getColorZ(grad, z) for z in zs]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
56
src/args.jl
56
src/args.jl
@ -309,7 +309,7 @@ end
|
|||||||
wraptuple(x::Tuple) = x
|
wraptuple(x::Tuple) = x
|
||||||
wraptuple(x) = (x,)
|
wraptuple(x) = (x,)
|
||||||
|
|
||||||
trueOrAllTrue(f::Function, x::AVec) = all(f, x)
|
trueOrAllTrue(f::Function, x::AbstractArray) = all(f, x)
|
||||||
trueOrAllTrue(f::Function, x) = f(x)
|
trueOrAllTrue(f::Function, x) = f(x)
|
||||||
|
|
||||||
function handleColors!(d::Dict, arg, csym::Symbol)
|
function handleColors!(d::Dict, arg, csym::Symbol)
|
||||||
@ -336,6 +336,9 @@ function processAxisArg(d::Dict, axisletter::AbstractString, arg)
|
|||||||
d[symbol(axisletter * "flip")] = true
|
d[symbol(axisletter * "flip")] = true
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
elseif T <: AbstractString
|
||||||
|
d[symbol(axisletter * "label")] = arg
|
||||||
|
|
||||||
# xlims/ylims
|
# xlims/ylims
|
||||||
elseif (T <: Tuple || T <: AVec) && length(arg) == 2
|
elseif (T <: Tuple || T <: AVec) && length(arg) == 2
|
||||||
d[symbol(axisletter * "lims")] = arg
|
d[symbol(axisletter * "lims")] = arg
|
||||||
@ -492,21 +495,38 @@ function warnOnUnsupportedScales(pkg::PlottingPackage, d::Dict)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Tuples and 1-row matrices will give an element
|
||||||
|
# multi-row matrices will give a column
|
||||||
|
# anything else is returned as-is
|
||||||
|
getArgValue(v::Tuple, idx::Int) = v[mod1(idx, length(v))]
|
||||||
|
function getArgValue(v::AMat, idx::Int)
|
||||||
|
c = mod1(idx, size(v,2))
|
||||||
|
size(v,1) == 1 ? v[1,c] : v[:,c]
|
||||||
|
end
|
||||||
|
getArgValue(v, idx) = v
|
||||||
|
|
||||||
|
|
||||||
|
# given an argument key (k), we want to extract the argument value for this index.
|
||||||
|
# if nothing is set (or container is empty), return the default.
|
||||||
|
function setDictValue(d::Dict, k::Symbol, idx::Int, defaults::Dict)
|
||||||
|
if haskey(d, k) && !(typeof(d[k]) <: Union{AbstractArray, Tuple} && isempty(d[k]))
|
||||||
|
d[k] = getArgValue(d[k], idx)
|
||||||
|
else
|
||||||
|
d[k] = defaults[k]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
# build the argument dictionary for the plot
|
# build the argument dictionary for the plot
|
||||||
function getPlotArgs(pkg::PlottingPackage, kw, idx::Int)
|
function getPlotArgs(pkg::PlottingPackage, kw, idx::Int)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
|
||||||
# add defaults?
|
# add defaults?
|
||||||
for k in keys(_plotDefaults)
|
for k in keys(_plotDefaults)
|
||||||
if haskey(d, k)
|
setDictValue(d, k, idx, _plotDefaults)
|
||||||
v = d[k]
|
|
||||||
if isa(v, AbstractVector) && !isempty(v)
|
|
||||||
# we got a vector, cycling through
|
|
||||||
d[k] = autopick(v, idx)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
d[k] = _plotDefaults[k]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for k in (:xscale, :yscale)
|
for k in (:xscale, :yscale)
|
||||||
@ -517,7 +537,6 @@ function getPlotArgs(pkg::PlottingPackage, kw, idx::Int)
|
|||||||
|
|
||||||
# convert color
|
# convert color
|
||||||
handlePlotColors(pkg, d)
|
handlePlotColors(pkg, d)
|
||||||
# d[:background_color] = getBackgroundRGBColor(d[:background_color], d)
|
|
||||||
|
|
||||||
# no need for these
|
# no need for these
|
||||||
delete!(d, :x)
|
delete!(d, :x)
|
||||||
@ -534,15 +553,7 @@ function getSeriesArgs(pkg::PlottingPackage, initargs::Dict, kw, commandIndex::I
|
|||||||
|
|
||||||
# add defaults?
|
# add defaults?
|
||||||
for k in keys(_seriesDefaults)
|
for k in keys(_seriesDefaults)
|
||||||
if haskey(d, k)
|
setDictValue(d, k, commandIndex, _seriesDefaults)
|
||||||
v = d[k]
|
|
||||||
if isa(v, AbstractVector) && !isempty(v)
|
|
||||||
# we got a vector, cycling through
|
|
||||||
d[k] = autopick(v, commandIndex)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
d[k] = _seriesDefaults[k]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if haskey(_typeAliases, d[:linetype])
|
if haskey(_typeAliases, d[:linetype])
|
||||||
@ -561,6 +572,11 @@ function getSeriesArgs(pkg::PlottingPackage, initargs::Dict, kw, commandIndex::I
|
|||||||
mc = (mc == :match ? d[:color] : getSeriesRGBColor(mc, initargs, plotIndex))
|
mc = (mc == :match ? d[:color] : getSeriesRGBColor(mc, initargs, plotIndex))
|
||||||
d[:markercolor] = mc
|
d[:markercolor] = mc
|
||||||
|
|
||||||
|
# update fillcolor
|
||||||
|
mc = d[:fillcolor]
|
||||||
|
mc = (mc == :match ? d[:color] : getSeriesRGBColor(mc, initargs, plotIndex))
|
||||||
|
d[:fillcolor] = mc
|
||||||
|
|
||||||
# set label
|
# set label
|
||||||
label = d[:label]
|
label = d[:label]
|
||||||
label = (label == "AUTO" ? "y$globalIndex" : label)
|
label = (label == "AUTO" ? "y$globalIndex" : label)
|
||||||
|
|||||||
@ -82,7 +82,7 @@ function createGadflyPlotObject(d::Dict)
|
|||||||
unshift!(gplt.guides, Gadfly.Guide.manual_color_key("", AbstractString[], Color[]))
|
unshift!(gplt.guides, Gadfly.Guide.manual_color_key("", AbstractString[], Color[]))
|
||||||
end
|
end
|
||||||
|
|
||||||
gplt.theme = Gadfly.Theme(background_color = d[:background_color])
|
gplt.theme = Gadfly.Theme(background_color = getColor(d[:background_color]))
|
||||||
gplt
|
gplt
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -111,12 +111,12 @@ end
|
|||||||
|
|
||||||
|
|
||||||
# serious hack (I think?) to draw my own shapes as annotations... will it work? who knows...
|
# serious hack (I think?) to draw my own shapes as annotations... will it work? who knows...
|
||||||
function getMarkerGeomsAndGuides(d::Dict)
|
function getMarkerGeomsAndGuides(d::Dict, initargs::Dict)
|
||||||
marker = d[:markershape]
|
marker = d[:markershape]
|
||||||
if marker == :none && d[:linetype] != :ohlc
|
if marker == :none && d[:linetype] != :ohlc
|
||||||
return [],[]
|
return [],[]
|
||||||
end
|
end
|
||||||
return [], [createGadflyAnnotation(d)]
|
return [], [createGadflyAnnotation(d, initargs)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
# set theme: color, line linewidth, and point size
|
# set theme: color, line linewidth, and point size
|
||||||
line_width = d[:linewidth] * (d[:linetype] in (:none, :ohlc, :scatter) ? 0 : 1) * Gadfly.px # 0 linewidth when we don't show a line
|
line_width = d[:linewidth] * (d[:linetype] in (:none, :ohlc, :scatter) ? 0 : 1) * Gadfly.px # 0 linewidth when we don't show a line
|
||||||
# line_color = isa(d[:color], AbstractVector) ? colorant"black" : d[:color]
|
# line_color = isa(d[:color], AbstractVector) ? colorant"black" : d[:color]
|
||||||
line_color = getColor(d[:color], 1)
|
line_color = getColor(d[:color])
|
||||||
# fg = initargs[:foreground_color]
|
# fg = initargs[:foreground_color]
|
||||||
theme = Gadfly.Theme(; default_color = line_color,
|
theme = Gadfly.Theme(; default_color = line_color,
|
||||||
line_width = line_width,
|
line_width = line_width,
|
||||||
@ -175,7 +175,7 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
|
|
||||||
# add the annotation
|
# add the annotation
|
||||||
if dScatter[:markershape] != :none
|
if dScatter[:markershape] != :none
|
||||||
push!(gplt.guides, createGadflyAnnotation(dScatter))
|
push!(gplt.guides, createGadflyAnnotation(dScatter, initargs))
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif d[:linetype] in (:hline, :vline)
|
elseif d[:linetype] in (:hline, :vline)
|
||||||
@ -222,7 +222,7 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
if !isa(d[:markercolor], ColorGradient)
|
if !isa(d[:markercolor], ColorGradient)
|
||||||
d[:markercolor] = colorscheme(:bluesreds)
|
d[:markercolor] = colorscheme(:bluesreds)
|
||||||
end
|
end
|
||||||
push!(gplt.scales, Gadfly.Scale.ContinuousColorScale(p -> getColor(d[:markercolor], p, 1))) # minz + p * (maxz - minz))))
|
push!(gplt.scales, Gadfly.Scale.ContinuousColorScale(p -> getColorZ(d[:markercolor], p))) # minz + p * (maxz - minz))))
|
||||||
|
|
||||||
# nothing special...
|
# nothing special...
|
||||||
else
|
else
|
||||||
@ -264,7 +264,7 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
# handle markers
|
# handle markers
|
||||||
geoms, guides = getMarkerGeomsAndGuides(d)
|
geoms, guides = getMarkerGeomsAndGuides(d, initargs)
|
||||||
append!(gfargs, geoms)
|
append!(gfargs, geoms)
|
||||||
append!(gplt.guides, guides)
|
append!(gplt.guides, guides)
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
|
|||||||
# Should ensure from this side that colors which are the same are merged together
|
# Should ensure from this side that colors which are the same are merged together
|
||||||
|
|
||||||
push!(guide.labels, d[:label])
|
push!(guide.labels, d[:label])
|
||||||
push!(guide.colors, getColor(d[d[:markershape] == :none ? :color : :markercolor], 1))
|
push!(guide.colors, getColor(d[d[:markershape] == :none ? :color : :markercolor]))
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
@ -339,7 +339,7 @@ function getGadflyScaleFunction(d::Dict, isx::Bool)
|
|||||||
scale = d[scalekey]
|
scale = d[scalekey]
|
||||||
scale == :log && return isx ? Gadfly.Scale.x_log : Gadfly.Scale.y_log, hasScaleKey
|
scale == :log && return isx ? Gadfly.Scale.x_log : Gadfly.Scale.y_log, hasScaleKey
|
||||||
scale == :log2 && return isx ? Gadfly.Scale.x_log2 : Gadfly.Scale.y_log2, hasScaleKey
|
scale == :log2 && return isx ? Gadfly.Scale.x_log2 : Gadfly.Scale.y_log2, hasScaleKey
|
||||||
scale == :log10 && return isx ? Gadfly.Scale.x_log2 : Gadfly.Scale.y_log10, hasScaleKey
|
scale == :log10 && return isx ? Gadfly.Scale.x_log10 : Gadfly.Scale.y_log10, hasScaleKey
|
||||||
scale == :asinh && return isx ? Gadfly.Scale.x_asinh : Gadfly.Scale.y_asinh, hasScaleKey
|
scale == :asinh && return isx ? Gadfly.Scale.x_asinh : Gadfly.Scale.y_asinh, hasScaleKey
|
||||||
scale == :sqrt && return isx ? Gadfly.Scale.x_sqrt : Gadfly.Scale.y_sqrt, hasScaleKey
|
scale == :sqrt && return isx ? Gadfly.Scale.x_sqrt : Gadfly.Scale.y_sqrt, hasScaleKey
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
# using Compose: x_measure, y_measure
|
# using Compose: x_measure, y_measure
|
||||||
|
|
||||||
|
|
||||||
function createGadflyAnnotation(d::Dict)
|
function createGadflyAnnotation(d::Dict, initargs::Dict)
|
||||||
sz = [d[:markersize] * Gadfly.px]
|
sz = [d[:markersize] * Gadfly.px]
|
||||||
|
|
||||||
x, y = d[:x], d[:y]
|
x, y = d[:x], d[:y]
|
||||||
@ -14,7 +14,7 @@ function createGadflyAnnotation(d::Dict)
|
|||||||
shape = ohlcshape(x, y, d[:markersize])
|
shape = ohlcshape(x, y, d[:markersize])
|
||||||
d[:y] = Float64[z.open for z in y]
|
d[:y] = Float64[z.open for z in y]
|
||||||
d[:linetype] = :none
|
d[:linetype] = :none
|
||||||
return Gadfly.Guide.annotation(Gadfly.compose(Gadfly.context(), shape, Gadfly.fill(nothing), Gadfly.stroke(getColor(d[:color],1))))
|
return Gadfly.Guide.annotation(Gadfly.compose(Gadfly.context(), shape, Gadfly.fill(nothing), Gadfly.stroke(getColor(d[:color]))))
|
||||||
|
|
||||||
elseif marker == :rect
|
elseif marker == :rect
|
||||||
shape = square(x, y, sz)
|
shape = square(x, y, sz)
|
||||||
@ -54,7 +54,7 @@ function createGadflyAnnotation(d::Dict)
|
|||||||
shape = Gadfly.circle(xs,ys,[sz])
|
shape = Gadfly.circle(xs,ys,[sz])
|
||||||
end
|
end
|
||||||
|
|
||||||
Gadfly.Guide.annotation(Gadfly.compose(Gadfly.context(), shape, Gadfly.fill(getColorVector(d[:markercolor])), Gadfly.stroke(colorant"white")))
|
Gadfly.Guide.annotation(Gadfly.compose(Gadfly.context(), shape, Gadfly.fill(getColorVector(d[:markercolor])), Gadfly.stroke(getColor(initargs[:foreground_color]))))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,8 @@ supportedArgs(::WinstonPackage) = [
|
|||||||
# :axis,
|
# :axis,
|
||||||
# :background_color,
|
# :background_color,
|
||||||
:color,
|
:color,
|
||||||
# :fill,
|
:fillrange,
|
||||||
|
:fillcolor,
|
||||||
# :foreground_color,
|
# :foreground_color,
|
||||||
:group,
|
:group,
|
||||||
# :heatmap_c,
|
# :heatmap_c,
|
||||||
@ -152,12 +153,12 @@ function plot!(::WinstonPackage, plt::Plot; kw...)
|
|||||||
x, y = d[:x], d[:y]
|
x, y = d[:x], d[:y]
|
||||||
Winston.add(wplt, Winston.Curve(x, y; e...))
|
Winston.add(wplt, Winston.Curve(x, y; e...))
|
||||||
|
|
||||||
fillto = d[:fill]
|
fillrange = d[:fillrange]
|
||||||
if fillto != nothing
|
if fillrange != nothing
|
||||||
if isa(fillto, AbstractVector)
|
if isa(fillrange, AbstractVector)
|
||||||
y2 = fillto
|
y2 = fillrange
|
||||||
else
|
else
|
||||||
y2 = Float64[fillto for yi in y]
|
y2 = Float64[fillrange for yi in y]
|
||||||
end
|
end
|
||||||
Winston.add(wplt, Winston.FillBetween(x, y, x, y2, fillcolor=d[:color]))
|
Winston.add(wplt, Winston.FillBetween(x, y, x, y2, fillcolor=d[:color]))
|
||||||
end
|
end
|
||||||
|
|||||||
104
src/colors.jl
104
src/colors.jl
@ -69,6 +69,17 @@ const _masterColorList = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
function darken(c, v=0.1)
|
||||||
|
rgb = RGB(c)
|
||||||
|
r = max(0, rgb.r - v)
|
||||||
|
g = max(0, rgb.g - v)
|
||||||
|
b = max(0, rgb.b - v)
|
||||||
|
RGB(r,g,b)
|
||||||
|
end
|
||||||
|
function lighten(c, v=0.1)
|
||||||
|
darken(c, -v)
|
||||||
|
end
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -80,9 +91,10 @@ convertColor(cvec::AbstractVector) = map(convertColor, cvec)
|
|||||||
|
|
||||||
abstract ColorScheme
|
abstract ColorScheme
|
||||||
|
|
||||||
getColor(scheme::ColorScheme, idx::Integer) = getColor(scheme, 0.0, idx)
|
getColor(scheme::ColorScheme) = getColor(scheme, 1)
|
||||||
getColor(scheme::ColorScheme, z::AbstractFloat) = getColor(scheme, z, 0)
|
# getColor(scheme::ColorScheme, idx::Integer) = getColor(scheme, 0.0, idx)
|
||||||
getColorVector(scheme::ColorScheme) = [getColor(scheme, 0.0, 1)]
|
# getColorZ(scheme::ColorScheme, z::AbstractFloat) = getColor(scheme, z, 0)
|
||||||
|
getColorVector(scheme::ColorScheme) = [getColor(scheme)]
|
||||||
|
|
||||||
colorscheme(scheme::ColorScheme) = scheme
|
colorscheme(scheme::ColorScheme) = scheme
|
||||||
colorscheme(s::Symbol) = haskey(_gradients, s) ? ColorGradient(s) : ColorWrapper(convertColor(s))
|
colorscheme(s::Symbol) = haskey(_gradients, s) ? ColorGradient(s) : ColorWrapper(convertColor(s))
|
||||||
@ -94,6 +106,7 @@ colorscheme(v::AVec) = ColorVector(v)
|
|||||||
colorscheme(m::AMat) = Any[ColorVector(m[:,i]) for i in 1:size(m,2)]
|
colorscheme(m::AMat) = Any[ColorVector(m[:,i]) for i in 1:size(m,2)]
|
||||||
colorscheme(c::Colorant) = ColorWrapper(c)
|
colorscheme(c::Colorant) = ColorWrapper(c)
|
||||||
|
|
||||||
|
const _rainbowColors = [colorant"blue", colorant"purple", colorant"green", colorant"orange", colorant"red"]
|
||||||
|
|
||||||
const _gradients = Dict(
|
const _gradients = Dict(
|
||||||
:blues => [colorant"lightblue", colorant"darkblue"],
|
:blues => [colorant"lightblue", colorant"darkblue"],
|
||||||
@ -103,6 +116,9 @@ const _gradients = Dict(
|
|||||||
:bluesreds => [colorant"darkblue", RGB(0.8,0.85,0.8), colorant"darkred"],
|
:bluesreds => [colorant"darkblue", RGB(0.8,0.85,0.8), colorant"darkred"],
|
||||||
:heat => [colorant"lightyellow", colorant"orange", colorant"darkred"],
|
:heat => [colorant"lightyellow", colorant"orange", colorant"darkred"],
|
||||||
:grays => [RGB(.95,.95,.95),RGB(.05,.05,.05)],
|
:grays => [RGB(.95,.95,.95),RGB(.05,.05,.05)],
|
||||||
|
:rainbow => _rainbowColors,
|
||||||
|
:lightrainbow => map(lighten, _rainbowColors),
|
||||||
|
:darkrainbow => map(darken, _rainbowColors),
|
||||||
)
|
)
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
@ -131,8 +147,9 @@ function ColorGradient{T<:Real}(s::Symbol, vals::AVec{T} = 0:1)
|
|||||||
ColorGradient(cs, vals)
|
ColorGradient(cs, vals)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
getColor(gradient::ColorGradient, idx::Int) = gradient.cs[mod1(idx, length(gradient.cs))]
|
||||||
|
|
||||||
function getColor(gradient::ColorGradient, z::Real, idx::Int)
|
function getColorZ(gradient::ColorGradient, z::Real)
|
||||||
cs = gradient.colors
|
cs = gradient.colors
|
||||||
vs = gradient.values
|
vs = gradient.values
|
||||||
n = length(cs)
|
n = length(cs)
|
||||||
@ -154,7 +171,7 @@ function getColor(gradient::ColorGradient, z::Real, idx::Int)
|
|||||||
cs[end]
|
cs[end]
|
||||||
end
|
end
|
||||||
|
|
||||||
getColorVector(gradient::ColorGradient) = [gradient.colors[1]]
|
getColorVector(gradient::ColorGradient) = gradient.colors
|
||||||
|
|
||||||
function interpolate_lab(c1::Colorant, c2::Colorant, w::Real)
|
function interpolate_lab(c1::Colorant, c2::Colorant, w::Real)
|
||||||
lab1 = Lab(c1)
|
lab1 = Lab(c1)
|
||||||
@ -181,26 +198,31 @@ end
|
|||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
"Wraps a function, taking a z-value and index and returning a Colorant"
|
"Wraps a function, taking an index and returning a Colorant"
|
||||||
immutable ColorFunction <: ColorScheme
|
immutable ColorFunction <: ColorScheme
|
||||||
f::Function
|
f::Function
|
||||||
end
|
end
|
||||||
|
|
||||||
typealias CFun ColorFunction
|
getColor(scheme::ColorFunction, idx::Int) = scheme.f(idx)
|
||||||
|
|
||||||
getColor(scheme::ColorFunction, z::Real, idx::Int) = scheme.f(z, idx)
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
|
"Wraps a function, taking an z-value and returning a Colorant"
|
||||||
|
immutable ColorZFunction <: ColorScheme
|
||||||
|
f::Function
|
||||||
|
end
|
||||||
|
|
||||||
|
getColorZ(scheme::ColorFunction, z::Real) = scheme.f(z)
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
"Wraps a vector of colors... may be vector of Symbol/String/Colorant"
|
"Wraps a vector of colors... may be vector of Symbol/String/Colorant"
|
||||||
immutable ColorVector <: ColorScheme
|
immutable ColorVector <: ColorScheme
|
||||||
v::Vector{Colorant}
|
v::Vector{Colorant}
|
||||||
ColorVector(v::AVec) = convertColor(v)
|
ColorVector(v::AVec) = new(convertColor(v))
|
||||||
end
|
end
|
||||||
|
|
||||||
typealias CVec ColorVector
|
getColor(scheme::ColorVector, idx::Int) = convertColor(scheme.v[mod1(idx, length(scheme.v))])
|
||||||
|
|
||||||
getColor(scheme::ColorVector, z::Real, idx::Int) = convertColor(scheme.v[mod1(idx, length(scheme.v))])
|
|
||||||
getColorVector(scheme::ColorVector) = scheme.v
|
getColorVector(scheme::ColorVector) = scheme.v
|
||||||
|
|
||||||
|
|
||||||
@ -211,9 +233,8 @@ immutable ColorWrapper{C<:Colorant} <: ColorScheme
|
|||||||
c::C
|
c::C
|
||||||
end
|
end
|
||||||
|
|
||||||
typealias CWrap ColorWrapper
|
getColor(scheme::ColorWrapper, idx::Int) = scheme.c
|
||||||
|
getColorZ(scheme::ColorWrapper, z::Real) = scheme.c
|
||||||
getColor(scheme::ColorWrapper, z::Real, idx::Int) = scheme.c
|
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
@ -276,6 +297,37 @@ function getPaletteUsingColorDiffFromBackground(bgcolor::Colorant, numcolors::In
|
|||||||
filter(c -> colordiff(c, bgcolor) >= mindiff, _allColors)
|
filter(c -> colordiff(c, bgcolor) >= mindiff, _allColors)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getPaletteUsingRainbow(bgcolor::Colorant, numcolors::Int = _defaultNumColors)
|
||||||
|
grad = ColorGradient(_gradients[isdark(bgcolor) ? :lightrainbow : :darkrainbow])
|
||||||
|
zrng = getpctrange(numcolors)
|
||||||
|
RGB[getColorZ(grad, z) for z in zrng]
|
||||||
|
end
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
function getpctrange(n::Int)
|
||||||
|
n > 0 || error()
|
||||||
|
n == 1 && return zeros(1)
|
||||||
|
zs = [0.0, 1.0]
|
||||||
|
for i in 3:n
|
||||||
|
sorted = sort(zs)
|
||||||
|
diffs = diff(sorted)
|
||||||
|
widestj = 0
|
||||||
|
widest = 0.0
|
||||||
|
for (j,d) in enumerate(diffs)
|
||||||
|
if d > widest
|
||||||
|
widest = d
|
||||||
|
widestj = j
|
||||||
|
end
|
||||||
|
end
|
||||||
|
push!(zs, sorted[widestj] + 0.5 * diffs[widestj])
|
||||||
|
end
|
||||||
|
zs
|
||||||
|
end
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
# TODO: try to use the algorithms from https://github.com/timothyrenner/ColorBrewer.jl
|
# TODO: try to use the algorithms from https://github.com/timothyrenner/ColorBrewer.jl
|
||||||
# TODO: allow the setting of the algorithm, either by passing a symbol (:colordiff, :fixed, etc) or a function?
|
# TODO: allow the setting of the algorithm, either by passing a symbol (:colordiff, :fixed, etc) or a function?
|
||||||
|
|
||||||
@ -289,22 +341,29 @@ function handlePlotColors(::PlottingPackage, d::Dict)
|
|||||||
warn("Cannot set background_color with backend $(backend())")
|
warn("Cannot set background_color with backend $(backend())")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
d[:background_color] = bgcolor
|
|
||||||
|
|
||||||
# d[:color_palette] = getPaletteUsingDistinguishableColors(bgcolor)
|
# d[:color_palette] = getPaletteUsingDistinguishableColors(bgcolor)
|
||||||
# d[:color_palette] = getPaletteUsingFixedColorList(bgcolor)
|
# d[:color_palette] = getPaletteUsingFixedColorList(bgcolor)
|
||||||
d[:color_palette] = getPaletteUsingColorDiffFromBackground(bgcolor)
|
# d[:color_palette] = getPaletteUsingColorDiffFromBackground(bgcolor)
|
||||||
|
d[:color_palette] = getPaletteUsingRainbow(bgcolor)
|
||||||
|
|
||||||
# set the foreground color (text, ticks, gridlines) to be white or black depending
|
# set the foreground color (text, ticks, gridlines) to be white or black depending
|
||||||
# on how dark the background is.
|
# on how dark the background is.
|
||||||
if !haskey(d, :foreground_color) || d[:foreground_color] == :auto
|
fgcolor = get(d, :foreground_color, :auto)
|
||||||
d[:foreground_color] = isdark(bgcolor) ? colorant"white" : colorant"black"
|
if fgcolor == :auto
|
||||||
|
fgcolor = isdark(bgcolor) ? colorant"white" : colorant"black"
|
||||||
else
|
else
|
||||||
d[:foreground_color] = convertColor(d[:foreground_color])
|
fgcolor = convertColor(fgcolor)
|
||||||
end
|
end
|
||||||
|
# if !haskey(d, :foreground_color) || d[:foreground_color] == :auto
|
||||||
|
# d[:foreground_color] = isdark(bgcolor) ? colorant"white" : colorant"black"
|
||||||
|
# else
|
||||||
|
# d[:foreground_color] = convertColor(d[:foreground_color])
|
||||||
|
# end
|
||||||
|
|
||||||
# bgcolor
|
# bgcolor
|
||||||
d[:background_color] = bgcolor
|
d[:background_color] = colorscheme(bgcolor)
|
||||||
|
d[:foreground_color] = colorscheme(fgcolor)
|
||||||
end
|
end
|
||||||
|
|
||||||
# converts a symbol or string into a colorant (Colors.RGB), and assigns a color automatically
|
# converts a symbol or string into a colorant (Colors.RGB), and assigns a color automatically
|
||||||
@ -312,9 +371,6 @@ function getSeriesRGBColor(c, d::Dict, n::Int)
|
|||||||
|
|
||||||
if c == :auto
|
if c == :auto
|
||||||
c = autopick(d[:color_palette], n)
|
c = autopick(d[:color_palette], n)
|
||||||
# else
|
|
||||||
# # c = convertColor(c)
|
|
||||||
# c = colorscheme(c)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# c should now be a subtype of ColorScheme
|
# c should now be a subtype of ColorScheme
|
||||||
|
|||||||
10
src/plot.jl
10
src/plot.jl
@ -47,9 +47,7 @@ function plot(args...; kw...)
|
|||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
preprocessArgs!(d)
|
preprocessArgs!(d)
|
||||||
|
|
||||||
println()
|
dumpdict(d, "After plot preprocessing")
|
||||||
for k in sort(collect(keys(d))); @printf("%14s: ", k); println(d[k]); end
|
|
||||||
println()
|
|
||||||
|
|
||||||
# # ensure we're passing in an RGB
|
# # ensure we're passing in an RGB
|
||||||
# if haskey(d, :background_color)
|
# if haskey(d, :background_color)
|
||||||
@ -86,6 +84,8 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
preprocessArgs!(d)
|
preprocessArgs!(d)
|
||||||
|
|
||||||
|
dumpdict(d, "After plot! preprocessing")
|
||||||
|
|
||||||
warnOnUnsupportedArgs(plt.backend, d)
|
warnOnUnsupportedArgs(plt.backend, d)
|
||||||
|
|
||||||
# handle a "group by" mechanism.
|
# handle a "group by" mechanism.
|
||||||
@ -108,6 +108,8 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
setTicksFromStringVector(d, di, :x, :xticks)
|
setTicksFromStringVector(d, di, :x, :xticks)
|
||||||
setTicksFromStringVector(d, di, :y, :yticks)
|
setTicksFromStringVector(d, di, :y, :yticks)
|
||||||
|
|
||||||
|
dumpdict(di, "Series $i")
|
||||||
|
|
||||||
plot!(plt.backend, plt; di...)
|
plot!(plt.backend, plt; di...)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -115,6 +117,8 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
|
|
||||||
warnOnUnsupportedScales(plt.backend, d)
|
warnOnUnsupportedScales(plt.backend, d)
|
||||||
|
|
||||||
|
dumpdict(d, "Updating plot items:")
|
||||||
|
|
||||||
# add title, axis labels, ticks, etc
|
# add title, axis labels, ticks, etc
|
||||||
updatePlotItems(plt, d)
|
updatePlotItems(plt, d)
|
||||||
current(plt)
|
current(plt)
|
||||||
|
|||||||
25
src/utils.jl
25
src/utils.jl
@ -104,6 +104,8 @@ function sticksHack(; kw...)
|
|||||||
dLine, dScatter
|
dLine, dScatter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get_mod(v, idx::Int) = v[mod1(idx, length(v))]
|
||||||
|
|
||||||
makevec(v::AVec) = v
|
makevec(v::AVec) = v
|
||||||
makevec{T}(v::T) = T[v]
|
makevec{T}(v::T) = T[v]
|
||||||
|
|
||||||
@ -143,8 +145,31 @@ ticksType(ticks) = :invalid
|
|||||||
limsType{T<:Real,S<:Real}(lims::Tuple{T,S}) = :limits
|
limsType{T<:Real,S<:Real}(lims::Tuple{T,S}) = :limits
|
||||||
limsType(lims) = :invalid
|
limsType(lims) = :invalid
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
|
type DebugMode
|
||||||
|
on::Bool
|
||||||
|
end
|
||||||
|
const _debugMode = DebugMode(false)
|
||||||
|
|
||||||
|
|
||||||
|
function dumpdict(d::Dict, prefix = "")
|
||||||
|
_debugMode.on || return
|
||||||
|
println()
|
||||||
|
if prefix != ""
|
||||||
|
println(prefix, ":")
|
||||||
|
end
|
||||||
|
for k in sort(collect(keys(d)))
|
||||||
|
@printf("%14s: ", k)
|
||||||
|
println(d[k])
|
||||||
|
end
|
||||||
|
println()
|
||||||
|
end
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# push/append/clear/set the underlying plot data
|
# push/append/clear/set the underlying plot data
|
||||||
# NOTE: backends should implement the getindex and setindex! methods to get/set the x/y data objects
|
# NOTE: backends should implement the getindex and setindex! methods to get/set the x/y data objects
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user