29 lines
906 B
Python
29 lines
906 B
Python
# -*- encoding: utf-8 -*-
|
|
|
|
from .generic_plot import generic_plot
|
|
|
|
|
|
class errorbars_plot(generic_plot):
|
|
def __init__(self, legend, data, precision=5, 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=self.format_value(x),
|
|
y=self.format_value(y),
|
|
p=self.format_value(p),
|
|
n=self.format_value(n),
|
|
)
|
|
)
|
|
return "coordinates {{{}}}".format("\n".join(rows))
|