vicuna-13b· LMSYS
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 some sample code that demonstrates how to create multiple boxplots using Altair:
import altair as alt import pandas as pd # Create a dataframe data = {'x': [1, 2, 3, 4, 5], 'y1': [2, 3, 4, 5, 6], 'y2': [2.5, 3.5, 4.5, 5.5, 6.5], 'y3': [3, 4, 5, 6, 7], 'y4': [3.5, 4.5, 5.5, 6.5, 7.5]} df = pd.DataFrame(data) # Define the chart chart = alt.Chart(df).mark_boxplot().encode( x='x:Nominal', y1='y1:Nominal', y2='y2:Nominal', y3='y3:Nominal', y4='y4:Nominal' ) # Show the chart chartThis code will generate a boxplot for each column in the dataframe. The
mark_boxplot()function is used to specify the type of plot to be created, and the function is used to specify the encoding for the x and y axis.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.