Giter Club home page Giter Club logo

Comments (4)

astrofrog avatar astrofrog commented on May 18, 2024

In def set_view_interval in axis.py, should the following lines:

        Vmin, Vmax = self.get_view_interval()
        if Vmin < Vmax:
            self.axes.viewLim.intervalx = (min(vmin, vmax, Vmin),
                                           max(vmin, vmax, Vmax))
        else:
            self.axes.viewLim.intervalx = (max(vmin, vmax, Vmin),
                                           min(vmin, vmax, Vmax))

Not be the following?

        if Vmin < Vmax:
            self.axes.viewLim.intervalx = (min(vmin, vmax),
                                           max(vmin, vmax))
        else:
            self.axes.viewLim.intervalx = (max(vmin, vmax),
                                           min(vmin, vmax))

Basically, the old limits should be used to determine the order, but apart from that, why should they appear in the min(...) and max(...) expressions?

from matplotlib.

leejjoon avatar leejjoon commented on May 18, 2024

The changelog entry of the associated commit seems to indicate that this is an intended behavior.

cb5cab4

@efiring, can you comment on this?

For example,

 ax = plt.subplot(111)

 ax.xaxis.set_view_interval(5, 10, ignore=False)
 print ax.xaxis.get_view_interval()

 ax.xaxis.set_view_interval(5, 10, ignore=True)
 print ax.xaxis.get_view_interval()

prints

[  0.  10.]
[  5.  10.]

which seems a bit inconsistent.

from matplotlib.

efiring avatar efiring commented on May 18, 2024

On 05/23/2011 06:57 PM, leejjoon wrote:

The changelog entry of the associated commit seems to indicate that this is an intended behavior.

cb5cab4

@efiring, can you comment on this?

The problem here is that Axis.set_view_interval should be an obscure
private method, or it should be broken up into two methods, perhaps one
or both of which should also be obscure and private; its only internal
use, as far as I can see, is in ticker.py. The methods that are
intended for public use in setting the viewLim are the Axes methods.
The original implementation of Axis.set_view_interval was broken for its
original purpose; I fixed that, but did not put enough additional
explanation in the docstring (which was previously missing entirely, and
maybe should have been left so) to fully explain what the ignore kwarg
does--which is to change the behavior so that it not only preserves the
original order (hence axis inversion, if any), but also permits only
expansion, not contraction, of the interval. It is this very different
sort of functionality, required by ticker, that is causing the confusion.

So: minimal solution is to improve the docstring; a cleaner long-term
solution would involve ending up with two methods instead of one, and no
kwarg. How to do this in with minimal user code breakage and with good,
readable names for all methods is not obvious to me yet.

Eric

For example,

  ax = plt.subplot(111)

  ax.xaxis.set_view_interval(5, 10, ignore=False)
  print ax.xaxis.get_view_interval()

  ax.xaxis.set_view_interval(5, 10, ignore=True)
  print ax.xaxis.get_view_interval()

prints

[  0.  10.]
[  5.  10.]

which seems a bit inconsistent.

from matplotlib.

astrofrog avatar astrofrog commented on May 18, 2024

Ok, I understand now that these methods are not meant to be public. I'm not sure why I originally used them instead of set_xlim and set_ylim, but I must have stumbled upon them and assumed they were public. I'm just going to switch to set_xlim and set_ylim for my code.

from matplotlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.