from matplotlib import pyplot as plt
%matplotlib inline

plt.plot([5,6,7,8],[7,4,8,4])

## Adding labels
plt.title("Random Plot")
plt.xlabel("$1/2\cdot x$")
plt.ylabel("Dispersion $[m]$")

"""
Explanation: Matplotlib Tutorial
Usually what we use is the pyplot module of matplotlib.
Let's inline plt and make a simple plot with titles for the axes.
End of explanation
"""


# import the styles
from matplotlib import style

# select the 'ggplot' style from the default ones
style.use('ggplot')

# and make the same plot -- pretty cool heh? :)
plt.plot([5,6,7,8],[7,4,8,4])
plt.title("Random Plot")
plt.xlabel("$1/2\cdot x$")
plt.ylabel("Dispersion $[m]$")

"""
Explanation: Styles
We can use a simple style usage for the plots made by plt.
Let's try and use the ggplot style
End of explanation
"""


# add 2 plots on the same canvas
plt.plot([2,3,4],[4,9,16], color='green', label="$x^2", lw=2)
plt.plot([2,3,4],[8,27,64], color='red', label="$x^3", lw=3)

# add the legend:
plt.legend()

# add grid
plt.grid(True, color='blue')

"""
Explanation: We can also use some of the formatting options in the plot command. For example color, width, label, etc.
End of explanation
"""


