MCPcopy Index your code
hub / github.com/glamp/bashplotlib / plot_scatter

Function plot_scatter

bashplotlib/scatterplot.py:52–84  ·  view source on GitHub ↗

Form a complex number. Arguments: f -- comma delimited file w/ x,y coordinates xs -- if f not specified this is a file w/ x coordinates ys -- if f not specified this is a filew / y coordinates size -- size of the plot pch -- shape of the points (any

(f, xs, ys, size, pch, colour, title)

Source from the content-addressed store, hash-verified

50 print("-" * (2 * len(get_scale(xs, False, size)) + 2))
51
52def plot_scatter(f, xs, ys, size, pch, colour, title):
53 """
54 Form a complex number.
55
56 Arguments:
57 f -- comma delimited file w/ x,y coordinates
58 xs -- if f not specified this is a file w/ x coordinates
59 ys -- if f not specified this is a filew / y coordinates
60 size -- size of the plot
61 pch -- shape of the points (any character)
62 colour -- colour of the points
63 title -- title of the plot
64 """
65 cs = None
66 if f:
67 if isinstance(f, str):
68 with open(f) as fh:
69 data = [tuple(line.strip().split(',')) for line in fh]
70 else:
71 data = [tuple(line.strip().split(',')) for line in f]
72 xs = [float(i[0]) for i in data]
73 ys = [float(i[1]) for i in data]
74 if len(data[0]) > 2:
75 cs = [i[2].strip() for i in data]
76 elif isinstance(xs, list) and isinstance(ys, list):
77 pass
78 else:
79 with open(xs) as fh:
80 xs = [float(str(row).strip()) for row in fh]
81 with open(ys) as fh:
82 ys = [float(str(row).strip()) for row in fh]
83
84 _plot_scatter(xs, ys, size, pch, colour, title, cs)
85
86
87

Callers 1

mainFunction · 0.85

Calls 1

_plot_scatterFunction · 0.85

Tested by

no test coverage detected