Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_chart method back to Spc #4

Open
petebachant opened this issue Jun 21, 2016 · 0 comments
Open

Add get_chart method back to Spc #4

petebachant opened this issue Jun 21, 2016 · 0 comments

Comments

@petebachant
Copy link

Present in https://launchpad.net/python-spc/+milestone/0.3:

    def get_chart(self, ax=None):
        """Generate chart using matplotlib."""
        if not mpl_present:
            raise Exception("matplotlib not installed")
        if ax == None:
            ax = pylab
        ax.plot(self._data, "bo-")
        ax.plot([0, len(self._data)], [self.center, self.center], "k-")
        ax.plot([0, len(self._data)], [self.lcl, self.lcl], "k:")
        ax.plot([0, len(self._data)], [self.ucl, self.ucl], "k:")

        if self.violating_points.has_key(RULES_7_ON_ONE_SIDE):
            for i in self.violating_points[RULES_7_ON_ONE_SIDE]:
                ax.plot([i], [self._data[i]], "yo")
        if self.violating_points.has_key(RULES_1_BEYOND_3SIGMA):
            for i in self.violating_points[RULES_1_BEYOND_3SIGMA]:
                ax.plot([i], [self._data[i]], "ro")
        pylab.figtext(0.05, 0.04, "Center = %0.3f" % self.center)
#        pylab.figtext(0.05, 0.01, "StdDev = %0.3f" % self.sd)
        pylab.figtext(0.3, 0.04, "LCL = %0.3f" % self.lcl)
        pylab.figtext(0.3, 0.01, "UCL = %0.3f" % self.ucl)
        #pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant