<jupyter_start><jupyter_text>Distribution in fitted maximum velocity difference<jupyter_code>plt.rc('font', size=16)
lwidth = 2 # Line width used in plots

###########################################################################
# Hard-coded entry for the bins for the histrogram plots at the end of this
#    function.
#--------------------------------------------------------------------------
hist_range = ( -300, 300)
BINS = np.linspace( hist_range[0], hist_range[1], 50)
###########################################################################


###########################################################################
# Plot the v_max_diff distribution and separate the distributions into
#    walls, voids, and other.
#--------------------------------------------------------------------------
#v_max_diff_hist = plt.figure()
plt.figure(figsize=(7,5))
plt.title('$\Delta v_{max}$ distribution')

plt.hist( v_max_diff_other, BINS, color='g', density=True, histtype='step', 
         linewidth=lwidth, linestyle='--', label='Other')
# p = norm.pdf(x, v_max_other_mean, v_max_other_stdev)
# plt.plot(x, p, 'g--', linewidth=2)
# plt.axvline( v_max_other_mean, color='green', linestyle='-', linewidth=1.5)
# plt.axvline( v_max_other_mean + v_max_other_stdev,
#             color='green', linestyle=':', linewidth=1)
# plt.axvline( v_max_other_mean - v_max_other_stdev,
#             color='green', linestyle=':', linewidth=1)
# plt.axvline( v_max_other_mean + 2*v_max_other_stdev,
#             color='green', linestyle=':', linewidth=1)
# plt.axvline( v_max_other_mean - 2*v_max_other_stdev,
#             color='green', linestyle=':', linewidth=1)
# _, mean_v_max_other_ = plt.ylim()
# plt.text(v_max_other_mean + v_max_other_mean/10,
#      mean_v_max_other_ - mean_v_max_other_/10,
#      'Mean: {:.2f}'.format( v_max_other_mean))

plt.hist( v_max_diff_void, BINS, color='r', density=True, histtype='step',
         linewidth=lwidth, label='Void')
# p = norm.pdf(x, v_max_void_mean, v_max_void_stdev)
# plt.plot(x, p, 'r--', linewidth=2)
# plt.axvline( v_max_void_mean, color='red', linestyle='-', linewidth=1.5)
# plt.axvline( v_max_void_mean + v_max_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline( v_max_void_mean - v_max_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline( v_max_void_mean + 2*v_max_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline( v_max_void_mean - 2*v_max_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# _, mean_void_v_max_ = plt.ylim()
# plt.text(v_max_void_mean + v_max_void_mean/10,
#      mean_void_v_max_ - mean_void_v_max_/10,
#      'Mean: {:.2f}'.format( v_max_void_mean))

plt.hist( v_max_diff_wall, BINS, color='k', density=True, histtype='step', 
         linewidth=lwidth, linestyle=':', label='Wall')
# p = norm.pdf(x, v_max_wall_mean, v_max_wall_stdev)
# plt.plot(x, p, 'k--', linewidth=2)
# plt.axvline( v_max_wall_mean, color='black', linestyle='-', linewidth=1.5)
# plt.axvline( v_max_wall_mean + v_max_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline( v_max_wall_mean - v_max_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline( v_max_wall_mean + 2*v_max_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline( v_max_wall_mean - 2*v_max_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# _, mean_wall_v_max_ = plt.ylim()
# plt.text(v_max_wall_mean + v_max_wall_mean/10,
#      mean_wall_v_max_ - mean_wall_v_max_/10,
#      'Mean: {:.2f}'.format( v_max_wall_mean))


#ax = v_max_diff_hist.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('Galaxy fraction')
plt.xlabel('$\Delta v_{max}$ [km/s]')
plt.legend()

# textstr = '\n'.join((
#       r'$STDEV_{wall}$: $%.2f$' % ( v_max_wall_stdev, ),
#       r'$STDEV_{void}$: $%.2f$' % ( v_max_void_stdev, ),
#       r'STDEV: $%.2f$' % ( v_max_other_stdev, ),
#       r'$RMS_{wall}$: $%.2f$' % ( v_max_wall_rms, ),
#       r'$RMS_{void}$: $%.2f$' % ( v_max_void_rms, ),
#       r'RMS: $%.2f$' % ( v_max_other_rms, )))

# props = dict( boxstyle='round', facecolor='cornsilk', alpha=0.6)

# ax.text(0.72, 0.95, textstr,
#         verticalalignment='top', horizontalalignment='left',
#         transform=ax.transAxes,
#         color='black', fontsize=8, bbox=props)
'''
plt.savefig( IMAGE_DIR + '/histograms/v_max_diff_hist.' + IMAGE_FORMAT,
            format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output><jupyter_text>Scatter of fitted maximum velocity v. galaxy inclination angle<jupyter_code>###########################################################################
# Plot the difference in the fitted v_max parameters from the positive and
#    negative rotation curves against the inclination angle of the galaxy
#    to see if there is any correlation.
#
# NOTE: Distributions are separated by wall, void, if the galaxy is cut off
#       by the edge of the footprint, or if the galaxy is not found within
#       the footprint.
#--------------------------------------------------------------------------
#v_max_diff_vs_inclination_fig = plt.figure()
plt.figure(figsize=(7,5))
plt.title('$\Delta v_{max}$ vs. Inclination angle')

# plot points with errorbars
# plt.errorbar( inclin_angle_wall, np.abs( v_max_diff_wall),
#              yerr=v_max_diff_wall_error, fmt='kv', ecolor='black')
# plt.errorbar( inclin_angle_void, np.abs( v_max_diff_void),
#              yerr=v_max_diff_void_error, fmt='ro', ecolor='red')
# plt.errorbar( inclin_angle_other, np.abs( v_max_diff_other),
#              yerr=v_max_diff_other_error,
#              fmt='go', ecolor='green', fillstyle='none')
#plt.errorbar( inclination_angle, np.abs( v_max_difference),
#             yerr=v_max_difference_error , fmt='ko', ecolor='gray')


# plot points without errorbars
plt.plot( inclin_angle_other, np.abs( v_max_diff_other), 'go', markersize=3, fillstyle='none', label='Other')
plt.plot( inclin_angle_wall, np.abs( v_max_diff_wall), 'kv', markersize=3, label='Wall')
plt.plot( inclin_angle_void, np.abs( v_max_diff_void), 'ro', markersize=3, label='Void')
#plt.plot( inclination_angle, v_max_difference, 'ko')

#ax = v_max_diff_vs_inclination_fig.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('$\Delta v_{max}$ [km/s]')
plt.ylim( ( 0, 2000))
plt.xlabel('$i$ [deg]')
plt.legend()
'''
plt.savefig( IMAGE_DIR + '/v_max_vs_inclination.' + IMAGE_FORMAT,
             format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output><jupyter_text>Scatter of fitted maximum velocity vs. ratio of dark matter halo mass to stellar mass<jupyter_code>###########################################################################
# Plot the difference in the fitted v_max parameters from the positive and
#    negative rotation curves against the stellar mass to dark matter mass
#    ratio to see if there is any correlation.
#
# NOTE: Distributions are separated by wall, void, if the galaxy is cut off
#       by the edge of the footprint, or if the galaxy is not found within
#       the footprint.
#--------------------------------------------------------------------------
#v_max_diff_vs_mass_ratio_fig = plt.figure()
plt.figure(figsize=(7,5))
plt.title("$\Delta v_{max}$ vs. $M_{DM}/M_*$")

# plot points with errorbars
# plt.errorbar( mass_ratio_wall, np.abs( v_max_diff_wall),
#              xerr=mass_ratio_wall_error, yerr=v_max_diff_wall_error,
#              fmt='kv', ecolor='black')
# plt.errorbar( mass_ratio_void, np.abs( v_max_diff_void),
#              xerr=mass_ratio_void_error, yerr=v_max_diff_void_error,
#              fmt='ro', ecolor='red')
# plt.errorbar( mass_ratio_other, np.abs( v_max_diff_other),
#              xerr=mass_ratio_other_error, yerr=v_max_diff_other_error,
#              fmt='go', ecolor='green', fillstyle='none')
#plt.errorbar( mass_ratio, np.abs( v_max_difference),
#             xerr=mass_ratio_error, yerr=v_max_difference_error,
#             fmt='ko', ecolor='gray')


# plot points without errorbars
plt.plot( mass_ratio_other, np.abs(v_max_diff_other), 'go', markersize=3, fillstyle='none', label='Other')
plt.plot( mass_ratio_wall, np.abs(v_max_diff_wall), 'kv', markersize=3, label='Wall')
plt.plot( mass_ratio_void, np.abs(v_max_diff_void), 'ro', markersize=3, label='Void')
#plt.plot( mass_ratio, np.abs(v_max_difference), 'ko', markersize=2)

#ax = v_max_diff_vs_mass_ratio_fig.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('$\Delta v_{max}$ [km/s]')
plt.xlabel('$M_{DM}/M_*$')
plt.ylim( (0, 4000))
plt.xlim( (0, 1000))
plt.legend()
'''
plt.savefig( IMAGE_DIR + '/v_max_vs_mass_ratio.' + IMAGE_FORMAT,
            format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output><jupyter_text>Scatter of Chi Square versus difference in fitted maximum velocity<jupyter_code>###########################################################################
# Plot the difference in the fitted v_max parameters from the positive and
#    negative rotation curves against the Chi Square to see if there is any 
#    correlation.
#
# NOTE: Distributions are separated by wall, void, if the galaxy is cut off
#       by the edge of the footprint, or if the galaxy is not found within
#       the footprint.
#--------------------------------------------------------------------------
#v_max_diff_vs_mass_ratio_fig = plt.figure()
plt.figure(figsize=(7,5))
plt.title("$\Delta v_{max}$ vs. $\chi^2$")

# plot points with errorbars
# plt.errorbar( mass_ratio_wall, np.abs( v_max_diff_wall),
#              xerr=mass_ratio_wall_error, yerr=v_max_diff_wall_error,
#              fmt='kv', ecolor='black')
# plt.errorbar( mass_ratio_void, np.abs( v_max_diff_void),
#              xerr=mass_ratio_void_error, yerr=v_max_diff_void_error,
#              fmt='ro', ecolor='red')
# plt.errorbar( mass_ratio_other, np.abs( v_max_diff_other),
#              xerr=mass_ratio_other_error, yerr=v_max_diff_other_error,
#              fmt='go', ecolor='green', fillstyle='none')
#plt.errorbar( mass_ratio, np.abs( v_max_difference),
#             xerr=mass_ratio_error, yerr=v_max_difference_error,
#             fmt='ko', ecolor='gray')


# plot points without errorbars
plt.loglog( chi2_other, v_max_diff_other, 'go', markersize=3, fillstyle='none', label='Other')
plt.loglog( chi2_wall, v_max_diff_wall, 'kv', markersize=3, label='Wall')
plt.loglog( chi2_void, v_max_diff_void, 'ro', markersize=3, label='Void')
#plt.plot( mass_ratio, chi2_list, 'ko', markersize=2)

#ax = v_max_diff_vs_mass_ratio_fig.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('$\Delta v_{max}$ [km/s]')
plt.xlabel('$\chi^2$')
#plt.ylim( (0, 4000))
#plt.xlim( (0, 1000))
plt.legend()
'''
plt.savefig( IMAGE_DIR + '/v_max_vs_mass_ratio.' + IMAGE_FORMAT,
            format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output>