Comments (4)
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.
The changelog entry of the associated commit seems to indicate that this is an intended behavior.
@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.
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.
@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.
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)
- [MNT]: Misleading function name `Poly3DCollection.get_vector()` HOT 1
- [Bug]: Interactive Mode Image Visualization HOT 1
- [Bug]: Qt test_ipython fails on older ipython HOT 2
- [TST] Upcoming dependency test failures HOT 1
- [Doc]: quiver ‘scale_units’ description is not very not clear HOT 1
- [Bug]: typehint missing for matplotlib Axes HOT 1
- [ENH]: Faking a text's metrics to fix its alignment HOT 1
- [Bug]: Matplotlib not work with MiKTeX. HOT 6
- [Bug]: LaTeX option clash error when pgf.preamble uses certain packages
- [MNT]: scale of the quiver does not print the actually value till after the figure pop up. HOT 1
- [Bug]: "fill_between" not showing on some PDF readers when using "alpha" HOT 1
- [Bug]: 'TimedAnimation' object has no attribute '_framedata' HOT 1
- [ENH]: matplotlib.widgets.PolygonSelector widget initial cursor position at data rather than (0,0) HOT 1
- [Doc]: drawedges attribute described twice in matplotlib.colorbar documentation HOT 5
- [ENH]: Add TypedDict (like) type hints to rcParams HOT 3
- [Bug]: Inconsistent Visualization of Intervals in ax.barh for Different Duration Widths HOT 2
- [Bug]: `set_text` does not work when accessed from `axis.get_xticklabels` HOT 2
- [ENH]: More accurate type stub for `plt.subplots` like VSCode did before. HOT 1
- [ENH]: Band and Sankey Diagramm HOT 2
- [Bug]: constant valued line plot has strange/unexpected y-axis HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matplotlib.