Giter Club home page Giter Club logo

cmap_picker's Introduction

cmap_picker

Pick the colormap from a colorbar in an image.

When you want to compare your results with someone else's, it can be hard to reproduce a map or a plot with a colormap that you don't have in your setup. This tool allows you to create a colormap that matches that of any figure. You just have to accurately select where the colorbar is on the image/figure.

Here's an example of extracting the colormap from an image with some of matplotlib's colormaps:

cmap_picker.mov

(Note I'm not very precise in my selection, surely you can do better!)

To check if you got it right, a colorbar with your newly created colormap is shown on the right.

Requires the Image Processing Toolbox!

Usage

  1. Find an image with a colorbar you want (e.g., take a screenshot)

  2. Call cmap = cmap_picker(image_path) This will open a figure window with your image displayed in it. (Don't forget to edit image_path to be your image's path!)

  3. And draw a rectancgle with your mouse (click-and-drag)! A colormap will be built by averaging over the colorbar's "width" (depending on the orientation of your rectangle). And a colorbar will be added to the figure to show you the colormap you just created.

Example:

Try this command and select whichever colorbar you want!

cmap = cmap_picker('https://matplotlib.org/stable/_images/sphx_glr_colormaps_001_2_0x.png');

You can then save the variable cmap or use it once, as you would anyother colormap!

View cmap_picker on File Exchange

cmap_picker's People

Contributors

briochemc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

chanjeunlam

cmap_picker's Issues

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.