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.3.tar.gz
(2.4 kB
view details)
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 yuxin_helpers-0.1.3.tar.gz.
File metadata
- Download URL: yuxin_helpers-0.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f7e0ece54c033af23eeb98c12d1c61c60e252c35003a8055463a034d1a384d
|
|
| MD5 |
5e23ef0247b4c98e2297afa74c9414e3
|
|
| BLAKE2b-256 |
b430670bbbd582e36d1c22e486bee9d8ad868e943d070c07713e99524aef0bc2
|
File details
Details for the file yuxin_helpers-0.1.3-py3-none-any.whl.
File metadata
- Download URL: yuxin_helpers-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
583fed6fee42f4ec86a505f38e7f4003ded442dd14544b7b765aba71851de44a
|
|
| MD5 |
7b2afdb8950206f3a050245d771a3131
|
|
| BLAKE2b-256 |
407c6a2e0a37e457c94c290429fe0a2bd78cbc1a27c0c38f58e15671d22e63fe
|