added matplotlib colormaps; default changed to inferno; pyplot subplot fix
This commit is contained in:
parent
82d2cc943d
commit
236a7dadc6
@ -178,7 +178,7 @@ end
|
|||||||
function addGadflyContColorScale(plt::Plot{GadflyBackend}, c)
|
function addGadflyContColorScale(plt::Plot{GadflyBackend}, c)
|
||||||
plt.plotargs[:colorbar] == :none && return
|
plt.plotargs[:colorbar] == :none && return
|
||||||
if !isa(c, ColorGradient)
|
if !isa(c, ColorGradient)
|
||||||
c = colorscheme(:bluesreds)
|
c = default_gradient()
|
||||||
end
|
end
|
||||||
push!(getGadflyContext(plt).scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(c, p))))
|
push!(getGadflyContext(plt).scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(c, p))))
|
||||||
end
|
end
|
||||||
|
|||||||
@ -256,7 +256,7 @@ end
|
|||||||
function plotly_colorscale(grad::ColorGradient, alpha = nothing)
|
function plotly_colorscale(grad::ColorGradient, alpha = nothing)
|
||||||
[[grad.values[i], webcolor(grad.colors[i], alpha)] for i in 1:length(grad.colors)]
|
[[grad.values[i], webcolor(grad.colors[i], alpha)] for i in 1:length(grad.colors)]
|
||||||
end
|
end
|
||||||
plotly_colorscale(c, alpha = nothing) = plotly_colorscale(ColorGradient(:bluesreds), alpha)
|
plotly_colorscale(c, alpha = nothing) = plotly_colorscale(default_gradient(), alpha)
|
||||||
|
|
||||||
const _plotly_markers = KW(
|
const _plotly_markers = KW(
|
||||||
:rect => "square",
|
:rect => "square",
|
||||||
|
|||||||
@ -42,7 +42,7 @@ function getPyPlotColorMap(c::ColorGradient, α=nothing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# anything else just gets a bluesred gradient
|
# anything else just gets a bluesred gradient
|
||||||
getPyPlotColorMap(c, α=nothing) = getPyPlotColorMap(ColorGradient(:bluesreds), α)
|
getPyPlotColorMap(c, α=nothing) = getPyPlotColorMap(default_gradient(), α)
|
||||||
|
|
||||||
# get the style (solid, dashed, etc)
|
# get the style (solid, dashed, etc)
|
||||||
function getPyPlotLineStyle(linetype::Symbol, linestyle::Symbol)
|
function getPyPlotLineStyle(linetype::Symbol, linestyle::Symbol)
|
||||||
@ -388,7 +388,7 @@ function _add_series(pkg::PyPlotBackend, plt::Plot; kw...)
|
|||||||
c = d[:markercolor]
|
c = d[:markercolor]
|
||||||
if d[:zcolor] != nothing
|
if d[:zcolor] != nothing
|
||||||
if !isa(c, ColorGradient)
|
if !isa(c, ColorGradient)
|
||||||
c = colorscheme(:bluesreds)
|
c = default_gradient()
|
||||||
end
|
end
|
||||||
extra_kwargs[:c] = convert(Vector{Float64}, d[:zcolor])
|
extra_kwargs[:c] = convert(Vector{Float64}, d[:zcolor])
|
||||||
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeralpha])
|
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeralpha])
|
||||||
@ -777,7 +777,8 @@ function subplot(plts::AVec{Plot{PyPlotBackend}}, layout::SubplotLayout, d::KW)
|
|||||||
|
|
||||||
for (i,plt) in enumerate(plts)
|
for (i,plt) in enumerate(plts)
|
||||||
for seriesargs in plt.seriesargs
|
for seriesargs in plt.seriesargs
|
||||||
_add_series_subplot(newplts[i]; seriesargs...)
|
# _add_series_subplot(newplts[i]; seriesargs...)
|
||||||
|
_add_series_subplot(newplts[i], seriesargs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
1067
src/color_gradients.jl
Normal file
1067
src/color_gradients.jl
Normal file
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ const _rainbowColors = [colorant"blue", colorant"purple", colorant"green", color
|
|||||||
const _testColors = [colorant"darkblue", colorant"blueviolet", colorant"darkcyan",colorant"green",
|
const _testColors = [colorant"darkblue", colorant"blueviolet", colorant"darkcyan",colorant"green",
|
||||||
darken(colorant"yellow",0.3), colorant"orange", darken(colorant"red",0.2)]
|
darken(colorant"yellow",0.3), colorant"orange", darken(colorant"red",0.2)]
|
||||||
|
|
||||||
@compat const _gradients = KW(
|
const _gradients = KW(
|
||||||
:blues => [colorant"lightblue", colorant"darkblue"],
|
:blues => [colorant"lightblue", colorant"darkblue"],
|
||||||
:reds => [colorant"lightpink", colorant"darkred"],
|
:reds => [colorant"lightpink", colorant"darkred"],
|
||||||
:greens => [colorant"lightgreen", colorant"darkgreen"],
|
:greens => [colorant"lightgreen", colorant"darkgreen"],
|
||||||
@ -67,6 +67,13 @@ const _testColors = [colorant"darkblue", colorant"blueviolet", colorant"darkcya
|
|||||||
:lighttest => map(c -> lighten(c, 0.3), _testColors),
|
:lighttest => map(c -> lighten(c, 0.3), _testColors),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function register_gradient_colors{C<:Colorant}(name::Symbol, colors::AVec{C})
|
||||||
|
_gradients[name] = colors
|
||||||
|
end
|
||||||
|
|
||||||
|
include("color_gradients.jl")
|
||||||
|
|
||||||
|
default_gradient() = ColorGradient(:inferno)
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user