Skip to main content

Yuxin's helper package with utilities for diverse tasks.

Project description

yuxin_helpers

Yuxin's helper package with utilities for diverse tasks.

Installation

pip install yuxin_helpers

Usage

Convert RGB to Hex

from yuxin_helpers import rgb_to_hex

print(rgb_to_hex(255, 0, 0))  # Output: '#ff0000'

Convert Hex to RGB

from yuxin_helpers import hex_to_rgb

print(hex_to_rgb('#ff0000'))  # Output: (255, 0, 0)

Here's an updated version of your README.md with the new function truncate_colormap added to the usage section:


yuxin_helpers

Yuxin's helper package with utilities for diverse tasks.

Installation

pip install yuxin_helpers

Usage

Convert RGB to Hex

from yuxin_helpers import rgb_to_hex

print(rgb_to_hex(255, 0, 0))  # Output: '#ff0000'

Convert Hex to RGB

from yuxin_helpers import hex_to_rgb

print(hex_to_rgb('#ff0000'))  # Output: (255, 0, 0)

Truncate a Colormap

import matplotlib.pyplot as plt
import numpy as np
from yuxin_helpers import truncate_colormap

# Example usage
cmap = plt.get_cmap('viridis')
truncated_cmap = truncate_colormap(cmap, minval=0.2, maxval=0.8, n=200)

# Plotting to visualize the truncated colormap
plt.imshow(np.linspace(0, 1, 100).reshape(10, 10), cmap=truncated_cmap)
plt.colorbar()
plt.show()

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

yuxin_helpers-0.1.5.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

yuxin_helpers-0.1.5-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file yuxin_helpers-0.1.5.tar.gz.

File metadata

  • Download URL: yuxin_helpers-0.1.5.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for yuxin_helpers-0.1.5.tar.gz
Algorithm Hash digest
SHA256 338095e01bd271b1bb450938bd2a9b39c8ca9263807087839ac05f66804758ab
MD5 8d17c7206bff1f8854a41bf5efa798ed
BLAKE2b-256 35baa5522cfa2fccd4d9be8e9dc262940a75b037b20895f5ffe500ba774073cd

See more details on using hashes here.

File details

Details for the file yuxin_helpers-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: yuxin_helpers-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for yuxin_helpers-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 081be67dfb8339af133c1af59fbfeb97447a3cde96638bb11ebc27da6bac9a43
MD5 5ffc877773a6ae4f682ff62e2a565e08
BLAKE2b-256 dd51c4b64544065767b89e90792676cf9cf8d46ec7ad5465b59a4fe997d3970f

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