-
Notifications
You must be signed in to change notification settings - Fork 40
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
Proposal: split ColorSchemes.jl into two separate packages #19
Comments
cc also @SimonDanisch using Colorschemes.colorschemes
leo = colorgradient(:leonardo)
get(leo, 0.75) # or leo[0.75] also work as an interface? |
Yes, assuming you wouldn't need them to merely access an array of RGB triplets by name.
As an additional interface, or the only one? |
It's probably a good idea to have both a trait based system, with generators for particular classes of color maps, and also a unified interface which makes all of the pre-definitions available from one function. |
I guess I meant alternative but probably not :-) struct ColorScheme
x::Vector{RGB{Float64}} # or RGB{UInt8} is possibly good enough
end instead of just a Vector as it currently is, but still leave them as const objects in module global scope, we could define using ColorSchemes
get(colorschemes.leonardo, 0.75) # get(colorbrewer.RdYlBu) etc which would be close enough, and still support the syntax I suggest? |
yes, i could live with that... :) |
See the discussion here for some discussion of leaving schemes as objects in module global scope in terms of static compilation JuliaPlots/PlotUtils.jl#52 (IIUC it should be OK). |
In terms of splitting this - @peterkovesi 's excellent PerceptualColorMaps package actually also has 1) a very good range of color maps, and 2) advanced utilities depending on Images. Maybe it would even be worth considering consolidating that into each of these two new suggested packages? |
But the long and short of it - I think this is a good idea. @cormullion how much functionality would you suggest having here? It could simply be a repository of colorschemes - or it could have some added functionality that can be implemented dependency-free. E.g. in PlotUtils there is functionality for log-transformed scales, scales that correspond to certain values (not just 0-1), reversing colorscales, getindex acessing, searching across libraries for a given colorscheme name etc. I'd be happy to argue to the JuliaPlots org to move any functionality here - but it depends what the vision is? |
Since I'm a simple soul that likes simple solutions, I like the idea of a place where a bunch of these simple static colorschemes are stored 'as is' in a catalogue, with the more complex functionality stored elsewhere, accessible (say in ColorScheme(s)Tools?) but not 'in the way'. As I was trying to convert some of the Matplotlib ones it occurred to me that perhaps some of these schemes were designed to be built and used 'on the fly' or 'live', which, if it's possible in Python, presumably even more possible in Julia. However, eventually you end up with complexity at the point of end use, which is what I don't like in software, where people are usually busy trying to solve their own problems, not navigating a maze made by the developers. So perhaps the separate catalogue and toolbox paradigm is what I'm suggesting. :) |
Here's an idea: you could make a Since the presets were generated on the build script, you don't need to load the That allows a unified interface for both generating the maps and storing them as fast presets. The generator |
Apologies for coming in a bit late here Splitting ColorSchemes.jl into Schemes and Tools would seem a good idea With regard to PerceptualColourMaps.jl a similar split into separate Schemes and Tools components had been suggested to me some time ago by @tpapp. I agree very much with this but have been consumed by other projects to do anything about it The package could do with a bit of a rework
I think the main thing for me to do is set things up so that PerceptualColourMap schemes can be readily output as a data file for incorporation in ColorSchemes.jl/data. This then achieves the split between Schemes and Tools (for me) and PerceptualColourMaps.jl can remain primarily as a tool for designing schemes rather than supplying them directly for plotting With regard to any potential consolidation into ColorSchemes.jl in general I would be very happy for this to occur. However here I think I would prefer that the core components of PerceptualColourMaps.jl that are related to the design of maps remain as an independent package as it represents a piece of research work that I would like people to be able to reference as an independent item. Components that are not core to the research could certainly be consolidated if that was useful. Anyway, I am open to any suggestions for PerceptualColourMaps people might have |
I went ahead and split the two packages up. You can see the manual of the new prototype (v3.0) of ColorSchemes.jl here, but you can't install either of them just yet, because they're still in METADATA purgatory. (My fault, I find this aspect of developing Julia packages quite difficult...) ColorSchemes.jl v3.0 isn't compatible with v2.0... 😱 You can use them to decide whether a completely new design is a good idea or whether you can extend and/or re-use any of the code, using submodules or whatever, to build a more complete system. I'm happy to help, to the extent of my abilities! :) |
How about splitting the ColorSchemes.jl package into two separate packages?
1: ColorSchemes.jl - providing just the color schemes and the accessor functions
2: a new package ColorSchemeTools.jl - providing the tools for extracting color schemes from images, saving to images, conversion, sorting. etc.
I originally made ColorSchemes.jl simply to group sets of related colors together, avoiding dependencies on plotting packages (since I rarely plot). Ironically it now relies on Images.jl and Clustering.jl, which make the package a bit more dependency-heavy than the basic functionality might suggest.
After the split it should be possible for anyone to more easily add their preferred functionality to either of the ColorSchemes.jl or ColorSchemeTools.jl packages, such as libraries, lists, catalogues and categories, traits (whatever those are), interfaces, or anything else that people need, in order to steer the packages in the directions that people want to go. ... I'd prefer to at least keep the current basic usage unchanged, though:
since that's my primary use... :)
(I think this proposal could be either a temporary alternative to bike-shedding a brand new package design, or a useful thing to do anyway, even if a new package is ultimately the best way forward.)
@mkborregaard @chakravala @tpapp
The text was updated successfully, but these errors were encountered: