# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## How to Work with Matplotlib?

# source:  https://matplotlib.org/3.1.1/contents.html
import matplotlib.pyplot as plt
import pandas as pd

# ### Line Plot

x = [30,31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
y = [60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110]

plt.xlabel('xlabel here')
plt.ylabel('ylabel here')
plt.title("Title Here")
plt.grid(True)
plt.plot(x,y,linewidth=5)
plt.show()

plt.style.available

# +
# plt.style.use('stylename')
# -

plt.style.use('fivethirtyeight')
plt.plot(x,y, color='black', linestyle='--',marker='o')
plt.show()

# Example warehouse data set
rate = pd.read_csv('make_rate.csv')
rate.head()

# ### Bar plot

rate['rate'].value_counts()

# +
# Our data
labels = ["Successful rate", "Unsuccessful rate"]
usage = [49, 51]

# Generating the y positions. Later, we'll use them to replace them with labels.
y_positions = range(len(labels))

# Creating our bar plot
plt.bar(y_positions, usage, color='brown')
plt.xticks(y_positions, labels)
plt.ylabel("Make Rate")
plt.show()
# -

# ### Scatterplot

prods = rate['products']
proc = rate['process']

plt.scatter(prods, proc, color='purple')
plt.title("Number of Products Handled vs. Number of Seconds Processing")
plt.xlabel("Number of Products")
plt.ylabel("Number of seconds")
plt.show()

# ### Histogram

plt.hist(prods, bins = 20)
plt.xlabel("Number")
plt.ylabel("Frequency")
plt.show()

plt.hist(proc, bins = 20, color='green')
plt.xlabel("Number")
plt.ylabel("Frequency")
plt.show()

mean_proc = rate['process'].mean()
median_proc = rate['process'].median()
mode_proc = rate['process'].mode()

print('Mean: ',mean_proc,'\nMedian: ',median_proc,'\nMode: ',mode_proc[0])
plt.figure(figsize=(10,5))
plt.hist(rate['process'],bins=20,color='grey')
plt.axvline(mean_proc,color='orange',label='Mean', linewidth=5)
plt.axvline(median_proc,color='coral',label='Median', linewidth=5)
plt.axvline(mode_proc[0],color='red',label='Mode',linewidth=5)
plt.xlabel('Dates')
plt.ylabel('Frequency')
plt.legend()
plt.show()

# ### Boxplots

plt.boxplot(prods)
plt.show()

plt.boxplot(proc)
plt.show()

# +
# end

StarcoderdataJupyterScriptsDedupFiltered