Module: Rubyvis::Colors
- Defined in:
- lib/rubyvis/color/colors.rb
Overview
A collection of standard color palettes for categorical encoding.
Class Method Summary collapse
-
.category10(*arguments) ⇒ Object
Returns a new 10-color scheme.
-
.category19(*arguments) ⇒ Object
Returns a new alternative 19-color scheme.
-
.category20(*arguments) ⇒ Object
Returns a new 20-color scheme.
Class Method Details
.category10(*arguments) ⇒ Object
Returns a new 10-color scheme. The arguments to this constructor are optional, and equivalent to calling Rubyvis::Scale::Ordinal.domain. The following colors are used:
#1f77b4
#ff7f0e
#2ca02c
#d62728
#9467bd
#8c564b
#e377c2
#7f7f7f
#bcbd22
#17becf
59 60 61 62 63 64 65 |
# File 'lib/rubyvis/color/colors.rb', line 59 def self.category10(*arguments) scale = Rubyvis.colors( "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf") scale.domain(*arguments) if arguments.size>0 scale end |
.category19(*arguments) ⇒ Object
Returns a new alternative 19-color scheme. The arguments to this constructor are optional, and equivalent to calling Rubyvis::Scale::Ordinal.domain. The following colors are used:
#9c9ede
#7375b5
#4a5584
#cedb9c
#b5cf6b
#8ca252
#637939
#e7cb94
#e7ba52
#bd9e39
#8c6d31
#e7969c
#d6616b
#ad494a
#843c39
#de9ed6
#ce6dbd
#a55194
#7b4173
90 91 92 93 94 95 96 97 98 |
# File 'lib/rubyvis/color/colors.rb', line 90 def self.category19(*arguments) scale = Rubyvis.colors( "#9c9ede", "#7375b5", "#4a5584", "#cedb9c", "#b5cf6b", "#8ca252", "#637939", "#e7cb94", "#e7ba52", "#bd9e39", "#8c6d31", "#e7969c", "#d6616b", "#ad494a", "#843c39", "#de9ed6", "#ce6dbd", "#a55194", "#7b4173") scale.domain(*arguments) if arguments.size>0 scale end |
.category20(*arguments) ⇒ Object
Returns a new 20-color scheme. The arguments to this constructor are optional, and equivalent to calling Rubyvis::Scale::Ordinal.domain. The following colors are used:
#1f77b4
#aec7e8
#ff7f0e
#ffbb78
#2ca02c
#98df8a
#d62728
#ff9896
#9467bd
#c5b0d5
#8c564b
#c49c94
#e377c2
#f7b6d2
#7f7f7f
#c7c7c7
#bcbd22
#dbdb8d
#17becf
#9edae5
126 127 128 129 130 131 132 133 134 |
# File 'lib/rubyvis/color/colors.rb', line 126 def self.category20(*arguments) scale = Rubyvis.colors( "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5") scale.domain(*arguments) if arguments.size>0 scale end |