This module requires Python and the following Python libraries:
- numpy
- matplotlib
- pandas
- distinctipy
- jupyter
- scipy
-
Clone this repository or download the module files to a local directory.
-
Navigate to the directory containing
requirements.txt
. -
Create a virtual environment (recommended):
-
Install the required packages:
pip install -r requirements.txt
. -
Start a Jupyter Notebook to run the visualizations:
Import the module in your Jupyter Notebook and use the provided functions to create plots:
from color_jitter import *
color_wheel_plot(n_categories=8, custom_palette=nightingale_palette, color_jitter=0.08)
Or use it right away with the iris dataset:
import seaborn as sns
# Load the Iris dataset
iris_df = sns.load_dataset('iris')
# Convert the 'cut' column to a categorical type with the specified order
iris_df['species'] = pd.Categorical(iris_df['species'])#, categories=cut_order, ordered=True)
# Assuming 'categories_in_data' is a list of your data's categories
categories_in_data = iris_df['species'].unique()
# Extract the first N colors from the Nightingale palette
num_categories = len(categories_in_data)
selected_colors = list(nightingale_palette.values())[:num_categories]
# Build the new palette
category_palette = {category: color for category, color in zip(categories_in_data, selected_colors)}
plot_title = 'A good amount of color jitter'
colorjitter_scatterplot(iris_df, 'sepal_length', 'sepal_width', 'species', jitter_intensity=0.1, point_size=20, opacity=1,
custom_palette=category_palette, plot_title=plot_title,
x_label='Sepal Length (cm)',
y_label='Sepal Width (cm)')
See the Jupyter notebook for more advanced usage.