def lactations(self): """Plot lactations of ``cow`` together.""" for lact in sorted(mongo.lacts(self.cow)): prods = mongo.prods(self.cow, lact) days = mongo.days(self.cow, lact) plt.plot(days, prods, label="{}".format(lact)) plt.xlabel(self.DAY_LABEL) plt.ylabel(self.PROD_LABEL) plt.legend() with self.doc.create(pylatex.Section('Lactations')): self.add_plot()
def lactation(self, lact): """Plot lactation ``lact``. :param lact: The lactation of the cow to be plotted. :type lact: int """ plt.xlabel(self.DAY_LABEL) plt.ylabel(self.PROD_LABEL) plt.xlim(xmax=self.MIN_DAY_RANGE) prods = mongo.prods(self.cow, lact) days = mongo.days(self.cow, lact) plt.plot(days, prods) with self.doc.create(pylatex.Section('Lactation {}'.format(lact))): self.add_plot()