Skip to content

ENH: Add ScatterPlot._scatter()  #51560

@AdamOrmondroyd

Description

@AdamOrmondroyd

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I am contributing to anesthetic, which extends pandas for plotting the results of nested sampling. It is very convenient that HistPlot._makeplot() calls the class method self._plot() which KdePlot overrides, as our histograms can do the same and not worry about handling the rest of the formatting in _makeplot(). It would be useful if ScatterPlot worked similarly, so we could insert our own scatter.

Perhaps _scatter() would be more appropriate than _plot() in this case.

Feature Description

Extending ScatterPlot would look something like this:

from pandas.plotting._matplotlib.core import ScatterPlot

def my_scatter_method(ax, x, y, **kwds):
    # additional processing appropriate for nested sampling
    return ax.scatter(x, y, ...)
    

class MyScatterPlot(ScatterPlot):
    @classmethod
    def _scatter(cls, ax, x, y, **kwds):
        return my_scatter_method(ax, x, y, **kwds)

Alternative Solutions

Currently we override ScatterPlot._makeplot(), so we have to deal again with handling all the e.g. color arguments.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions