FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Issue when trying to plot points with transform that requires more/fewer coordinates than it returns · Issue #3983 · matplotlib/matplotlib · GitHub

Repository navigation

Issue when trying to plot points with transform that requires more/fewer coordinates than it returns #3983

Closed

Description

Let's say we have a transform tr that takes 2-dimensional input and returns 2-dimensional input. If I do:

plt.plot(x, y, transform=tr)

x and y will get passed to tr.transform. Now in some cases the transformation may require 3 coordinates and return 2 'final' coordinates to be plotted (e.g. astrofrog/wcsaxes#148).

For example I might have a transformation that takes longitude, latitude, and altitude and translates these into a 2-d position in a satellite image. In this case if I want to plot points I'd like to be able to do:

plt.plot(longitude, latitude, altitude, transform=tr)

However this doesn't work (and I tried a few other ways to). Is there a way to get this to work, and if not, could it be considered as a feature request? Just to be clear, the transform would always return two coordinates, but could take any arbitrary number of inputs.

Activity

  1. added
    API: changesChanges to the public API, typically requiring deprecation.
    on Jan 8, 2015
  2. added this to the milestone on Jan 8, 2015
  3. tacaswell commented on Jan 8, 2015

    Member

    Doing this on plot will be very hard due to the amount of 'friendly' magic already in it's API.

    We already support plt.plot(x1, y1, x2, y2, ..) so I am not sure it is possible to unambiguously sort out what to do in the case where the user passes in 6 arrays.

    I would suggest writing a function like

    def plot_tran3(ax, a, b, c, tr, **kwargs):
        x, y = tr(a, b, c)
        return ax.plot(x, y, **kwargs)[0]

    One of the things on my to-do list that really needs to get done is to get a decorator in main-line to provide pyplot like convince to user functions (see #3587 / http://thread.gmane.org/gmane.comp.python.matplotlib.devel/12999 and #2736 )

  4. pelson commented on Jan 8, 2015

    Member

    Is there a way to get this to work, and if not, could it be considered as a feature request?

    No. In fact, I don't believe the transform framework itself is particularly well geared for anything other than 2 dimensions (even 1 dimensions are a special case). There is certainly room for unification and generalisation in that regard from the top of my memory.

    FWIW even the 3d axes functionality has to override each of the plotting methods to support 3 dimensional input.

    Sorry I don't have a better answer 😞

  5. WeatherGod commented on Jan 8, 2015

    Member

    I was tinkering with setting up a "projection" class. It is "technically"
    possible to do, but actually getting it integrated into matplotlib may
    prove tricky (at least, from the mplot3d side of things). Discussions with
    Mike did not bring up any obvious blockers to the core idea, it was just
    not easy to use such a projection like you could with other transforms.

    I would, at the very least, like to get a simple set of 3d projections into
    matplotlib core, even if they aren't immediately used by mplot3d. Perhaps
    you would be interested in helping with that? I barely have the cycles to
    do simple development work at the moment.

    On Thu, Jan 8, 2015 at 5:19 PM, Phil Elson notifications@github.com wrote:

    Is there a way to get this to work, and if not, could it be considered as
    a feature request?

    No. In fact, I don't believe the transform framework itself is
    particularly well geared for anything other than 2 dimensions (even 1
    dimensions are a special case). There is certainly room for unification and
    generalisation in that regard from the top of my memory.

    FWIW even the 3d axes functionality has to override each of the plotting
    methods to support 3 dimensional input.

    Sorry I don't have a better answer [image: 😞]

    —
    Reply to this email directly or view it on GitHub
    #3983 (comment)
    .

  6. petehuang commented on Jan 8, 2017

    Contributor

    What's the latest of the team's opinion on whether or not this would be a priority for MPL?

  7. efiring commented on Jan 8, 2017

    Member

    I think that for the foreseeable future the OP is stuck with a two-step process: do the transform from 3 to 2 dimensions outside of mpl, and then use the normal plot function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: changesChanges to the public API, typically requiring deprecation.New feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL