Skip to content

Commit

Permalink
Final addition of p_chart, including documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlynybbled committed May 20, 2022
1 parent 8a0387a commit ccae0e9
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
Binary file added docs/_static/images/p_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images/xbarr_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images/xbars_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images/xmr_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Plotting & Charting

----

.. autofunction:: manufacturing.control_plot
.. autofunction:: manufacturing.p_chart

Import & Export
---------------
Expand Down
7 changes: 7 additions & 0 deletions docs/plotting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@ that warrant further explanation:
* lower control limit - the lower control limit as calculated from the data on the plot

.. image:: _static/images/x_bar_s-anatomy.png

Additional Chart Types
----------------------

One may also utilize the :meth:`manufacturing.p_chart()`, which requires a `pandas.DataFrame` rather than a `pandas.Series`.

.. image:: _static/images/p_chart.png
20 changes: 12 additions & 8 deletions manufacturing/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,12 @@ def control_chart_base(

ax.plot(data, marker=".")

# ax.axhline(spec_center, linestyle="--", color="red", alpha=0.2)
ax.plot(spec_center, linestyle='--', color='red', alpha=0.2)
try:
iter(spec_center)
ax.plot(spec_center, linestyle='--', color='red', alpha=0.2)
except TypeError:
ax.axhline(spec_center, linestyle="--", color="red", alpha=0.2)

ax.axhline(mean, linestyle="--", color="blue", alpha=0.3, zorder=-10)

texts = [
Expand Down Expand Up @@ -1080,16 +1084,16 @@ def p_chart(
- `pass`, which contains a `True`/`False` or `1`/`0` indication of pass/fail \
status of a test sequence
- `lotid` or `datetime`, either of which will be used to create subgroups; if `lotid` is
provided, then data will be subgrouped into the defined lots; if `datetime` is provided,
then lot sizes will be based on time units (hour, day, week, year) and will automatically
- `lotid` or `datetime`, either of which will be used to create subgroups; if `lotid` is \
provided, then data will be subgrouped into the defined lots; if `datetime` is provided, \
then lot sizes will be based on time units (hour, day, week, year) and will automatically \
be chosen to ensure that some defects are present in each lot size
:param data: a dataframe containing two columns, `pass` and `lotid` or `datetime`
:param parameter_name:
:param highlight_beyond_limits:
:param parameter_name: a string representing the parameter name
:param highlight_beyond_limits: `True` or `False`
:param figure: instance of `matplotlib.figure.Figure` on which to create the plot
:return:
:return: an instance of `matplotlib.figure.Figure` on which the plot has been created
"""
if not isinstance(data, pd.DataFrame):
raise ValueError('data must be of type `pandas.Dataframe`')
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "manufacturing"
version = "1.1.25"
version = "1.2.0"
description = "Six-Sigma based analysis of manufacturing data"
readme = 'readme.md'
authors = ["Jason R. Jones <[email protected]>"]
Expand Down
7 changes: 3 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Project is currently undergoing frequent updates for documentation and to add
functionality and update documentation!! Screenshots and features that you see
on here may be out of date, but are in progress.

Current focus is to add test coverage and shore up functionality that has
been implemented. All versions before v1.2.0 will be minor bugfixes or minor
functionality as it is revealed in test development.
Current focus is to add more plot types.

# Installation

Expand Down Expand Up @@ -54,6 +52,7 @@ the dataset requires. However, if you wish to call a specific type of control c
- `x_mr_chart`
- `xbar_r_chart`
- `xbar_s_chart`
- `p_chart`

# Contributions

Expand All @@ -70,7 +69,7 @@ Items marked out were added most recently.
- ~~Add `Xbar-R Chart` (subgroups between 2 and 10)~~
- ~~Add `Xbar-S Chart` (subgroups of 11 or more)~~
- ~~Update documentation to reflect recent API changes~~
- Add `p chart`
- ~~Add `p chart`~~
- Add `np chart`
- Add `u chart`
- Add `c chart`
Expand Down

0 comments on commit ccae0e9

Please sign in to comment.