{"record":{"id":"d1ae5ef2f3ae0088","repo":"pola-rs/polars","slug":"altair-has-no-method-mark-attr-d1ae5e","errorCode":null,"errorMessage":"Altair has no method 'mark_{attr}'","messagePattern":"Altair has no method 'mark_(.+?)'","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/series/plotting.py","lineNumber":177,"sourceCode":"        encodings: Encodings = {\"x\": \"index\", \"y\": self._series_name}\n        return (\n            alt.Chart(self._df.with_row_index())\n            .mark_line(tooltip=True)\n            .encode(**encodings, **kwargs)\n            .interactive()\n        )\n\n    def __getattr__(self, attr: str) -> Callable[..., alt.Chart]:\n        if self._series_name == \"index\":\n            msg = f\"Cannot call `plot.{attr}` when Series name is 'index'\"\n            raise ValueError(msg)\n        if attr == \"scatter\":\n            # alias `scatter` to `point` because of how common it is\n            attr = \"point\"\n        method = getattr(alt.Chart(self._df.with_row_index()), f\"mark_{attr}\", None)\n        if method is None:\n            msg = f\"Altair has no method 'mark_{attr}'\"\n            raise AttributeError(msg)\n        encodings: Encodings = {\"x\": \"index\", \"y\": self._series_name}\n\n        accepts_tooltip_argument = \"tooltip\" in {\n            value.name for value in inspect.signature(method).parameters.values()\n        }\n        if accepts_tooltip_argument:\n\n            def func(**kwargs: EncodeKwds) -> alt.Chart:\n                return method(tooltip=True).encode(**encodings, **kwargs).interactive()\n        else:\n\n            def func(**kwargs: EncodeKwds) -> alt.Chart:\n                return method().encode(**encodings, **kwargs).interactive()\n\n        return func\n","sourceCodeStart":159,"sourceCodeEnd":193,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/series/plotting.py#L159-L193","documentation":"SeriesPlot.__getattr__ resolves the attribute to an Altair mark_{attr} method. If Altair's Chart has no such mark method, it raises AttributeError('Altair has no method mark_{attr}'). This guards against typos and unsupported mark names for the installed Altair version.","triggerScenarios":"Calling s.plot.barchart(), s.plot.barh(), s.plot.lines(), or any misspelled/unsupported mark name like s.plot.sactter() where f'mark_{attr}' doesn't exist on alt.Chart.","commonSituations":"Expecting pandas-bokeh/matplotlib-style plot method names; Altair version differences where newer marks (e.g. mark_arc in older versions) don't exist; typos like s.plot.pointt().","solutions":["Check dir(alt.Chart) for available mark_* methods","Use a valid Altair mark: bar, point, line, area, circle, tick, rule, rect, arc","Remember scatter is aliased: s.plot.scatter() maps to mark_point","Upgrade Altair if the mark you need exists only in newer versions"],"exampleFix":"// before\ns.plot.barchart()\n// after\ns.plot.bar()  # Altair mark_bar","handlingStrategy":"validation","validationCode":"import altair as alt\nif not hasattr(alt.Chart, f\"mark_{attr}\"):\n    raise ValueError(f\"unknown mark: {attr}\")\ngetattr(s.plot, attr)()","typeGuard":"def is_valid_mark(attr: str) -> bool:\n    import altair as alt\n    return hasattr(alt.Chart, f\"mark_{attr}\")","tryCatchPattern":"try:\n    chart = s.plot.barchart()\nexcept AttributeError as e:\n    if \"Altair has no method\" in str(e):\n        chart = s.plot.bar()  # fall back to a valid mark","preventionTips":["Use Altair mark names (bar, point, line, area, circle, rect, arc, tick)","Remember scatter is the only alias (to point)","Check installed Altair version — marks vary across versions","List valid marks with [m for m in dir(alt.Chart) if m.startswith('mark_')]"],"tags":["polars","plotting","altair","attribute-error","typo"],"backgroundTag":"unsupported-operation","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}