<jupyter_start><jupyter_text>Imports<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd<jupyter_output><empty_output><jupyter_text>Load Sample Stock Price Data<jupyter_code>df = pd.read_csv('lnkd.csv', parse_dates=['Date'], index_col='Date')
df.head()<jupyter_output><empty_output><jupyter_text>`subplots()` method<jupyter_code># subplots with 1 row and 2 columns, and plot size in inches
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 6))
# locate close price for 2016-04, and plot it on axis 1
df.loc['2016-04', 'Close'].plot(ax=ax1)
# locate volume quantity for 2016-04, and plot it on axis 2
df.loc['2016-04', 'Volume'].plot(ax=ax2, rot=45)
# cax: closing ax , vax: volume ax
cax, vax = df[['Close', 'Volume']].plot(subplots=True)
# get mina and max values for cax
xmin, xmax = cax.get_xlim()
# draw a green line with the hlines fucntion
cax.hlines(df['Close'].mean(), xmin, xmax, color='green')<jupyter_output><empty_output><jupyter_text>`ipywidgets` example<jupyter_code>from ipywidgets import interact
import numpy as np
# interact as a decorator
@interact(limit=6)
def plot_sin(limit):
    xs = np.linspace(-limit, limit, 100)
    plt.plot(xs, np.sin(xs), label='sin(x) [{} - {}]'.format(-limit, limit))
    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15247678018575853, 'fraction_numerical': 0.033281733746130034, 'mean_word_length': 6.473988439306359, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '555044', 'license': 'MIT', 'n_tokens_mistral': 527, 'n_tokens_neox': 490, 'n_words': 122, 'path': '3_Data_Visualization/3_1_matplotlib/matplotlib_advanced.ipynb', 'repo_name': 'TheManohar/DSci_Pro', 'size': '1292'}