{"record":{"id":"b48157aa87a45ae3","repo":"matplotlib/matplotlib","slug":"margin-must-be-greater-than-0-5-b48157","errorCode":null,"errorMessage":"margin must be greater than -0.5","messagePattern":"margin must be greater than -0\\.5","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/mpl_toolkits/mplot3d/axes3d.py","lineNumber":583,"sourceCode":"\n    def set_zmargin(self, m):\n        \"\"\"\n        Set padding of Z data limits prior to autoscaling.\n\n        *m* times the data interval will be added to each end of that interval\n        before it is used in autoscaling.  If *m* is negative, this will clip\n        the data range instead of expanding it.\n\n        For example, if your data is in the range [0, 2], a margin of 0.1 will\n        result in a range [-0.2, 2.2]; a margin of -0.1 will result in a range\n        of [0.2, 1.8].\n\n        Parameters\n        ----------\n        m : float greater than -0.5\n        \"\"\"\n        if m <= -0.5:\n            raise ValueError(\"margin must be greater than -0.5\")\n        self._zmargin = m\n        self._request_autoscale_view(\"z\")\n        self.stale = True\n\n    def margins(self, *margins, x=None, y=None, z=None, tight=True):\n        \"\"\"\n        Set or retrieve autoscaling margins.\n\n        See `.Axes.margins` for full documentation.  Because this function\n        applies to 3D Axes, it also takes a *z* argument, and returns\n        ``(xmargin, ymargin, zmargin)``.\n        \"\"\"\n        if margins and (x is not None or y is not None or z is not None):\n            raise TypeError('Cannot pass both positional and keyword '\n                            'arguments for x, y, and/or z.')\n        elif len(margins) == 1:\n            x = y = z = margins[0]\n        elif len(margins) == 3:","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/mpl_toolkits/mplot3d/axes3d.py#L565-L601","documentation":"Error \"margin must be greater than -0.5\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/mpl_toolkits/mplot3d/axes3d.py:583 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b379c1b69e012b142c0f496a52bcb30513802d72","analyzedAt":"2026-08-21T23:31:55.468Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}