Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #3

Merged
merged 5 commits into from
Jan 16, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improved y-axis scaling
- Scaling of y-axis now only takes into y-values within the given x-axis
range (prevents bad scaling due to large/small numbers outside of
x-range)
  • Loading branch information
pyahmed committed Sep 4, 2014
commit fe69a190c2fb60825964f49974b7209feaef265f
13 changes: 13 additions & 0 deletions pycorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ def expander(min_val,max_val,perc):
return(min_val - x, max_val + x)

def plotter(inp,fractions):
'''
plots a data series with fractions if present
'''
x_val = [x[0] for x in inp['data']]
y_val = [x[1] for x in inp['data']]
if fractions == None:
Expand All @@ -382,6 +385,16 @@ def plotter(inp,fractions):
plot_x_min = args.begin
if args.finish != None:
plot_x_max = args.finish
if plot_x_min != x_val[0]:
range_min = x_val.index(min(x_val, key= lambda x:abs(x-plot_x_min)))
else:
range_min = 0
if plot_x_max != x_val[-1]:
range_max = x_val.index(min(x_val, key= lambda x:abs(x-plot_x_max)))
else:
range_max = -1
x_val = x_val[range_min:range_max]
y_val = y_val[range_min:range_max]
plot_y_min = expander(min(y_val),max(y_val),0.05)[0]
plot_y_max = expander(min(y_val),max(y_val),0.025)[1]
if type(y_val[0]) == float or type(y_val[0]) == int:
Expand Down