matplotlib/pyplot not plotting data from specific .txt file
<p>I have data saved via numpy's savetxt function and am extracting it to plot. When I plot it the script executes without errors but does not show the curves--only empty windows. This is strange because:</p>

<ol>
<li><p>The same script makes a fine plot when I import .txt data from another file (also saved using savetxt).</p></li>
<li><p>If I create data points inside the script, e.g. with arange, it plots. </p></li>
<li><p>The .txt data <em>is</em> getting loaded--I have printed it to the screen.</p></li>
<li><p>I checked my backend and it is TkAgg, which the internet agrees it's supposed to be.  </p></li>
</ol>

<p>My code is</p>

<pre><code> # this script makes the plots of the eigenvalue distributions for the AAS 17-225 paper

# import python modules
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator

# set plot options 
mpl.rcParams['xtick.major.size'] = 7
mpl.rcParams['xtick.major.width'] = 3.0
mpl.rcParams['ytick.major.size'] = 7
mpl.rcParams['ytick.major.width'] = 3.0
mpl.rcParams['axes.linewidth'] = 3.5

plt.rc('text',usetex=True)
mpl.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
plt.rc('font',family='serif')
plt.rc('axes',labelsize=24)
plt.rc('xtick',labelsize=24)
plt.rc('ytick',labelsize=24)
plt.rc('font',weight='bold')
plt.rc('axes',titlesize=20)

# plot method arguments
lw = 2 # linewidth
left_adj = 0.055 # left adjustment 
right_adj = 0.985 # left adjustment 
top_adj = 0.975 # left adjustment 
bottom_adj = 0.075 # left adjustment 
wspace = 0.205 # horizontal space between plots
hspace = 0.2 # verticle space between plots
n_suplot_rows = 2 # number of subplot rows
n_suplot_columns = 3 # number of subplot columns

# load data
dataDir ='/mnt/E0BA55A7BA557B4C/research/independent/recursivequats/paperCode/'
df1 = dataDir+'lamda_0p1_0p1.txt'
df2 = dataDir+'lamda_0.1_0.5.txt'
df3 = dataDir+'lamda_0.1_1.0.txt'
df4 = dataDir+'lamda_0.5_0.5.txt'
df5 = dataDir+'lamda_0.5_1.0.txt'
df6 = dataDir+'lamda_1.0_1.0.txt'

profile1 = np.loadtxt(df1)
profile2 = np.loadtxt(df2)
profile3 = np.loadtxt(df3)
profile4 = np.loadtxt(df4)
profile5 = np.loadtxt(df5)
profile6 = np.loadtxt(df6)

fig = plt.figure()

ax1 = fig.add_subplot(n_suplot_rows,n_suplot_columns,1)
p1, = ax1.plot(profile1[:,1],profile1[:,0],linewidth=lw)

ax2 = fig.add_subplot(n_suplot_rows,n_suplot_columns,2)
p1, = ax2.plot(profile2[:,1],profile2[:,0],linewidth=lw)

ax3 = fig.add_subplot(n_suplot_rows,n_suplot_columns,3)
p1, = ax3.plot(profile3[:,1],profile3[:,0],linewidth=lw)

ax4 = fig.add_subplot(n_suplot_rows,n_suplot_columns,4)
p1, = ax4.plot(profile4[:,1],profile4[:,0],linewidth=lw)

ax5 = fig.add_subplot(n_suplot_rows,n_suplot_columns,5)
p1, = ax5.plot(profile5[:,1],profile5[:,0],linewidth=lw)

ax6 = fig.add_subplot(n_suplot_rows,n_suplot_columns,6)
p1, = ax5.plot(profile6[:,1],profile6[:,0],linewidth=lw)


plt.subplots_adjust(left=left_adj,right=right_adj,top=top_adj,bottom=bottom_adj,wspace=wspace,hspace=hspace)
plt.show()
</code></pre>

<p>well, a bit more digging and the problem has been identified. The script <em>is</em> plotting, but the zoom on the plots is so poor that they are obscured by the thick lines on the border. So the problem was a user error. </p>

<p>This is why engineers shouldn't try to be artists... </p>

python numpy matplotlib plot