Giter Club home page Giter Club logo

colorbrewer.jl's Introduction

ColorBrewer.jl

A small library for generating color brewer color palettes. For more information on color brewer, see http://colorbrewer2.org/.

About

The color brewer palette collection was originally designed for maps, but is also useful for quickly generating nice colors for any kind of plot.

Setup

This package is now registered. Add it with

Pkg.add("ColorBrewer");

You can also add it with

Pkg.clone("git://github.com/timothyrenner/ColorBrewer.jl.git");

Usage

The module contains one function, palette, which takes a scheme name and an integer for the number of colors in the palette. It returns an array of RGB values, which are defined in the ColorTypes.jl package.

For example, to obtain a five color sequential green scheme, call

    using ColorBrewer

    greens = palette("Greens", 5);

Pretty simple stuff.

It can drop right into Gadfly plots.

    using Gadfly

    p = plot([x -> sin(n*x) for n in 1:3], 0, 25, 
             Scale.color_discrete_manual(greens[3:5]...))

Example

If the palette function is passed an invalid scheme or number of colors, it throws an ArgumentError.

The schemes are broken up into three categories based on the type of data you want to show: sequential, diverging, and qualitative.

All sequential color schemes can have between 3 and 9 colors. The available sequential color schemes are:

Name Example
Blues Blues
Oranges Oranges
Greens Greens
Reds Reds
Purples Purples
Greys Greys
OrRd OrRd
GnBu GnBu
PuBu PuBu
PuRd PuRd
BuPu BuPu
BuGn BuGn
YlGn YlGn
RdPu RdPu
YlOrBr YlOrBr
YlGnBu YlGnBu
YlOrRd YlOrRd
PuBuGn PuBuGn

All diverging color schemes can have between 3 and 11 colors. The available diverging color schemes are:

Name Example
Spectral Spectral
RdYlGn RdYlGn
RdBu RdBu
PiYG PiYG
PRGn PRGn
RdYlBu RdYlBu
BrBG BrBG
RdGy RdGy
PuOr PuOr

The number of colors a qualitative color scheme can have depends on the scheme. The available qualitative color schemes are:

Name Example
Set1 Set1
Set2 Set2
Set3 Set3
Accent Accent
Dark2 Dark2
Paired Paired
Pastel1 Pastel1
Pastel2 Pastel2

The Paired and Set3 schemes can have between 3 and 12 colors. The Pastel1 and Set1 schemes can have between 3 and 9 colors. The Set2, Accent, Dark2, and Pastel2 schemes can have between 3 and 8 colors.

Thanks

Huge thanks to ikirill for providing the color scheme previews!

colorbrewer.jl's People

Contributors

dmoliveira avatar ikirill avatar rdeits avatar timholy avatar timothyrenner avatar tkelman avatar waldyrious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

colorbrewer.jl's Issues

The package doesn't compile on 1st use

Hello, tried "using ColorBrewer" and got this error :

using ColorBrewer
INFO: Precompiling module Colors...
INFO: Recompiling stale cache file /home/proy/.julia/lib/v0.4/Compat.ji for module Compat.
INFO: Recompiling stale cache file /home/proy/.julia/lib/v0.4/FixedPointNumbers.ji for module     FixedPointNumbers.
WARNING: Module Compat uuid did not match cache file
WARNING: deserialization checks failed while attempting to load cache from /home/proy/.julia/lib/v0.4/FixedPointNumbers.ji
INFO: Precompiling module FixedPointNumbers...
INFO: Recompiling stale cache file /home/proy/.julia/lib/v0.4/FixedPointNumbers.ji for module FixedPointNumbers.
WARNING: Module Compat uuid did not match cache file
ERROR: LoadError: __precompile__(true) but require failed to create a precompiled cache file
 in require at ./loading.jl:252
 in stale_cachefile at loading.jl:439
 in recompile_stale at loading.jl:457
 in _require_from_serialized at loading.jl:83
 in _require_from_serialized at ./loading.jl:109
 in require at ./loading.jl:219
 in stale_cachefile at loading.jl:439
 in recompile_stale at loading.jl:457
 in _require_from_serialized at loading.jl:83
 in require at ./loading.jl:251
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 in require at ./loading.jl:243
while loading /home/proy/.julia/v0.4/ColorBrewer/src/ColorBrewer.jl, in expression starting on line 3

Julia 0.4

cant find colorbrewer.json

INFO: Precompiling module Vega...
ERROR: LoadError: SystemError: opening file /u/s8weber/.julia/v0.4/ColorBrewer/data/colorbrewer.json: No such file or directory
while loading /usr/local/share/julia/site/v0.4/ColorBrewer/src/ColorBrewer.jl, in expression starting on line 10
ERROR: LoadError: Failed to precompile ColorBrewer to /u/s8weber/.julia/lib/v0.4/ColorBrewer.ji
while loading /usr/local/share/julia/site/v0.4/Vega/src/Vega.jl, in expression starting on line 5

seems to use JULIA_PKGDIR but should loop over LOAD_PATH to find the file colorbrewer.json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.