diff options
Diffstat (limited to 'sourcecodes/cv_plotly.py')
| -rw-r--r-- | sourcecodes/cv_plotly.py | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/sourcecodes/cv_plotly.py b/sourcecodes/cv_plotly.py index 05d0621d..c22e0dcc 100644 --- a/sourcecodes/cv_plotly.py +++ b/sourcecodes/cv_plotly.py @@ -1,7 +1,9 @@ -#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 +#!/home/jziebart/python/Python-2.7.15/python import os import sys +#sys.path.append('/home/jziebart/.local/bin') +#sys.path.append('/home/jziebart/.local/lib') import plotly import plotly.graph_objs as go @@ -17,10 +19,9 @@ f=open(filename,"r") lines=f.readlines() #Read the last line to get the variable name line = lines.pop() -#line = map(string.strip,line.strip().split(" ")) -line = line.strip().split(" ") +line = map(string.strip,line.strip().split(" ")) varName = line[3][:-1] -plot_title = varName+" LOOCV" +plot_title = "<br>"+varName+" LOOCV" #remove header line header = lines.pop(0) @@ -28,11 +29,9 @@ header = lines.pop(0) typefile = netID+"type.txt" tf=open(typefile,"r") line=tf.readline() -#varnames = map(string.strip,line.strip().split("\t")) -varnames = line.strip().split("\t") +varnames = map(string.strip,line.strip().split("\t")) line=tf.readline() -#vartypes = map(string.strip,line.strip().split("\t")) -vartypes = line.strip().split("\t") +vartypes = map(string.strip,line.strip().split("\t")) varindex = varnames.index(varName) cd_type = int(vartypes[varindex]) @@ -48,8 +47,7 @@ if cd_type == 1: # line = f.readline() # while line: for line in lines: - #line = map(string.strip,line.strip().split("\t")) - line = line.strip().split("\t") + line = map(string.strip,line.strip().split("\t")) x.append(float(line[1])) y.append(float(line[2])) # line=f.readline() @@ -62,11 +60,7 @@ if cd_type == 1: size=24, color='black' ), - title_xref="paper", - title_x=0.5, - title_xanchor="center", - title_yanchor="middle", - xaxis=dict( + xaxis=dict( autorange=True, title='Actual values', titlefont=dict( @@ -92,8 +86,7 @@ if cd_type == 1: else: #Make bar chart for discrete data #Get names of states - #header = map(string.strip,header.strip().split("\t")) - header = header.strip().split("\t") + header = map(string.strip,header.strip().split("\t")) states = header[2:] #Read the data actual = [] @@ -101,8 +94,7 @@ else: # line = f.readline() # while line: for line in lines: - #line = map(string.strip,line.strip().split("\t")) - line = line.strip().split("\t") + line = map(string.strip,line.strip().split("\t")) actual.append(line[1]) predict_x = line[2:] predict_x = [float(x) for x in predict_x] @@ -153,10 +145,6 @@ else: size=24, color='black' ), - title_xref="paper", - title_x=0.5, - title_xanchor="center", - title_yanchor="middle", xaxis=dict( autorange=True, title='State', |
