diff --git a/code/plots/laplace-adj-graph.py b/code/plots/laplace-adj-graph.py new file mode 100644 index 0000000..cdd3e80 --- /dev/null +++ b/code/plots/laplace-adj-graph.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import numpy as np +from matplotlib import pyplot as plt +from scipy.stats import laplace + +plt.rc('font', family='serif') +plt.rc('font', size=10) +plt.rc('text', usetex=True) + +x = np.arange(0.0, 6.0, 0.01) + +# Draw the first laplace distribution. +plt.plot(x,\ + laplace.pdf(x, loc=2.0, scale=1.0),\ + label=r'$\textrm{Laplace}(2, 1)$',\ + color='#009874') + +# # Draw the second laplace distribution. +# plt.plot(x,\ +# laplace.pdf(x, loc=1.0, scale=1.0),\ +# label=r'$\textrm{Laplace}(1, 1)$',\ +# color='#e52e4e') + +# Configure the plot. +plt.axis([0.0, 6.0, 0.0, 0.6]) # Set plot box. +plt.legend(loc='best', frameon=False) # Set plot legend. +plt.grid(axis='y', alpha=1.0) # Add grid on y axis. +plt.xlabel('Count') # Set x axis label. +plt.ylabel('Probability') # Set y axis label. + +plt.show() # Show the plot in a new window. diff --git a/code/plots/laplace-graph.py b/code/plots/laplace-graph.py new file mode 100644 index 0000000..fe60491 --- /dev/null +++ b/code/plots/laplace-graph.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import sys +sys.path.insert(1, 'code/lib') +import lmdk_lib +import numpy as np +from matplotlib import pyplot as plt +from scipy.stats import laplace + +# Initialize plot +lmdk_lib.plot_init() +# The x axis +x = np.arange(0.0, 6.0, 0.01) +plt.xlabel('Count') +# Set y axis label +plt.ylabel('Likelihood') +# Draw the first laplace distribution +plt.plot(x, + laplace.pdf(x, loc=2.0, scale=1.0), + label='Laplace(2, 1)', + linewidth=lmdk_lib.line_width) + +# Configure the plot +plt.axis([0.0, 6.0, 0.0, 0.6]) # Set plot box. +# Plot legend +lmdk_lib.plot_legend() +# Show the plot in a new window +plt.show() diff --git a/graphics/laplace.pdf b/graphics/laplace.pdf index e12acc8..e17d928 100644 Binary files a/graphics/laplace.pdf and b/graphics/laplace.pdf differ