Skip to main content

Create an array of colors from a given colormap

Project description

mycolorpy

Total downloads for the project Last Month Last Week

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)

Output: enter image description here

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)

Output: enter image description here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mycolorpy-1.5.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mycolorpy-1.5.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file mycolorpy-1.5.2.tar.gz.

File metadata

  • Download URL: mycolorpy-1.5.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for mycolorpy-1.5.2.tar.gz
Algorithm Hash digest
SHA256 98a4067152ccee81d75ea4b445184f566760892576b220bce99d516e886f4b01
MD5 12cbfb27586f0c6355d97666f46d2c39
BLAKE2b-256 807210c7e72a2e327094df648132c025faf17f29103ce1c4269d0568d0e801db

See more details on using hashes here.

File details

Details for the file mycolorpy-1.5.2-py3-none-any.whl.

File metadata

  • Download URL: mycolorpy-1.5.2-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

Hashes for mycolorpy-1.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a535ba95187a2116cd8ed0e0070b69d71e08458a8266741124556fdd6c739c4
MD5 d860f46bcfc68af86cfbb6be7ba8d369
BLAKE2b-256 8bc4cd74e066fb66ce04774bcce1dd85e6ac86aaded3a013f156dee325ff3445

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page