Print matplotlib colors

Overview

mplcolors

Tired of searching "matplotlib colors" every week/day/hour? This simple script displays them all conveniently right in your terminal emulator! This uses matplotlib.colors to get color names and RGB values and prints with ANSI escape sequences.

It can also print all of the built-in colorbars.

Compatability

This requires a terminal with true color support. Notably, Mac's Terminal.app does not have this and so the colors cannot be properly displayed. I'm not sure that that is a workaround for this. On Mac I suggest switching to a different terminal emulator with more modern support such as kitty or iTerm.

Requirements

You just need a Python distribution with matplotlib.

Useage

It's probably easiest to create an alias in your shell's rc file (e.g., ~/.bashrc) such as

alias mplcolors='python /path/to/dir/mplcolors.py'

then you can just run

mplcolors

to print the colors.

Screenshot showing the script in use

To display all of the built-in colormaps, use the -b flag ("b" for "bars") or the --colorbars option

mplcolors -b

Screenshot showing colorbars.

To Do

Color lookup, color grouping. Print subset of colormaps

You might also like...
:small_red_triangle: Ternary plotting library for python with matplotlib
:small_red_triangle: Ternary plotting library for python with matplotlib

python-ternary This is a plotting library for use with matplotlib to make ternary plots plots in the two dimensional simplex projected onto a two dime

Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:
Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:

JoyPy JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots). The code f

A python package for animating plots build on matplotlib.
A python package for animating plots build on matplotlib.

animatplot A python package for making interactive as well as animated plots with matplotlib. Requires Python = 3.5 Matplotlib = 2.2 (because slider

Painlessly create beautiful matplotlib plots.
Painlessly create beautiful matplotlib plots.

Announcement Thank you to everyone who has used prettyplotlib and made it what it is today! Unfortunately, I no longer have the bandwidth to maintain

basemap - Plot on map projections (with coastlines and political boundaries) using matplotlib.

Basemap Plot on map projections (with coastlines and political boundaries) using matplotlib. ⚠️ Warning: this package is being deprecated in favour of

Easily convert matplotlib plots from Python into interactive Leaflet web maps.
Easily convert matplotlib plots from Python into interactive Leaflet web maps.

mplleaflet mplleaflet is a Python library that converts a matplotlib plot into a webpage containing a pannable, zoomable Leaflet map. It can also embe

Design your own matplotlib stylefile interactively

Tired of playing with font sizes and other matplotlib parameters every time you start a new project or write a new plotting function? Want all you plots have the same style? Use matplotlib configuration files!

A Python library for plotting hockey rinks with Matplotlib.
A Python library for plotting hockey rinks with Matplotlib.

Hockey Rink A Python library for plotting hockey rinks with Matplotlib. Installation pip install hockey_rink Current Rinks The following shows the cus

Simple python implementation with matplotlib to manually fit MIST isochrones to Gaia DR2 color-magnitude diagrams

Simple python implementation with matplotlib to manually fit MIST isochrones to Gaia DR2 color-magnitude diagrams

Comments
  • the value of least_score of GetNearNameColors should be set to 0.5

    the value of least_score of GetNearNameColors should be set to 0.5

    Hello. Thank you for your recent PR approval. Today, I suggest that the value of least_score of GetNearNameColors be set to 0.5.

    if least_score is 0.05, it means the colors suggested have more than 5 percent similarity to the target. Before, mplcolors -s greem shows below suggestions. image I think the result is not natural, and that there are too many colors. For example, red is far away from greem.

    Now, set its value 0.5 and mplcolors -s greem shows image This result is natural. If least_score is bigger or small than 0.5, The suggestion colors are too many or a few; If 0.4: image If 0.6: image

    Thus, least_score = 0.5 is better than least_score = 0.05 and may be best value. Another idea about this value is that user can change this value from some setting file or, more simply, from command line argument. In either case, I think that the default value of least_score should be set 0.5.

    Also, this PR includes deleting print(suggestions) in mplcolors.py at line 258. suggestions is dict object. Therefore simple print is not user friendly. I guessed this print was for debugging, so I deleted it. If the result shows not only color names but also color codes, I think it is better to introduce another option argument and implement another function.

    Thanks.

    opened by Take-Me1010 1
  • implement color name search

    implement color name search

    Hello. Your project mplcolors is really good and useful! And here is pull request about implementation to search color names. The features added in PR are below.

    1. search color name (not color bar names...)

    Search by whether the target name is included or not.

    スクリーンショット 2021-11-11 160254

    1. suggest color name if no color is found

    If no color name is found in above method, suggest color names based on difflib package (since python 3.2).

    スクリーンショット 2021-11-11 160138

    If there is something wrong, please tell me it!

    opened by Take-Me1010 0
Releases(v1.0.1)
Owner
Brandon Barker
Stellar & Nuclear Astrophysics
Brandon Barker
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 10.2k Dec 30, 2022
The windML framework provides an easy-to-use access to wind data sources within the Python world, building upon numpy, scipy, sklearn, and matplotlib. Renewable Wind Energy, Forecasting, Prediction

windml Build status : The importance of wind in smart grids with a large number of renewable energy resources is increasing. With the growing infrastr

Computational Intelligence Group 125 Dec 24, 2022
NorthPitch is a python soccer plotting library that sits on top of Matplotlib

NorthPitch is a python soccer plotting library that sits on top of Matplotlib.

Devin Pleuler 30 Feb 22, 2022
matplotlib: plotting with Python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Check out our home page for more inform

Matplotlib Developers 16.7k Jan 8, 2023
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 8.1k Feb 13, 2021
:small_red_triangle: Ternary plotting library for python with matplotlib

python-ternary This is a plotting library for use with matplotlib to make ternary plots plots in the two dimensional simplex projected onto a two dime

Marc 611 Dec 29, 2022
Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:

JoyPy JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots). The code f

Leonardo Taccari 462 Jan 2, 2023
A python package for animating plots build on matplotlib.

animatplot A python package for making interactive as well as animated plots with matplotlib. Requires Python >= 3.5 Matplotlib >= 2.2 (because slider

Tyler Makaro 394 Dec 18, 2022
matplotlib: plotting with Python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Check out our home page for more inform

Matplotlib Developers 13.1k Feb 18, 2021
Statistical data visualization using matplotlib

seaborn: statistical data visualization Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing

Michael Waskom 8.1k Feb 18, 2021