Untitled conversation
- Userpython
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.
prefiller_received['reconstruction_time_ms'] = prefiller_received['reconstruction_time_ns'] / 1_000_000
prefiller_received['were_bytes_missing?'] = np.where(prefiller_received['bytes_missing'] > 0, 'True', 'False')
# Create the 2x2 grid of plots
fig, axes = plt.subplots(2, 2, figsize=(10, 12), tight_layout=True)
# --- Line Plots ---
histcolor = "#749940"
# Bytes missing
histplot_missing = sns.histplot(data=prefiller_received[prefiller_received['bytes_missing'] > 0], x='reconstruction_time_ms', log_scale=2, ax=axes[0, 0], color=histcolor)
histplot_missing.set(title='Bytes Missing')
# No bytes missing
histplot_no_missing = sns.histplot(data=prefiller_received[prefiller_received['bytes_missing'] == 0], x='reconstruction_time_ms', ax=axes[0, 1], color=histcolor)
histplot_no_missing.set(title='No Bytes Missing')
# --- Violin Plots ---
# Bytes missing
violinplot_missing = sns.violinplot(data=prefiller_received[prefiller_received['bytes_missing'] > 0], x="were_bytes_missing?", y='reconstruction_time_ms', ax=axes[1, 0])
violinplot_missing.set(title='Bytes Missing')
# No bytes missing
violinplot_no_missing = sns.violinplot(data=prefiller_received[prefiller_received['bytes_missing'] == 0], x="were_bytes_missing?", y='reconstruction_time_ms', ax=axes[1, 1])
violinplot_no_missing.set(title='No Bytes Missing')
plt.show()
top left chart shows x axis labels in powers of 2, I want them in exact numbers
prefiller_received['reconstruction_time_ms'] = prefiller_received['reconstruction_time_ns'] / 1_000_000
prefiller_received['were_bytes_missing?'] = np.where(prefiller_received['bytes_missing'] > 0, 'True', 'False')
# Create the 2x2 grid of plots
fig, axes = plt.subplots(2, 2, figsize=(10, 12), tight_layout=True)
# --- Line Plots ---
histcolor = "#749940"
# Bytes missing
histplot_missing = sns.histplot(data=prefiller_received[prefiller_received['bytes_missing'] > 0], x='reconstruction_time_ms', ax=axes[0, 0], color=histcolor)
histplot_missing.set(title='Bytes Missing')
axes[0, 0].ticklabel_format(style='plain', axis='x') # Disable scientific notation
# No bytes missing
histplot_no_missing = sns.histplot(data=prefiller_received[prefiller_received['bytes_missing'] == 0], x='reconstruction_time_ms', ax=axes[0, 1], color=histcolor)
histplot_no_missing.set(title='No Bytes Missing')
axes[0, 1].ticklabel_format(style='plain', axis='x') # Disable scientific notation
# --- Violin Plots ---
# Bytes missing
violinplot_missing = sns.violinplot(data=prefiller_received[prefiller_received['bytes_missing'] > 0], x="were_bytes_missing?", y='reconstruction_time_ms', ax=axes[1, 0])
violinplot_missing.set(title='Bytes Missing')
# No bytes missing
violinplot_no_missing = sns.violinplot(data=prefiller_received[prefiller_received['bytes_missing'] == 0], x="were_bytes_missing?", y='reconstruction_time_ms', ax=axes[1, 1])
violinplot_no_missing.set(title='No Bytes Missing')
plt.show()
Explanation:
The key change is adding the line axes[0, 0].ticklabel_format(style='plain', axis='x') and axes[0, 1].ticklabel_format(style='plain', axis='x') after creating the histograms.
axes[0, 0] and axes[0, 1] refer to the axes objects for the top-left and top-right plots, respectively.ticklabel_format(style='plain', axis='x') tells matplotlib to format the x-axis tick labels in a plain, non-scientific notation style. This forces the display of exact numbers instead of powers of 10.This modification ensures that the x-axis labels on the histograms are displayed as regular numbers (e.g., 10.5, 25.0) instead of scientific notation (e.g., 1e+01, 2e+01). The violin plots already display the x-axis labels as strings ("True", "False"), so no changes are needed there.
scalarplotter....
Okay, you're switching gears to Scalarplotter (VTK-based visualization). Here's how you'd approach a similar visualization task using Scalarplotter, aiming for the same insights as the matplotlib code you provided. I'll break it down with explanations.
import numpy as np
import scalarplotter as sp
# Assuming 'prefiller_received' DataFrame is already created as in your original code
# Create the Scalarplotter window
win = sp.Scalarplotter()
# --- Histograms ---
# Bytes missing
win.add_histogram(prefiller_received[prefiller_received['bytes_missing'] > 0]['reconstruction_time_ms'],
title='Bytes Missing',
color="#749940")
# No bytes missing
win.add_histogram(prefiller_received[prefiller_received['bytes_missing'] == 0]['reconstruction_time_ms'],
title='No Bytes Missing',
color="#749940")
# --- Violin Plots (approximated with box plots) ---
# Scalarplotter doesn't have a direct equivalent to violin plots.
# We can approximate it with box plots.
# Bytes missing
win.add_boxplot(prefiller_received[prefiller_received['bytes_missing'] > 0]['reconstruction_time_ms'],
title='Bytes Missing (Boxplot)',
color="#749940")
# No bytes missing
win.add_boxplot(prefiller_received[prefiller_received['bytes_missing'] == 0]['reconstruction_time_ms'],
title='No Bytes Missing (Boxplot)',
color="#749940")
# Arrange the plots (Scalarplotter handles layout automatically)
# You can adjust the window size if needed.
win.show()
Key Differences and Explanations:
Import: We import .
scatterplotter as spWindow Creation: win = sp.Scalarplotter() creates the main visualization window.
Histograms:
win.add_histogram() is used to create histograms. You pass the data series directly.title and color arguments are similar to matplotlib.Violin Plots (Approximation):
win.add_boxplot() to create box plots instead. Box plots show the median, quartiles, and outliers, providing a similar (though not identical) view of the data distribution.Layout:
plt.subplots() in matplotlib. The plots will be stacked vertically by default. You can control the layout more precisely using win.add_plot() and specifying positions, but for this simple case, the automatic layout is sufficient.win.show(): This displays the visualization window.
Important Considerations:
prefiller_received['reconstruction_time_ms'] is a Pandas Series.To run this code:
pip install scalarplotterpip install vtkThis will open a Scalarplotter window with the histograms and box plots. You can then interact with the visualization to explore the data. Let me know if you have any other questions or want to explore more advanced features of Scalarplotter!