Plotting in notebooks requires using a magic command, which starts with
%, to initialize the plotting backend.
# Setup %matplotlib inline
Begin by loading the data in hf.h5. This data set contains high-frequency price data for IBM and MSFT on a single day stored as two Series. IBM is stored as "IBM" in the HDF file, and MSFT is stored as "MSFT.
Produce a histogram of MSFT 1-minute returns (Hint: you have to produce the 1-minute Microsoft returns first using
Problem: Scatter Plot¶
Scatter the 5-minute MSFT returns against the 5-minute IBM returns.
Hint: You will need to create both 5-minute return series, merge them, and then plot using the combined DataFrame.
Exercise: Plot histograms and a scatter plot¶
Produce a 2 by 2 subplot with:
- Create a square figure with a size of 10 by 10 using
- Histograms of IBM and MSFT on the diagonals
- Scatter plots on the off-diagonals where the x and y line up with the histogram on the diagonal.
- Set the limits of the scatter plots to match the appropriate histogram x and y limit.
- Clean up the plot using
Exercise: Use pandas plotting tools¶
pandas.plotting.scatter_matrix to produce a similar plot to the previous exercise.