Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: allow scatter plots to preserve data limits. #24416

Open
@juseg

Description

@juseg

Problem

I would like to plot scatter points as contextual data while preserving the current axes data limits. Something like this can be achieved withAxes.set_autoscale(False), but I would like to keep auto-scaling on, and disable it for a particular feature. As far as I understand this is how collections work, whichAxes.scatter uses in the background.

Context: this feature will allow GeoPandas to consistently plot line, polygon (usingadd_collection()) and point data (usingscatter()) as contextual data not affecting axes limits (seegeopandas/geopandas#2602). Down the line it will benefit a small library I am developing (hyoga), to plot gridded data with xarray, and geographic data for context with geopandas.

Proposed solution

I noticed thatadd_collection has anautolim keyword that defaults toTrue. As opposed to completely disabling auto-scaling, settingautolim=False simply skips updating the axes data limits for this particular collection, meaning auto-scaling stays on, but ignores it (if I read this correctly). I propose to propagate theautolim keyword argument toAxes.scatter and pass it toadd_collection here:

self.add_collection(collection)
self._request_autoscale_view()

This would allow something like:

ax.scatter(x_subject,y_subject)# default to autolim=True, update limitsax.scatter(x_context,y_context,autolim=False)# don't update limitsax.plot(something_else)# update limits disregarding {x,y}_context

I am happy to open a PR if this makes sense.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp