25 lines
719 B
Python
25 lines
719 B
Python
# -*- encoding: utf-8 -*-
|
|
|
|
from .generic_plot import generic_plot
|
|
|
|
|
|
class errorbars_plot(generic_plot):
|
|
|
|
def __init__(self, legend, data, label=None, options=[]):
|
|
options = options + [
|
|
'error bars/.cd', ('y dir', 'both'), ('y explicit')]
|
|
super().__init__(legend, data, label=label, options=options)
|
|
|
|
def format_data(self, data):
|
|
rows = []
|
|
for d in data:
|
|
x, y = d[:2]
|
|
try:
|
|
p, n = d[2]
|
|
except TypeError:
|
|
p = d[2]
|
|
n = p
|
|
rows.append('({x}, {y}) += (0, {p}) -= (0, {n})'.format(
|
|
x=x, y=y, p=p, n=n))
|
|
return 'coordinates {{{}}}'.format('\n'.join(rows))
|