fd191b81e1bc654866807e9a68af769ef006c554,ggplot/stats/stat_hline.py,stat_hline,_calculate,#stat_hline#Any#,14
Before Change
CREATES = {"yintercept"}
def _calculate(self, data):
try:
y = data.pop("y")
except KeyError:
pass
// yintercept may be one of:
// - aesthetic to geom_hline or
// - parameter setting to stat_hline
try:
yintercept = data.pop("yintercept")
except KeyError:
yintercept = self.params["yintercept"]
// TODO: Enable this when the parameters are passed correctly
// and uncomment test case
if hasattr(yintercept, "__call__"):
try:
y = y
except NameError:
raise Exception(
"To compute the intercept, y aesthetic is needed")
yintercept = yintercept(y)
yintercept = make_iterable(yintercept)
new_data = pd.DataFrame({"yintercept": yintercept})
// Copy the other aesthetics into the new dataframe
n = len(yintercept)
for ae in data:
new_data[ae] = make_iterable_ntimes(data[ae].iloc[0], n)
return new_data
After Change
CREATES = {"yintercept"}
def _calculate(self, data):
y = pop(data, "y", None)
// yintercept may be one of:
// - aesthetic to geom_hline or
// - parameter setting to stat_hline
yintercept = pop(data, "yintercept", self.params["yintercept"])
// TODO: Enable this when the parameters are passed correctly
// and uncomment test case
if hasattr(yintercept, "__call__"):
if y is None:
raise Exception(
"To compute the intercept, y aesthetic is needed")
yintercept = yintercept(y)
yintercept = make_iterable(yintercept)
new_data = pd.DataFrame({"yintercept": yintercept})
// Copy the other aesthetics into the new dataframe
n = len(yintercept)
for ae in data:
new_data[ae] = make_iterable_ntimes(data[ae].iloc[0], n)
return new_data
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 21
Instances
Project Name: has2k1/plotnine
Commit Name: fd191b81e1bc654866807e9a68af769ef006c554
Time: 2014-04-29
Author: has2k1@gmail.com
File Name: ggplot/stats/stat_hline.py
Class Name: stat_hline
Method Name: _calculate
Project Name: has2k1/plotnine
Commit Name: fd191b81e1bc654866807e9a68af769ef006c554
Time: 2014-04-29
Author: has2k1@gmail.com
File Name: ggplot/stats/stat_abline.py
Class Name: stat_abline
Method Name: _calculate
Project Name: has2k1/plotnine
Commit Name: fd191b81e1bc654866807e9a68af769ef006c554
Time: 2014-04-29
Author: has2k1@gmail.com
File Name: ggplot/stats/stat_vline.py
Class Name: stat_vline
Method Name: _calculate