Skip to content

Commit fee1a53

Browse files
authored
Rename kwarg cs to colorscheme (#1)
1 parent a1f8f30 commit fee1a53

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

docs/src/example.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ heatmap(val, words)
2424
We can use a custom color scheme from ColorSchemes.jl using the keyword argument cs:
2525
```@example 1
2626
using ColorSchemes
27-
heatmap(val, words; cs=ColorSchemes.jet)
27+
heatmap(val, words; colorscheme=ColorSchemes.jet)
2828
```
2929
```@example 1
30-
heatmap(val, words; cs=ColorSchemes.inferno)
30+
heatmap(val, words; colorscheme=ColorSchemes.inferno)
3131
```
3232

3333
## Mapping values onto the color scheme
@@ -55,11 +55,11 @@ heatmap(val, words; rangescale=:extrema)
5555
However, for the `inferno` color scheme, which is not centered around zero, `:extrema` leads to a heatmap with higher contrast.
5656

5757
```@example 1
58-
heatmap(val, words; cs=ColorSchemes.inferno, rangescale=:centered)
58+
heatmap(val, words; colorscheme=ColorSchemes.inferno, rangescale=:centered)
5959
```
6060

6161
```@example 1
62-
heatmap(val, words; cs=ColorSchemes.inferno, rangescale=:extrema)
62+
heatmap(val, words; colorscheme=ColorSchemes.inferno, rangescale=:extrema)
6363
```
6464

6565
## Terminal support

src/heatmap.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Create a heatmap of words where the background color of each word is determined
88
Arguments `values` and `words` (and optionally `colors`) must have the same size.
99
1010
## Keyword arguments
11-
- `cs::ColorScheme`: color scheme from ColorSchemes.jl that is applied to create the heatmap.
11+
- `colorscheme::ColorScheme`: color scheme from ColorSchemes.jl.
1212
Defaults to `ColorSchemes.seismic`.
1313
- `rangescale::Symbol`: selects how the color channel reduced heatmap is normalized
1414
before the color scheme is applied. Can be either `:extrema` or `:centered`.
@@ -37,12 +37,12 @@ struct TextHeatmap{
3737
end
3838

3939
function TextHeatmap(
40-
val, words; cs::ColorScheme=DEFAULT_COLORSCHEME, rangescale=DEFAULT_RANGESCALE
40+
val, words; colorscheme::ColorScheme=DEFAULT_COLORSCHEME, rangescale=DEFAULT_RANGESCALE
4141
)
4242
if size(val) != size(words)
4343
throw(ArgumentError("Sizes of values and words don't match"))
4444
end
45-
colors = get(cs, val, rangescale)
45+
colors = get(colorscheme, val, rangescale)
4646
return TextHeatmap(val, words, colors)
4747
end
4848

test/runtests.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ using Aqua
1616
words = ["Test", "TextHeatmaps"]
1717
val = [4.2, -1.0]
1818

19-
cs = TextHeatmaps.seismic
20-
cmin = get(cs, 0) # red
21-
cmax = get(cs, 1) # blue
19+
colorscheme = TextHeatmaps.seismic
20+
cmin = get(colorscheme, 0) # red
21+
cmax = get(colorscheme, 1) # blue
2222

2323
# Test default ColorScheme seismic
2424
h = heatmap(val, words)
@@ -33,10 +33,10 @@ using Aqua
3333
@test_reference "references/seismic_extrema.txt" repr("text/plain", h)
3434

3535
# Test other colorschemes
36-
cs = ColorSchemes.inferno
37-
h = heatmap(val, words; cs=cs, rangescale=:centered)
36+
colorscheme = ColorSchemes.inferno
37+
h = heatmap(val, words; colorscheme=colorscheme, rangescale=:centered)
3838
@test_reference "references/inferno_centered.txt" repr("text/plain", h)
39-
h = heatmap(val, words; cs=cs, rangescale=:extrema)
39+
h = heatmap(val, words; colorscheme=colorscheme, rangescale=:extrema)
4040
@test_reference "references/inferno_extrema.txt" repr("text/plain", h)
4141

4242
# Test errors

0 commit comments

Comments
 (0)