Coder Social home page Coder Social logo

Comments (1)

kylebarron avatar kylebarron commented on June 20, 2024

I hadn't previously used colormaps in python much, and so I figured the easiest approach was to nudge people towards a library with lots of colormaps.

To be clear, apply_continuous_cmap is only a helper for creating a numpy array that's of shape (n, 3) or (n, 4) and data type uint8 for passing into anything that accepts a color. Part of the primary goal in lonboard is to say "use the full range of python to do whatever you want that outputs a column of colors to render". So for example, I'm not familiar with colorcet but it looks like you can get matplotlib-compatible colormaps easily. So you can do

from matplotlib.cm import get_cmap

data = np.array(...)
colormap = get_cmap("cet_fire")
map_.get_fill_color = colormap(data, bytes=True)

(bytes=True makes it uint8 output 0-255 instead of float 0-1).

That said, it's probably good to update apply_continuous_cmap to support at least either any palettable colormap or any matplotlib colormap object (though for the matplotlib colormap it would literally just be an alias to call colormap(data, bytes=True).

from lonboard.

Related Issues (20)

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.