In [1]:
import os
import sys
sys.path.insert(0, os.path.abspath('../'))

import numpy as np
from matplotlib import pyplot as plt

from dg_maxwell import utils

plt.rcParams['figure.figsize']     = 12, 7.5
plt.rcParams['lines.linewidth']    = 1.5
plt.rcParams['font.family']        = 'serif'
plt.rcParams['font.weight']        = 'bold'
plt.rcParams['font.size']          = 20  
plt.rcParams['font.sans-serif']    = 'serif'
plt.rcParams['text.usetex']        = True
plt.rcParams['axes.linewidth']     = 1.5
plt.rcParams['axes.titlesize']     = 'medium'
plt.rcParams['axes.labelsize']     = 'medium'

plt.rcParams['xtick.major.size']   = 8
plt.rcParams['xtick.minor.size']   = 4
plt.rcParams['xtick.major.pad']    = 8
plt.rcParams['xtick.minor.pad']    = 8
plt.rcParams['xtick.color']        = 'k'
plt.rcParams['xtick.labelsize']    = 'medium'
plt.rcParams['xtick.direction']    = 'in'    

plt.rcParams['ytick.major.size']   = 8
plt.rcParams['ytick.minor.size']   = 4
plt.rcParams['ytick.major.pad']    = 8
plt.rcParams['ytick.minor.pad']    = 8
plt.rcParams['ytick.color']        = 'k'
plt.rcParams['ytick.labelsize']    = 'medium'
plt.rcParams['ytick.direction']    = 'in'
plt.rcParams['text.usetex']        = True
plt.rcParams['text.latex.unicode'] = True

In [2]:
# In this example, we will use plot_line function
# to plot a parabola, y^2 = x

# Create the parabola
y = np.linspace(-1, 1, 8)
x = y**2

# Store the points in the format desired by the plot_line
# function. First column of the points variable stores
# x coordinates and second column stores the y coordinates.
points = np.zeros([x.size, 2])

points[:, 0] = x
points[:, 1] = y

In [3]:
axes_handler = plt.axes()

utils.plot_line(points, axes_handler)

plt.title(r'Plot of $y^2 = x$ done by joining the points $(x_i, y_i)$ with lines.')
plt.xlabel(r'$x$')
plt.ylabel(r'$y$')

plt.ylim(-1.1, 1.1)
plt.xlim(0, 1.1)

# Showing the points which are joined, using pyplot
plt.plot(x, y, 'o', color = 'red')

plt.show()



In [ ]: