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

Appearance settings

Qt backend's Figure options to support axis units #19075

Copy link
Copy link
Closed
@soininen

Description

@soininen
Issue body actions

Problem

We often use datetimes on X axis. However, Qt backend's figure options dialog converts these to floating point numbers making it all but possible to edit the axis xmin and xmax.

Proposed Solution

Make the options dialog deal with axis units more properly, e.g. datetimes could be shown using QDateTimeEdit widget.

I managed to get this working for datetimes and X axis on a monkey-patched options dialog by replacing line 37 in matploglib/backends/qt_editor by

    if isinstance(axes.xaxis.converter, DateConverter):
        xmin, xmax = tuple(num2date(lim) for lim in axes.get_xlim())
    else:
        xmin, xmax = map(float, axes.get_xlim())

Would this be an acceptable way of dealing with the units in general? I would be willing to work on a Pull request on this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.