Skip to content

Commit

Permalink
Add Scale.color_none to supress default color scales. Fixes #527
Browse files Browse the repository at this point in the history
  • Loading branch information
dcjones committed Jan 8, 2015
1 parent 27475ba commit 621baf9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/scale_color_none.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: color_none
author: Daniel C. Jones
part: Scale
order: 2009
...

Supress a default color scale. Some statistics impose a default color scale.
When no color scale is desider, explicitly including `Scale.color_none` will
supress this default.

# Examples

```{.julia hide="true" results="none"}
using Gadfly
```

```julia
xs = 1:10.
ys = 1:10.
zs = Float64[x^2*log(y) for x in xs, y in ys]
plot(x=xs, y=ys, z=zs, Geom.contour, Scale.color_none)
```

20 changes: 20 additions & 0 deletions src/scale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,26 @@ function apply_scale(scale::DiscreteScale, aess::Vector{Gadfly.Aesthetics},
end


immutable NoneColorScale <: Gadfly.ScaleElement
end


const color_none = NoneColorScale


function element_aesthetics(scale::NoneColorScale)
[:color]
end


function apply_scale(scale::NoneColorScale,
aess::Vector{Gadfly.Aesthetics}, datas::Gadfly.Data...)
for aes in aess
aes.color = nothing
end
end


immutable DiscreteColorScale <: Gadfly.ScaleElement
f::Function # A function f(n) that produces a vector of n colors.

Expand Down

0 comments on commit 621baf9

Please sign in to comment.