Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color schemes #23

Closed
tbreloff opened this issue Sep 18, 2015 · 3 comments
Closed

Color schemes #23

tbreloff opened this issue Sep 18, 2015 · 3 comments

Comments

@tbreloff
Copy link
Member

Support both discrete and continuous color schemes, probably through the color/markercolor/ribboncolor keywords.

When you pass a vector of vectors or vector of tuples into color, then the inner item will be treated as a color scheme. Color is determined by the z value if present, otherwise the y value?

See #4 (comment) and http://docs.ggplot2.org/current/scale_gradient2.html for examples of what to support.

I'd expect the first example to be generated something like:

using Plots, OnlineStats
y = cumsum(randn(100))
v = Variance()
sigma = Float64[(update!(v, yi); std(v)) for yi in y]
plot(y; c=:blue, ribbon = sigma, ribboncolor = (sigma, :blues))
@tbreloff
Copy link
Member Author

I want to also make it easy to change pieces of the colors, but leave other pieces automated. For example, force alpha/opacity to a value, but still choose the RGB automatically. Likewise, you could fix green and blue and allow variations of red to be chosen. In order to accomplish this cleanly, I should probably have a ColorGenerator type. This could cover the cases I described, where the current color picking would be the default. It could also cover colors that are dependent on a z value, or some other color scale determined by data, such as those cases described above.

@tbreloff
Copy link
Member Author

I'm working on color generation more (continued from JuliaGraphics/Colors.jl#18). I split off and added more color functionality, including a new algorithm for choosing colors automatically given a background color. The gist is that I pick an ordered subset of colors (which are sufficiently different from the background color) from a list of pre-generated "different colors". Automated colors for 15 lines on each background:

subplot(cumsum(randn(10,90),1), w=5, bg=[:white,:black,:grey,:orange,:blue,:red], n=6,nc=2)

tmp

@tbreloff
Copy link
Member Author

tbreloff commented Oct 7, 2015

I've made a lot of progress with the color scheme framework, adding gradients, different palette functions, etc. Plots like this are supported in Gadfly/Immerse (once I merge), although I really don't like the way the legends are implemented in Gadfly when trying to layer multiple series with a continuous color scale...

tmp

Here's some gradients I have right now:

tmp

t-bltg pushed a commit that referenced this issue Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant