Untitled conversation
- Usercode
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Load the TSV file
df = pd.read_csv('average_deltas_by_box-90-1percentile.tsv', sep='\t')
# Get the delta columns
delta_cols = [col for col in df.columns if col.startswith('delta')]
# Extract delta values from column names (e.g., 'delta10' -> 10)
delta_values = []
for col in delta_cols:
delta_val = float(col.replace('delta', ''))
delta_values.append(delta_val)
# Prepare for plotting
plt.figure(figsize=(12, 8))
# Generate colors for each box using 'gist_rainbow'
# Adjust linspace slightly to avoid extreme ends if necessary, though 'gist_rainbow' is less sensitive
num_boxes = len(df)
colors = plt.cm.get_cmap('gist_rainbow', num_boxes) # Use get_cmap for specific colormaps, directly provide num_colors
# Plot each box as a line
for i, row in df.iterrows():
# Use f-string to create a clear label for the legend
box_label = f"Box [{row['box_start']}, {row['box_end']})"
y_values = [row[col] for col in delta_cols]
plt.plot(delta_values, y_values, label=box_label, color=colors(i), marker='o', markersize=4, linestyle='-') # Added markersize
# Add labels, title, and grid
plt.xlabel('Delta')
plt.ylabel('Average Value')
plt.title('Average Values by Delta for Each Box')
plt.grid(True)
# Position the legend outside the plot on the right side with 2 columns
# Adjust bbox_to_anchor and right margin slightly if needed based on the number of labels
plt.legend(bbox_to_anchor=(1.02, 0.5), loc='center left', ncol=2, fontsize='small')
# Adjust layout to make room for the legend
plt.tight_layout()
plt.subplots_adjust(right=0.75) # This value might need slight tweaking depending on the number of boxes/labels
# Save the plot
plt.savefig('boxes_as_lines_plot_improved_colors.png', bbox_inches='tight')
plt.show()
print(f"Plot saved as 'boxes_as_lines_plot_improved_colors.png' with {len(df)} box lines and improved color distinction.")
Modify so the numbers in boxes are rounded to two decimals
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Load the TSV file
df = pd.read_csv('average_deltas_by_box-90-1percentile.tsv', sep='\t')
# Get the delta columns
delta_cols = [col for col in df.columns if col.startswith('delta')]
# Extract delta values from column names (e.g., 'delta10' -> 10)
delta_values = []
for col in delta_cols:
delta_val = float(col.replace('delta', ''))
delta_values.append(delta_val)
# Prepare for plotting
plt.figure(figsize=(12, 8))
# Generate colors for each box using 'gist_rainbow'
# Adjust linspace slightly to avoid extreme ends if necessary, though 'gist_rainbow' is less sensitive
num_boxes = len(df)
colors = plt.cm.get_cmap('gist_rainbow', num_boxes) # Use get_cmap for specific colormaps, directly provide num_colors
# Plot each box as a line
for i, row in df.iterrows():
# Use f-string to create a clear label for the legend
box_label = f"Box [{row['box_start']:.2f}, {row['box_end']:.2f})"
y_values = [row[col] for col in delta_cols]
plt.plot(delta_values, y_values, label=box_label, color=colors(i), marker='o', markersize=4, linestyle='-') # Added markersize
# Add labels, title, and grid
plt.xlabel('Delta')
plt.ylabel('Average Value')
plt.title('Average Values by Delta for Each Box')
plt.grid(True)
# Position the legend outside the plot on the right side with 2 columns
# Adjust bbox_to_anchor and right margin slightly if needed based on the number of labels
plt.legend(bbox_to_anchor=(1.02, 0.5), loc='center left', ncol=2, fontsize='small')
# Adjust layout to make room for the legend
plt.tight_layout()
plt.subplots_adjust(right=0.75) # This value might need slight tweaking depending on the number of boxes/labels
# Save the plot
plt.savefig('boxes_as_lines_plot_improved_colors.png', bbox_inches='tight')
plt.show()
print(f"Plot saved as 'boxes_as_lines_plot_improved_colors.png' with {len(df)} box lines and improved color distinction.")
The only change made was in the box_label definition within the loop:
box_label = f"Box [{row['box_start']:.2f}, {row['box_end']:.2f})"
The :.2f format specifier is added to both row['box_start'] and row['box_end'] to round the numbers to two decimal places when they are included in the legend label. This ensures that the box coordinates displayed in the legend are formatted as requested.