Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
@soininen

Description

@soininen

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