Untitled
import altair as alt import pandas as pd # Calculate the time to travel 100 cm at a speed of 47.619 cm/s time = 100 / 47.619 # Create a DataFrame with the calculated time and distance df = pd.DataFrame({'Time (s)': [time], 'Distance (cm)': [100]}) # Create a line chart with the calculated time on the x-axis and distance 100 cm on the y-axis chart = alt.Chart(df).mark_line(point=True).encode( x='Time (s)', y='Distance (cm)', tooltip=['Time (s)', 'Distance (cm)'] ).properties( title='Time vs. Distance', ).interactive() # Save the chart chart.save('time_vs_distance_line_chart.json')
Leave a Comment