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: secondary axis for a x or y scale. #10976

Closed
Milestone
@jklymak

Description

@jklymak

Enhancement discussion

See#10961#10960

5l7bk

Often it is desirable to have a second x or y scale on an axes with a different scale than the primary x/y axis; think frequency and period on the xaxis of a power spectrum, or date and datenum for a time series. (just assuming the x-axis for now:) Generally it'd be the same size as the existing xaxis, but would be offset vertically, have its own locator, formatter, and xlabel. it would update as the data is zoomed through, and be slave to the parent xaxis

It appears folks most often do this with twiny (i.e.https://stackoverflow.com/questions/10514315/how-to-add-a-second-x-axis-in-matplotlib) but there is nothing to make the axes continue to have the same x-limits under interactive viewing, and no simple way to have the new axes have a different scale.

The enhancement here would be to add something like:

secaxis = ax.secondary_xaxis(loc='top', convert=5, label='Boo')

wheresecaxis is either an axis object or an axes.loc would be something like"top", "bottom", "above", "below", float where "above" and "below" means that it goes above or below any existing axis, and the float is a hard-set axes fraction (like theset_position ofspine now).convert would be a conversion factor: a float would just be a multiplier, or a function could be passed that converts x to xnew. No doubt there could be a way to make this work with units instead, but...

How to impliment

As discussed in#10961@efiring thought implimenting as an axes with shrunk and hidden unused dimensions would be good.

I'd advocate an axis object so that the logical organization makes more sense. i.e. this would be a child of the original axes, and would be included as one of the axes decorators. But, I haven't thought through all the implimentation details yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp