LoslegenKostenlos loslegen

Plot your time series on individual plots

It can be beneficial to plot individual time series on separate graphs as this may improve clarity and provide more context around each time series in your DataFrame.

It is possible to create a "grid" of individual graphs by "faceting" each time series by setting the subplots argument to True. In addition, the arguments that can be added are:

  • layout: specifies the number of rows x columns to use.
  • sharex and sharey: specifies whether the x-axis and y-axis values should be shared between your plots.

Diese Übung ist Teil des Kurses

Visualizing Time Series Data in Python

Kurs anzeigen

Anleitung zur Übung

  • Create a facetted plot of the meat DataFrame using a layout of 2 rows and 4 columns.
  • Ensure that the subgraphs do not share x-axis and y-axis values.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Create a facetted graph with 2 rows and 4 columns
meat.plot(subplots=____, 
          layout=____, 
          sharex=____, 
          sharey=____, 
          colormap='viridis', 
          fontsize=2, 
          legend=False, 
          linewidth=0.2)

plt.show()
Code bearbeiten und ausführen