Pick the colormap from a colorbar in an image
Ahora está siguiendo esta publicación
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
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
-
Find an image with a colorbar you want (e.g., take a screenshot)
-
Call
cmap = cmap_picker(image_path)This will open a figure window with your image displayed in it. (Don't forget to editimage_pathto be your image's path!) -
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!
Citar como
Benoit Pasquier (2026). cmap_picker (https://github.com/briochemc/cmap_picker/releases/tag/v1.0.2), GitHub. Recuperado .
Información general
- Versión 1.0.2 (2,94 KB)
-
Ver licencia en GitHub
Compatibilidad con la versión de MATLAB
- Compatible con cualquier versión desde R2018b
Compatibilidad con las plataformas
- Windows
- macOS
- Linux
| Versión | Publicado | Notas de la versión | Action |
|---|---|---|---|
| 1.0.2 | See release notes for this release on GitHub: https://github.com/briochemc/cmap_picker/releases/tag/v1.0.2 |
||
| 1.0.1.0 | See release notes for this release on GitHub: https://github.com/briochemc/cmap_picker/releases/tag/v1.0.1 |
||
| 1.0.0 |
