In [ ]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# dummy index
x=0;y=1;ro=2;pr=3;vx=4;vy=5;vz=6;bx=7;by=8;bz=9

# reading the data...
data = np.loadtxt('data/x-00002.dat')
plt.plot(data[:,x],data[:,by],color='b',marker='o')
plt.xlabel('X')
plt.ylabel('Pressure')
plt.show()
#plt.savefig("output.png")

In [ ]:
# Interactive version by jupyter-notebook / ipywidgets
# To use it, please install jupyter and then activate widgetsnbextension.
# $ pip3 install jupyter
# $ [ pip3 install ipywidgets ]
# $ jupyter nbextension enable --py widgetsnbextension
# Then one can run this sample
# $ jupyter-notebook plot.ipynb

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import glob
from ipywidgets import interact

labels={"x":0,"y":1,"Density":2,"Pressure":3,"vx":4,"vy":5,"vz":6,"Bx":7,"By":8,"Bz":9}
colors=['r','g','b']
markers=['o','s','.']
linestyles=['--','-.','-']
datalist = sorted(glob.glob('data/x-?????.dat')) # filelist (regular expression)

@interact (inputdata=datalist,xlabel=labels,ylabel=labels,color=colors,marker=markers,linestyle=linestyles)
def plot(inputdata,xlabel=0,ylabel=3,color='b',marker='o',linestyle='-'):
    # reading the data...
    data = np.loadtxt(inputdata)
    # plot
    plt.plot(data[:,xlabel],data[:,ylabel],color=color,marker=marker,linestyle=linestyle)
    labelnames = list(labels.keys())
    plt.xlabel(labelnames[xlabel])
    plt.ylabel(labelnames[ylabel])
    #plt.savefig("output.png")

In [ ]: