Skip to content
Snippets Groups Projects
Commit 7a8892b0 authored by Jacob Beyer's avatar Jacob Beyer
Browse files

Made a suggestion for the ribbon plot

parent 457cf164
No related branches found
No related tags found
No related merge requests found
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
import numpy as np
import os
import sys
import matplotlib.pyplot as plt
import matplotlib
import numpy.ma as ma
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import colors
import header
import triangular
matplotlib.rc('font', **{'family': 'serif', 'serif': ['Computer Modern Roman'],
'size': 8})
matplotlib.rc('text', usetex=True)
matplotlib.rc('text.latex', preamble=r'\usepackage{amsmath}'
+ r'\usepackage{braket}' + r'\usepackage{amssymb}'
+ r'\newcommand{\bvec}[1]{\boldsymbol{#1}}')
fig_width = 3.4039
fig_height = fig_width
fig, axs = plt.subplots(4, 1, figsize=(fig_width, fig_height), sharex=True,
gridspec_kw={'hspace': 0.05})
# TODO make this a list of four directories with data to be used
data_dirs = ['./data_for_jacob/ribbon/'] * 4
for ii, ddir in enumerate(data_dirs):
kpts = np.load(ddir + 'k_points.npy')
left = np.load(ddir + 'left.npy')
right = np.load(ddir + 'right.npy')
energy = np.load(ddir + 'ribbon_energies.npy')
bulk = np.logical_and(np.logical_not(right), np.logical_not(left))
kpts_bulk = ma.masked_array(kpts, np.logical_not(bulk))
energy_bulk = ma.masked_array(energy, np.logical_not(bulk))
kpts_left = ma.masked_array(kpts, np.logical_not(left))
energy_left = ma.masked_array(energy, np.logical_not(left))
kpts_right = ma.masked_array(kpts, np.logical_not(right))
energy_right = ma.masked_array(energy, np.logical_not(right))
# Plot parameters fixed here
axs[ii].plot(kpts_bulk, energy_bulk, c=colors.gray,
linestyle='-', linewidth=0.1)
axs[ii].plot(kpts_left, energy_left, c=colors.first,
marker='.', markersize=0.1)
axs[ii].plot(kpts_right, energy_right, c=colors.third,
marker='.', markersize=0.1)
gap_lower_edge = np.min([np.min(energy_left), np.min(energy_right)])
gap_upper_edge = np.max([np.max(energy_left), np.max(energy_right)])
# Fix y axes
axs[ii].tick_params(left=False, labelleft=False, bottom=False,
labelbottom=False)
axs[ii].set_ylabel(r'$E$')
# Fixing the ylim relative to the gap boundaries
lim_factor = 1.5
axs[ii].set_ylim([lim_factor * gap_lower_edge,
lim_factor * gap_upper_edge])
axs[ii].set_xlim([-np.pi, np.pi])
# Fix x axis
axs[3].tick_params(bottom=True, labelbottom=True)
axs[3].set_xticks([-np.pi, -0.5 * np.pi, 0, 0.5 * np.pi, np.pi],
labels=[r'$-\pi$', r'$-\frac{\pi} 2$', r'$0$',
r'$\frac{\pi} 2$', r'$\pi$'])
axs[3].set_xlabel(r'$k/a$')
fig.savefig('ribbons.pdf', bbox_inches="tight")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment