Python Matplotlib: Visualize Returns, Volatility Scatter, & Relative Performance | Part 12 📈

Опубликовано: 22 Март 2026
на канале: Matt Macarty
2,533
34

‪@MattMacarty‬
🐍 Python Matplotlib: Visualize Returns, Volatility Scatter, & Relative Performance | Part 12

Welcome to *Part 12* of the Python Stock Analysis Course!

Continuing our work on the custom `Stock` class, this video focuses on adding more complex visualizations using *Matplotlib**. We implement two crucial plotting methods: one for **risk visualization* and one for **price performance**.

You will learn how to create a scatter plot to visualize *volatility outliers* and a clean line plot to show the *relative (normalized) performance* of the stock over the entire data range.

🎯 Key Learning Outcomes:
1. *Volatility Scatter Plot:* Create a scatter plot to visualize *Daily Returns* (Y-axis) against *Movement Magnitude* (X-axis, measured in standard deviations). This helps identify and visualize volatility outliers and risk.
2. *Relative Performance Plot:* Implement a line plot that visualizes the stock's *Normalized Performance* (percentage gain/loss since the start of the data).
3. *Data Normalization:* Learn the Pandas/NumPy calculation for normalizing the close price: `(Close / First Close) - 1`.
4. *Matplotlib Formatting:* Use the *`PercentFormatter`* from `matplotlib.ticker` to correctly display the Y-axis of the performance plot as clean percentages.

⏱️ Video Chapters (Jump Ahead!):
0:00 - Introduction & Review (Continuing with the `Stock` Class)
0:36 - Defining the *`plot_volatility`* Method
1:08 - Creating the *Returns vs. Magnitude Scatter Plot*
1:35 - Adding Reference Lines for Interpretation
1:58 - Testing and Analyzing the Volatility Scatter Plot
2:46 - Defining the *`plot_performance`* Method
3:17 - Calculating *Relative Performance* (Normalization)
4:00 - Formatting the Y-Axis as a *Percentage*
4:18 - Testing and Reviewing the Final Performance Plot
4:55 - Preview of Part 13: More Data Transformations

🔗 Course Series & Resources:
*Part 11 (Returns & Volatility Calculation):* [   • Python Class: Calculate Log Returns, Rolli...  ](   • Python Class: Calculate Log Returns, Rolli...  )
*Get the Code:*
https://github.com/mjmacarty/python-s...

**Disclaimer: This video is for educational purposes only. The information provided should not be construed as investment advice. **

\#PythonMatplotlib \#VolatilityScatterPlot \#RelativePerformance \#