A scientific visualization toolkit for generating dynamic color arrays from any colormap
Project description
mycolorpy
A scientific visualization toolkit for generating dynamic color arrays from any colormap. Contains functions to create an array of colors based on a colormap.
Installation Instructions:
You can pip install it using:
pip install mycolorpy
You can then do:
from mycolorpy import colorlist as mcp
Example: To create a list of 5 hex strings from cmap "winter"
color1=mcp.gen_color(cmap="winter",n=5)
print(color1)
Output:
['#0000ff', '#0040df', '#0080bf', '#00c09f', '#00ff80']
Another example to generate 16 list of colors from cmap bwr:
color2=mcp.gen_color(cmap="bwr",n=16)
print(color2)
Output:
['#0000ff', '#2222ff', '#4444ff', '#6666ff', '#8888ff', '#aaaaff', '#ccccff', '#eeeeff', '#ffeeee', '#ffcccc', '#ffaaaa', '#ff8888', '#ff6666', '#ff4444', '#ff2222', '#ff0000']
There is a python notebook with usage examples to better visualize this.
Say you want to generate a list of colors from a cmap that is normalized to a given data. You can do that using:
a=random.randint(1000, size=(200))
a=np.array(a)
color1=mcp.gen_color_normalized(cmap="seismic",data_arr=a)
plt.scatter(a,a,c=color1)
You can also reverse the color using:
color1=mcp.gen_color_normalized(cmap="seismic",data_arr=a,reverse=True)
plt.scatter(a,a,c=color1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mycolorpy-1.5.3.tar.gz.
File metadata
- Download URL: mycolorpy-1.5.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38668f8bc1d4abfa8dca214434550c2289a968ceb067929e8637e393e6dc2c36
|
|
| MD5 |
2e80bf3109a08307de21732be874e680
|
|
| BLAKE2b-256 |
0b9e2d6a1bc1a52f9c17c34a51cee40c23f338c5ba6c7ea9dee3c3f83a97a0e6
|
File details
Details for the file mycolorpy-1.5.3-py3-none-any.whl.
File metadata
- Download URL: mycolorpy-1.5.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd3153c6348b0e6251142c818e67c94f5f9316ef8586236ebb9caac17f469540
|
|
| MD5 |
2168cce4a57af5bad8f5a094c25a121d
|
|
| BLAKE2b-256 |
0ffac8207f74ddbd73c28b569cabdd3c7f5315715f72908c2ef02c5cc660f7d7
|