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.2.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.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yuxin_helpers-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0f3f8a9a2a33c43118d44af7c192b96496d521699ff6b5c40532833f9e95c789
MD5 eaee3bb3530ef884d5da6b95e80ca614
BLAKE2b-256 84df63d6ed1ab1a561b67fd21f4e0580bc1e4be605a5db9f7a9dbed8e35006a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yuxin_helpers-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0c84dc38f6787a37bf675824b0c7adcb281df5fb78f6228661c9b9fb3345c49e
MD5 e4a0111c930807e5f07be985260dd1f0
BLAKE2b-256 0096041295ddaf6764ea0b07935b0e954b6f14111ea5671f11a9fed67fe4b61b

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