Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import matplotlib.pyplot as plt
- import ptitprince as pt # Import ptitprince for raincloud plots
- import seaborn as sns # Import Seaborn for color palettes
- # Replace 'B5 segmentSummary (1).csv' with the actual CSV file path
- file_path = 'B5 segmentSummary (1).csv'
- # Define the range of column positions you want to analyze (columns 6 through 10)
- start_column_position = 6 # Corresponds to column 6
- end_column_position = 9 # Corresponds to column 10
- # Read the CSV file into a Pandas DataFrame
- df = pd.read_csv(file_path)
- # Create a Seaborn color palette for differentiation
- colors = sns.color_palette('husl', n_colors=end_column_position - start_column_position + 1)
- # Create a figure with subplots for Raincloud plots
- plt.figure(figsize=(12, 12))
- # Iterate through the selected columns and create Raincloud plots with different colors
- for i, col in enumerate(df.columns[start_column_position:end_column_position + 1]):
- plt.subplot(2, 2, i + 1) # Create subplots for Raincloud plot
- pt.RainCloud(data=df, x=col, orient='h', width_viol=0.6, width_box=0.4, palette=[colors[i]])
- plt.title(f'Raincloud Plot for {col}')
- # Adjust layout
- plt.tight_layout()
- # Show the plots
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement