def cplsvfig(LLS,NNS,X,projval,x_label,y_label,z_label,Title_fnc,save_fnc):
    surf=ax.plot_surface(1e9*LS,NS,X,rstride=1,cstride=1,alpha=0.7,cmap=cm.bone,linewidth = 0.05, antialiased = True, shade = False)
    CS = contour(1e9*LLS,NNS,X, colors = 'k', linewidth = 0.5)
    cbar = pl.colorbar(surf)
    #cbar.ax.set_ylabel(r'$\mathcal{A}^{(0)}_{[9,3]}\,\,\,[zJ]$', size = 14)
    cbar.add_lines(CS)
    cset = ax.contour(1e9*LLS,NNS,X,zdir='z',offset = projval ,cmap = cm.Blues)
    return 0
def plsvfig(LLS,NNS,X,projval,x_label,y_label,z_label,Title_fnc,save_fnc):
    fig = pl.figure()
    ax = fig.gca(projection = '3d')
    surf=ax.plot_surface(1e9*LS,NS,X,rstride=1,cstride=1,alpha=0.7,cmap=cm.winter,linewidth = 0.05, antialiased = True, shade = False)
    CS = contour(1e9*LLS,NNS,X, colors = 'k', linewidth = 0.5)
    cbar = pl.colorbar(surf)
    #cbar.ax.set_ylabel(r'$\mathcal{A}^{(0)}_{[9,3]}\,\,\,[zJ]$', size = 14)
    cbar.add_lines(CS)
    cset = ax.contour(1e9*LLS,NNS,X,zdir='z',offset = projval ,cmap = cm.Blues)
    ax.set_xlabel(x_label)
    ax.set_ylabel(y_label)
    ax.set_zlabel(z_label)
    pl.title(Title_fnc)
    #pl.title(r'$\rm{Gradient\, \mathcal{A}^{(0)}\, for \,[9,3]\, in\,water}$',size = 21)
    ax.view_init(elev = 17, azim = 150)
    savefig(save_fnc)#'plots/grad_A0_93_0.png')#, dpi = 300)
    #pl.show()
    return 0
pl.clabel(CS, inline =1,fmt = '%1.5f', fontsize = 18,color = 'k')#, manual = man_loc)
pl.xlabel(r'$Angle\,\,\mathrm{[radians]}$', size = 20)
pl.ylabel(r'$Separation\,\,\mathrm{[m]}$', size = 20)
pl.title(r'$\mathrm{-Log(G),\,retarded,\,skewed\,cyls\,in\,water}$', size = 20)#uas a function of separation and angle')
cbar = pl.colorbar(CS, shrink = 0.8, extend = 'both')
cbar.ax.set_ylabel(r'$-Log(G(\mathcal{\ell},\theta))\,\,[k_{B}T]$', size = 14)
cbar.add_lines(CS)
##pl.axis([0,1.0,0,1.0])
#pl.grid()
pl.savefig('plots/skew_ret_water/logG_contour.pdf')
show()

fig = pl.figure()
ax = fig.gca(projection = '3d')
#ax.text(-7, 6, 0.7, r'$\zeta/\omega_{0}$', zdir = (-1,1,-3), size = 21)
surf = ax.plot_surface(X,Y, G_l_t_dt, rstride = 1, cstride = 1,alpha = 0.2, linewidth = 0.3)#edgecolor = 'none',antialiased = True, shade = False, norm = norm, linewidth = 0.3)
#surf = ax.plot_surface(X,Y, G_l_t_dt, rstride = 20, cstride = 20,alpha = 0.2)#, cmap = cm.gnuplot, linewidth = 0.5)#gray)#coolwarm)#bone)#hot, linewidth = 0.01, antialiased = True, shade = False)# True)#, cmap = hot()
#colorbar(surf)
#cbar.ax.set_ylabel(r'$\frac{\xi}{\omega_{0}}$', size = 24)
#cset = ax.contour(X,Y,h, zdir = 'z', offset = 0, cmap = cm.jet)
#cset = ax.contour(X,Y,h, zdir = 'x', offset = 5, cmap = cm.jet)
#cset = ax.contourf(X,Y,h, zdir = 'y', offset = 6, cmap = cm.jet)# puts plot of max xi vs discrete r values at r=0 plane
#ax.view_init(elev = 19, azim = -112)
#zlabel(r'$\xi/\omega_{0}$', size = 21)
#ylabel(r'$r$', size = 24)
#xlabel(r'$(\epsilon(0) -1)$', size = 24)
#text = Axes.text(self, x, y, s, **kwargs)
#art3d.text_2d_to_3d(text, z, zdir)
#return text
#pl.text(6,0, 0, r'$\xi/\omega_{0}$',size = 21 ,rotation = 'horizontal')
#ax.text(r'$\xi/\omega_{0}$',6,0, 0, size = 21 ,rotation = 'horizontal')
cplsvfig(LS,NS,X_65, proj_val(X_65[:, 25] ), x_labels,y_labels,z_labels,title('6','5'), svfig('65'))
cplsvfig(LS,NS,X_91, proj_val(X_91[:, 25] ), x_labels,y_labels,z_labels,title('9','1'), svfig('91'))
cplsvfig(LS,NS,X_93, proj_val(X_93[:, 25] ), x_labels,y_labels,z_labels,title('9','3'), svfig('93'))
cplsvfig(LS,NS,X_290,proj_val(X_290[:,25]),x_labels,y_labels,z_labels,title('29','0'),svfig('290'))
#ax.set_xlabel(x_label)
#ax.set_ylabel(y_label)
#ax.set_zlabel(z_label)
#pl.title(Title_fnc)
##pl.title(r'$\rm{Gradient\, \mathcal{A}^{(0)}\, for \,[9,3]\, in\,water}$',size = 21)
ax.view_init(elev = 17, azim = 150)
savefig('plots/combo_contour.png')#'plots/grad_A0_93_0.png')#, dpi = 300)
#pl.show()

fig = pl.figure()
ax = fig.gca(projection = '3d')
surf=ax.plot_surface(1e9*LS,NS,X_65,rstride=1,cstride=1, alpha=0.5,cmap=cm.Blues,linewidth = 0.05, antialiased = True, shade = False)
surf=ax.plot_surface(1e9*LS,NS,X_91,rstride=1,cstride=1, alpha=0.5,cmap=cm.Greens,linewidth = 0.05, antialiased = True, shade = False)
surf=ax.plot_surface(1e9*LS,NS,X_93,rstride=1,cstride=1, alpha=0.5,cmap=cm.Reds,linewidth = 0.05, antialiased = True, shade = False)
surf=ax.plot_surface(1e9*LS,NS,X_290,rstride=1,cstride=1,alpha=0.5,cmap=cm.hot,linewidth = 0.05, antialiased = True, shade = False)
#cbar.ax.set_ylabel(r'$\mathcal{A}^{(0)}_{[9,3]}\,\,\,[zJ]$', size = 14)
#pl.title(r'$\rm{Gradient\, \mathcal{A}^{(0)}\, for \,[9,3]\, in\,water}$',size = 21)
ax.view_init(elev = 17, azim = 150)
#fig = pl.figure()
#ax = fig.gca(projection = '3d')
#surf=ax.plot_surface(1e9*LS,NS,X,rstride=1,cstride=1,alpha=0.7,cmap=cm.winter,linewidth = 0.05, antialiased = True, shade = False)
#CS = contour(1e9*LS,NS,X, colors = 'k', linewidth = 0.5)
#cbar = pl.colorbar(surf)
#cbar.ax.set_ylabel(r'$\mathcal{A}^{(0)}_{[9,3]}\,\,\,[zJ]$', size = 14)
#cbar.add_lines(CS)
#cset = ax.contour(1e9*LS,NS,X,zdir='z',offset = -0.25,cmap = cm.Blues)
ax.set_xlabel(r'$\rm{separation}\,\,\,\ell\,\,[nm]$',   size = 18)
A0_065_theta = A0_065 * np.cos(0.*Y) 
A0_091_theta = A0_091 * np.cos(0.*Y) 
A0_290_theta = A0_290 * np.cos(0.*Y) 

A2_065_theta = A2_065 * np.cos(2.*Y) 
A2_091_theta = A2_091 * np.cos(2.*Y) 
A2_290_theta = A2_290 * np.cos(2.*Y) 

##### A_2 PLOT S######
fig = figure()
#subplot(111, axisbg='darkslategray')
ax = fig.gca(projection = '3d')
#ax = fig.gca(projection = '3d', axisbg='darkslategray')

surf_065_0 = ax.plot_surface(1e9*X,Y,1e21*A0_065_theta, rstride = 5, 
        cstride =5,alpha=0.7,cmap=cm.Blues, linewidth = 0.05, antialiased = True, shade = False)# True)#, cmap = hot()
surf_091_0 = ax.plot_surface(1e9*X,Y,1e21*A0_091_theta, rstride = 5, 
        cstride =5,alpha=0.7,cmap=cm.Greens, linewidth = 0.05, antialiased = True, shade = False)# True)#, cmap = hot()
surf_290_0 = ax.plot_surface(1e9*X,Y,1e21*A0_290_theta, rstride = 5, 
        cstride =5,alpha=0.7,cmap=cm.Reds, linewidth = 0.05, antialiased = True, shade = False)# True)#, cmap = hot()

CS_065_0 = contour(1e9*X,Y,1e21*A0_065_theta, colors = 'k', linewidth = 1.5)
CS_091_0 = contour(1e9*X,Y,1e21*A0_091_theta, colors = 'k', linewidth = 1.5)
CS_290_0 = contour(1e9*X,Y,1e21*A0_290_theta, colors = 'k', linewidth = 1.5)

cbar_065_0 = pl.colorbar(surf_065_0)
cbar_065_0.ax.set_ylabel(r'$\mathcal{A}^{(0)}_{[6,5]}\,\,\,[zJ]$', size = 14)
cbar_065_0.add_lines(CS_065_0)

cbar_091_0 = pl.colorbar(surf_091_0)
cbar_091_0.ax.set_ylabel(r'$\mathcal{A}^{(0)}_{[9,1]}\,\,\,[zJ]$', size = 14)
import matplotlib.pyplot as plt

c = loadtxt('output/130807_3D_A_dep.txt', unpack=True, usecols = [0])
C = (numpy.pi/2)*c
r = loadtxt('output/130807_3D_A_rho.txt', unpack=True, usecols = [0])
h = loadtxt('output/130807_3D_height.txt')#, unpack=True, usecols = [0,1])

X,Y=meshgrid(C,r)
h = numpy.nan_to_num(h)

fig = figure()
ax = fig.gca(projection = '3d')
ax.text(-7, 6, 0.7, r'$\zeta/\omega_{0}$', zdir = (-1,1,-3), size = 21)
figure()
#contourf(X,Y,h, 1000, cmap = hot())
surf = ax.plot_surface(X,Y,h, rstride = 20, cstride = 20,alpha = 0.2, cmap = cm.gnuplot, linewidth = 0.5)#gray)#coolwarm)#bone)#hot, linewidth = 0.01, antialiased = True, shade = False)# True)#, cmap = hot()
#surf = ax.plot_wireframe(X,Y,h, rstride = 20, cstride = 20,color = 'k')#True)# cmap = hot, shade = True)#,alpha = 0.9, cmap = cm.hot, linewidth = 0.01, antialiased = True, shade = False)# True)#, cmap = hot()
#colorbar(surf)
#cbar.ax.set_ylabel(r'$\frac{\xi}{\omega_{0}}$', size = 24)
#cset = ax.contour(X,Y,h, zdir = 'z', offset = 0, cmap = cm.jet)
#cset = ax.contour(X,Y,h, zdir = 'x', offset = 5, cmap = cm.jet)
#cset = ax.contourf(X,Y,h, zdir = 'y', offset = 6, cmap = cm.jet)# puts plot of max xi vs discrete r values at r=0 plane
#CS = contour(X,Y,h)#, colors = 'k')
#man_loc = [(1,1),(2,2),(3,3),(4,4)]
#clabel(CS, inline =1,fmt = '%1.1f', fontsize = 18,color = 'k', manual = man_loc)
#ax.grid(on = True)
ax.view_init(elev = 19, azim = -112)
#zlabel(r'$\xi/\omega_{0}$', size = 21)
#ylabel(r'$r$', size = 24)
#xlabel(r'$(\epsilon(0) -1)$', size = 24)
#text = Axes.text(self, x, y, s, **kwargs)
        #A0[A0>1e6]= np.nan #NOTE: remove me later
        #A2[A2>1e6]= np.nan #NOTE: remove me later
    #A0[i,0] = 0.#(1./2) * delta[0]*delta[0]*Ft0_term0
    #A2[i,0] = 0.#(1./2) * delta[0]*delta[0]*Ft2_term0
NS,LS = np.meshgrid(ns,Ls)
from pylab import *
from matplotlib import axis as ax
from matplotlib.ticker import MultipleLocator#, FormatStrFormatter
from mpl_toolkits.mplot3d import Axes3D

fig = pl.figure()
ax = fig.gca(projection = '3d')
#ax.text(-7, 6, 0.7, r'$\zeta/\omega_{0}$', zdir = (-1,1,-3), size = 21)
#pl.figure()
#contourf(X,Y,h, 1000, cmap = hot())
surf=ax.plot_surface(1e9*LS,NS,np.log(1e21*A0),rstride=1,cstride=1,alpha=0.7,cmap=cm.winter,linewidth = 0.05, antialiased = True, shade = False)
CS = contour(1e9*LS,NS,np.log(1e21*A0), colors = 'k', linewidth = 0.5)
pl.show()
X,Y = gradient(A0)
fig = pl.figure()
ax = fig.gca(projection = '3d')
#ax.text(-7, 6, 0.7, r'$\zeta/\omega_{0}$', zdir = (-1,1,-3), size = 21)
#pl.figure()
#contourf(X,Y,h, 1000, cmap = hot())
surf=ax.plot_surface(1e9*LS,NS,X,rstride=1,cstride=1,alpha=0.7,cmap=cm.winter,linewidth = 0.05, antialiased = True, shade = False)
CS = contour(1e9*LS,NS,X, colors = 'k', linewidth = 0.5)
pl.show()

fig = pl.figure()
ax = fig.gca(projection = '3d')
#ax.text(-7, 6, 0.7, r'$\zeta/\omega_{0}$', zdir = (-1,1,-3), size = 21)
import matplotlib.pyplot as plt

c = loadtxt('output/130807_3D_A_dep.txt', unpack=True, usecols = [0])
C = (numpy.pi/2)*c
r = loadtxt('output/130807_3D_A_rho.txt', unpack=True, usecols = [0])
h = loadtxt('output/130807_3D_height.txt')#, unpack=True, usecols = [0,1])

X,Y=meshgrid(C,r)
h = numpy.nan_to_num(h)

fig = figure()
ax = fig.gca(projection = '3d')
ax.text(-7, 6, 0.7, r'$\zeta/\omega_{0}$', zdir = (-1,1,-3), size = 21)
#figure()
#contourf(X,Y,h, 1000, cmap = hot())
surf = ax.plot_surface(X,Y,h, rstride = 1, cstride = 1,alpha = 0.9, cmap = cm.hot, linewidth = 0.01, antialiased = True, shade = False)# True)#, cmap = hot()
colorbar(surf)
#cbar.ax.set_ylabel(r'$\frac{\xi}{\omega_{0}}$', size = 24)
##cset = ax.contour(X,Y,h, zdir = 'z', offset = 0, cmap = cm.jet)
#cset = ax.contour(X,Y,h, zdir = 'x', offset = 20, cmap = cm.jet)
##cset = ax.contour(X,Y,h, zdir = 'y', offset = 0, cmap = cm.jet)# puts plot of max xi vs discrete r values at r=0 plane
#CS = contour(X,Y,h, colors = 'k')
#man_loc = [(1,1),(2,2),(3,3),(4,4)]
#clabel(CS, inline =1,fmt = '%1.1f', fontsize = 18,color = 'k', manual = man_loc)
#ax.grid(on = True)
ax.view_init(elev = 34, azim = -135)
#zlabel(r'$\xi/\omega_{0}$', size = 21)
#ylabel(r'$r$', size = 24)
#xlabel(r'$(\epsilon(0) -1)$', size = 24)
#text = Axes.text(self, x, y, s, **kwargs)
#art3d.text_2d_to_3d(text, z, zdir)