<jupyter_start><jupyter_text>Why is visulization important? A picture is worth a 1000 words!Looking at a chart or a map helps us make a meaningful observations of our data by just looking at them.  What is Matplotlib? There are hundrads of different modules available, but Matplotlub gives us **complete control** over the properties of our graphs/charts<jupyter_code>!pip3 install matplotlib<jupyter_output>Requirement already satisfied: matplotlib in /Users/negarvahid/.local/share/virtualenvs/negarvahid-mIme9Lir/lib/python3.7/site-packages (3.4.3)
Requirement already satisfied: numpy>=1.16 in /Users/negarvahid/.local/share/virtualenvs/negarvahid-mIme9Lir/lib/python3.7/site-packages (from matplotlib) (1.20.0)
Requirement already satisfied: pillow>=6.2.0 in /Users/negarvahid/.local/share/virtualenvs/negarvahid-mIme9Lir/lib/python3.7/site-packages (from matplotlib) (8.1.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /Users/negarvahid/.local/share/virtualenvs/negarvahid-mIme9Lir/lib/python3.7/site-packages (from matplotlib) (1.3.1)
Requirement already satisfied: pyparsing>=2.2.1 in /Users/negarvahid/.local/share/virtualenvs/negarvahid-mIme9Lir/lib/python3.7/site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: python-dateutil>=2.7 in /Users/negarvahid/.local/share/virtualenvs/negarvahid-mIme9Lir/lib/python3.7/site-packages (from matplotlib) (2.8.1)
Requirement [...]<jupyter_text>**pyplot**<jupyter_code>import matplotlib.pyplot as plt
fig, ax = plt.subplots()
plt.show()<jupyter_output><empty_output><jupyter_text>`figure object` = A container of everything we see on the page.`axes object` = A canvas in which we will visualize our data! Importing required libraries and dataset to plot using Pandas `pd.read_csv()`Extracting important parts for plots using conditions on Pandas Dataframes.`plt.plot()`for plotting line chart similarly in place of plot other functions are used for plotting. All plotting functions require data and it is provided in the function through parameters.`plot.xlabel` , plt.ylabel for labeling x and y-axis respectively.`plt.legend()` for signifying the observation variables.`plt.title()` for setting the title of the plot.`plot.show()` for displaying the plot.  Austin Weather<jupyter_code>import pandas as pd
austin_weather = pd.read_csv('austin_weather.csv')
austin_weather = austin_weather[['Date', 'TempAvgF','WindAvgMPH']]
austin_weather.head()
austin_weather.shape
austin_weather['Date'] = pd.to_datetime(austin_weather['Date'])
summary = austin_weather.resample('Y', on='Date').sum()
summary.head()<jupyter_output><empty_output><jupyter_text>- The first plotting command we will try, is `.plot`<jupyter_code>fig, ax = plt.subplots()
ax.plot(summary)
plt.show()<jupyter_output><empty_output><jupyter_text>Well, it works! but as you can see the meaning of iur line isn't clear<jupyter_code>fig, ax = plt.subplots()
ax.plot(summary)
plt.xlabel("Date")
plt.ylabel("Average Wind Temp(F) Per Hour")
plt.show()<jupyter_output><empty_output><jupyter_text>Again, the X Axes lables are not clear, Let's fix that.<jupyter_code>fig, ax = plt.subplots()
fig.set_figwidth(12)
fig.set_figheight(6)
ax.plot(summary)
plt.xlabel("Date")
plt.ylabel("Average Wind Miles Per Hour")
plt.show()<jupyter_output><empty_output><jupyter_text>There we go! Wait a minute... This is showing us two months of the same year... but our data was technically just yearly.Matplotlib is showing our data **continiously**, We want it to be **discrete**<jupyter_code>fig, ax = plt.subplots()
fig.set_figwidth(12)
fig.set_figheight(6)
ax.plot(summary, marker = "o")
plt.xlabel("Date")
plt.ylabel("Average Wind Miles Per Hour")
plt.show()<jupyter_output><empty_output><jupyter_text>Choosing The Color and adding a Title Label<jupyter_code>fig, ax = plt.subplots()
fig.set_figwidth(12)
fig.set_figheight(6)
ax.plot(summary, marker = "o", color = 'r')
ax.set_title("Temp VS Year 2013-2018 in Austin")
plt.xlabel("Date")
plt.ylabel("Average Wind Miles Per Hour")
plt.show()<jupyter_output><empty_output><jupyter_text>Pokemon Dataset<jupyter_code>df = pd.read_csv('pokemons.csv')
df.head()<jupyter_output><empty_output><jupyter_text>Histograms<jupyter_code>def get_type(df, type_name):
    return df[df['Type 1'] == type_name]

water_df = get_type(df, 'Water')
# make canvas
fig = plt.figure()
# add subplot
ax = fig.add_subplot(111)
# plot histogram
ax.hist(water_df['Total'])
import matplotlib.ticker as ticker

fig = plt.figure()
ax = fig.add_subplot(111)
ax.hist(water_df['Total'], bins=20, color='deepskyblue')
ax.set_title('Distribution of "Total" stat for Pokemons of "Type 1" Water')
ax.set_xlabel("Total", size=12)
ax.tick_params(axis='both', which='major', labelsize=12)
ax.yaxis.set_major_locator(ticker.MultipleLocator(5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1267429760665973, 'fraction_numerical': 0.018314255983350677, 'mean_word_length': 6.556603773584905, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 45, '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': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '346524', 'license': 'CC0-1.0', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1700, 'n_words': 408, 'path': 'week-3/pandas & data viz/Data-Visualiztion.ipynb', 'repo_name': 'JungleProgram/python-essentials', 'size': '4805'}