Skip to content

Instantly share code, notes, and snippets.

@ryutaroasano
Created November 24, 2016 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryutaroasano/1c1992b551cd808f2bfb474fc5c10b23 to your computer and use it in GitHub Desktop.
Save ryutaroasano/1c1992b551cd808f2bfb474fc5c10b23 to your computer and use it in GitHub Desktop.
# coding:utf-8
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ptick
from whiteblack import setFigLinesBW,setAxLinesBW
from cycler import cycler
plt.rcParams['font.size'] = 24
plt.rcParams['text.usetex'] = True
data1 = np.loadtxt('rhov1.d')
x1=data1[:,0]
y1=data1[:,1]
y2=data1[:,2]
y3=data1[:,3]
x = np.arange(0.002,500,0.1)
y = x * 0.0
lst1 = ["cc","cd","dd"]
lst2 = ["0.01","0.1","10","100"]
lst3 = ["p","rho","t","rhov1"]
lst4 = ["0.01","0.1","1","10","100"]
def setting():
fig = plt.figure(figsize=(9,6))
ax = fig.add_subplot(1,1,1)
plt.tick_params(labelsize=28)
plt.tick_params(pad=14)
plt.clf()
setting()
fig = plt.figure(figsize=(9,6))
ax = fig.add_subplot(1,1,1)
ax.yaxis.offsetText.set_fontsize(12)
ax.ticklabel_format(style='sci',axis='y',scilimits=(0,0))
plt.xscale("log")
plt.xlabel("$k_{m \\rm II} $",fontsize=32)
plt.ylabel("$\\rho v_1$",fontsize=32)
plt.scatter(x1,y1,s=50,marker="o",facecolor='w',label='Case1')
plt.scatter(x1,y2,s=50,marker="^",facecolor='w',label='Case2')
plt.scatter(x1,y3,s=50,marker="s",facecolor='w',label='Case3')
plt.plot(x,y,color='k',ls=':')
plt.subplots_adjust(left=0.2,right=0.8,bottom=0.2)
plt.legend(bbox_to_anchor=(1.03, 1), loc='upper left',fontsize=14)
plt.savefig("rhov1_km.pdf")
for media in lst1 :
for quant in lst3 :
plt.clf()
fig = plt.figure(figsize=(9,6))
ax = fig.add_subplot(1,1,1)
plt.tick_params(labelsize=28)
plt.tick_params(pad=14)
ax.set_prop_cycle(cycler('color','kkkkkkkkkk') +
cycler('linestyle',['-','--',':','-.','-','--',':','-.','-','--']) +
cycler('marker',[None,None,None,None,'x','x','x','x','o','o']))
filename = quant + "_result.d"
outname = media + quant + ".pdf"
if quant == "p" :
ylabe = "$p$"
if quant == "rho" :
ylabe = "$\\rho$"
if quant == "t" :
ylabe = "$T$"
if quant == "rhov1" :
ylabe = "$\\rho v_1 -\\rho v_1(-1)$"
#ax.yaxis.set_major_formatter(ptick.ScalarFormatter(useMathText=True))
ax.yaxis.offsetText.set_fontsize(12)
ax.ticklabel_format(style='sci',axis='y',scilimits=(0,0))
if media == "cd" :
for km in lst4 :
dirname = "p(" + media + "_" + km + "," + km + "_1,1)p"
data = np.loadtxt(dirname+"/"+filename)
plt.xlabel("$x$",fontsize=32)
plt.ylabel(ylabe,fontsize=32)
x = data[:,0]
y = data[:,1]
if quant =="rhov1" :
y = data[:,1]-data[0,1]
plt.plot(x,y,mfc='w',markevery=0.1,label="g"+media+","+km)
plt.subplots_adjust(left=0.2,right=0.8,bottom=0.2)
plt.legend(bbox_to_anchor=(1.03, 1), loc='upper left',fontsize=14)
fig.savefig(outname)
else :
for km in lst2 :
dirname = "p(" + media + "_1," + km + "_1,1)p"
data = np.loadtxt(dirname+"/"+filename)
plt.xlabel("$x$",fontsize=32)
plt.ylabel(ylabe,fontsize=32)
x = data[:,0]
y = data[:,1]
if quant =="rhov1" :
y = data[:,1]-data[0,1]
plt.plot(x,y,mfc='w',markevery=0.1,label="g"+media+","+km)
plt.subplots_adjust(left=0.2,right=0.8,bottom=0.2)
plt.legend(bbox_to_anchor=(1.03, 1), loc='upper left',fontsize=14)
fig.savefig(outname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment