diff --git a/demo_plotter.py b/demo_plotter.py index b876c8e..991152b 100755 --- a/demo_plotter.py +++ b/demo_plotter.py @@ -35,16 +35,19 @@ else: data = meas_data +################################################################################ +################## Question 1 ################################################## +################################################################################ + # Construct a dataframe and pivot it to obtain a dataframe with a column per unit, and a row per timestamp. df = pd.DataFrame.from_records(data) df_pivot = df.pivot_table(values='value', columns='unit', index='time') - # Plot the data. Note, that the data will mostly not be plotted with lines. plt.ion() # Turn interactive mode on plt.figure() ax1 = plt.subplot(211) # Make two separate figures ax2 = plt.subplot(212) -df_pivot[[c for c in df_pivot.columns if "_p" in c]].plot(marker='.', ax=ax1, linewidth=3) -df_pivot[[c for c in df_pivot.columns if "_q" in c]].plot(marker='.', ax=ax2, linewidth=3) +df_pivot['pcc_p'].plot(marker='.', ax=ax1, linewidth=3) +df_pivot['pcc_q'].plot(marker='.', ax=ax1, linewidth=3) plt.show(block=True)