koala-13b· UC Berkeley
Arena Human Preference 55K
Write some sample code to plot multiple boxplots using altair.
- User
Write some sample code to plot multiple boxplots using altair.
- Assistant
Here is an example of how to plot multiple boxplots using Altair:
import altair as alt # Generate some data n_data = 50 data = np.random.randn(n_data) # Create 3 boxplots boxplot_1 = alt.boxplot(data, height=20) boxplot_2 = alt.boxplot(data, height=20) boxplot_3 = alt.boxplot(data, height=20) # Add labels and title to the plots alt.title("Boxplot 1") alt.label("n_data", x="right") alt.title("Boxplot 2") alt.label("n_data", x="right") alt.title("Boxplot 3") alt.label("n_data", x="right") # Add a horizontal line to the middle of the first plot alt.set_axis_property("x", "range", [0, 1]) alt.boxplot(data, height=20, ylim=0, ylim_anchor="top") alt.boxplot(data, height=20, ylim=1, ylim_anchor="top") alt.boxplot(data, height=20, ylim=0, ylim_anchor="top") alt.boxplot(data, height=20, ylim=1, ylim_anchor="top") alt.add_trace(alt.Line(x=[0.5, 0.5], y=[0, 1])) # Add a vertical line to the middle of the second plot alt.set_axis_property("x", "range", [0, 1]) alt.boxplot(data, height=20, ylim=0, ylim_anchor="top") alt.boxplot(data, height=20, ylim=1, ylim_anchor="top") alt.boxplot(data, height=20, ylim=0, ylim_anchor="top") alt.boxplot(data, height=20, ylim=1, ylim_anchor="top") alt.add_trace(alt.Line(x=[0.5, 0
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.