{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "ax",
              "annotation": "`matplotlib.axes.Axes`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The matplotlib Axes object on which the plot was drawn."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Visually compare the data against the fitted distribution."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "ax",
              "annotation": "`matplotlib.axes.Axes`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axes object to draw the plot onto, otherwise uses the current Axes."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "plot_type",
              "annotation": "{\"hist\", \"qq\", \"pp\", \"cdf\"}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Type of plot to draw. Options include:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"hist\": Superposes the PDF/PMF of the fitted distribution   over a normalized histogram of the data."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"qq\": Scatter plot of theoretical quantiles against the   empirical quantiles. Specifically, the x-coordinates are the   values of the fitted distribution PPF evaluated at the   percentiles "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "(np.arange(1, n) - 0.5)/n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", where "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is the   number of data points, and the y-coordinates are the sorted   data points."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"pp\": Scatter plot of theoretical percentiles against the   observed percentiles. Specifically, the x-coordinates are the   percentiles "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "(np.arange(1, n) - 0.5)/n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", where "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is   the number of data points, and the y-coordinates are the values   of the fitted distribution CDF evaluated at the sorted   data points."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"cdf\": Superposes the CDF of the fitted distribution over the   empirical CDF. Specifically, the x-coordinates of the empirical   CDF are the sorted data points, and the y-coordinates are the   percentiles "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "(np.arange(1, n) - 0.5)/n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", where "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is   the number of data points."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Available only if "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "matplotlib",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "matplotlib",
                "version": "*",
                "kind": "api",
                "path": "matplotlib"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is installed."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/stats/_fit.py",
  "item_line": 113,
  "item_type": "function",
  "aliases": [
    "scipy.stats._fit.FitResult.plot"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy import stats\nimport matplotlib.pyplot as plt  # matplotlib must be installed\nrng = np.random.default_rng()\ndata = stats.nbinom(5, 0.5).rvs(size=1000, random_state=rng)\nbounds = [(0, 30), (0, 1)]\nres = stats.fit(stats.nbinom, data, bounds)\nax = res.plot()  # save matplotlib Axes object\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe `matplotlib.axes.Axes` object can be used to customize the plot.\nSee `matplotlib.axes.Axes` documentation for details.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.set_xlabel('number of trials')  # customize axis label\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.get_children()[0].set_linewidth(5)  # customize line widths\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.legend()\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-97a9c7c0b161bbd6.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "self",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "ax",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "plot_type",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "hist"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "plot"
  },
  "references": null,
  "qa": "scipy.stats._fit:FitResult.plot",
  "arbitrary": [],
  "local_refs": [
    "ax",
    "plot_type"
  ]
}