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.4.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.4.tar.gz.
File metadata
- Download URL: yuxin_helpers-0.1.4.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 |
17166d5ce70918dd3f5252d60179b85173b76263a1f7736893fe540b649a1a7c
|
|
| MD5 |
4e32c4a0221dc79edcac25bf0bdbc9d4
|
|
| BLAKE2b-256 |
fc4f5c237475f730688f22e6b9ff5008da937124270b9c00188286799ecf2dcb
|
File details
Details for the file yuxin_helpers-0.1.4-py3-none-any.whl.
File metadata
- Download URL: yuxin_helpers-0.1.4-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 |
0b0a40d2af95d52ccf8655f55e143185a84eac120267647df6d093a1468cfeb9
|
|
| MD5 |
f4d6060257766e77e2d70191475189da
|
|
| BLAKE2b-256 |
286dce571e9c4d2873f0f5a2671ce351b2666629cc14d714a7d37aed0ed7b1ba
|