Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

ENH: make mouse over behavior configurable#4847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletiondoc/users/whats_new/2015-01-19_cursor_pixel_data.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
Allow Artists to Display Pixel Data in Cursor
---------------------------------------------

Adds `get_pixel_data` and `format_pixel_data` methods to artists
Adds `get_cursor_data` and `format_cursor_data` methods to artists
which can be used to add zdata to the cursor display
in the status bar. Also adds an implementation for Images.

Added an property attribute ``mouseover`` and rcParam
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I was a bit confused by this, I think... This PR is really just an optimization around a new feature that hasn't been released yet, right?

Then maybe instead of "Added an attribute..." say "This feature requires that theaxes.mouseover attribute is set toTrue..." etc.

Barring that, I'm 👍 on this PR.

(``axes.mouseover``) to Axes objects to control if the hit list is
computed. For moderate number of artists (>100) in the axes the
expense to compute the top artist becomes greater than the time
between mouse events. For this reason the behavior defaults to
``False``, but maybe enabled by default in the future when the hitlist
computation is optimized.

To enable the cursor message on a given axes ::

ax.mouseover = True

To enable for all new axes created ::

matplotlib.rcParams['axes.mouseover'] = True
5 changes: 5 additions & 0 deletionslib/matplotlib/axes/_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,6 +390,8 @@ def __init__(self, fig, rect,
*yscale* [%(scale)s]
*yticklabels* sequence of strings
*yticks* sequence of floats
*mouseover* [ *True* | *False*] if mouseover artists
adds to message string in the gui window
================ =========================================
""" % {'scale': ' | '.join(
[repr(x) for x in mscale.get_scale_names()])}
Expand All@@ -406,6 +408,7 @@ def __init__(self, fig, rect,
self.set_anchor('C')
self._sharex = sharex
self._sharey = sharey

if sharex is not None:
self._shared_x_axes.join(self, sharex)
if sharex._adjustable == 'box':
Expand DownExpand Up@@ -467,6 +470,8 @@ def __init__(self, fig, rect,
self._ycid = self.yaxis.callbacks.connect('units finalize',
self.relim)

self.mouseover = kwargs.pop('mouseover', rcParams['axes.mouseover'])

def __setstate__(self, state):
self.__dict__ = state
# put the _remove_method back on all artists contained within the axes
Expand Down
5 changes: 4 additions & 1 deletionlib/matplotlib/backend_bases.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2812,7 +2812,10 @@ def mouse_move(self, event):
except (ValueError, OverflowError):
pass
else:
artists = event.inaxes.hitlist(event)
if event.inaxes.mouseover:
artists = event.inaxes.hitlist(event)
else:
artists = []

if artists:
a = max(enumerate(artists), key=lambda x: x[1].zorder)[1]
Expand Down
4 changes: 2 additions & 2 deletionslib/matplotlib/rcsetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -756,7 +756,7 @@ def __call__(self, s):
'axes.ymargin': [0, ValidateInterval(0, 1,
closedmin=True,
closedmax=True)],# margin added to yaxis

'axes.mouseover': [False, validate_bool], # find top most artist and ask it for a message
'polaraxes.grid': [True, validate_bool], # display polar grid or
# not
'axes3d.grid': [True, validate_bool], # display 3d grid
Expand DownExpand Up@@ -812,7 +812,7 @@ def __call__(self, s):
'xtick.minor.pad': [4, validate_float], # distance to label in points
'xtick.color': ['k', validate_color], # color of the xtick labels
'xtick.minor.visible': [False, validate_bool], # visiablility of the x axis minor ticks

# fontsize of the xtick labels
'xtick.labelsize': ['medium', validate_fontsize],
'xtick.direction': ['in', six.text_type], # direction of xticks
Expand Down
9 changes: 6 additions & 3 deletionsmatplotlibrc.template
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -273,6 +273,9 @@ backend : %(backend)s
# web-style hex
#axes.xmargin : 0 # x margin. See `axes.Axes.margins`
#axes.ymargin : 0 # y margin See `axes.Axes.margins`
#axes.mouseover : False # if mouse motion should try to find the
# top artist and append a message from that
# artist to the gui message box

#polaraxes.grid : True # display grid on polar axes
#axes3d.grid : True # display grid on 3d axes
Expand DownExpand Up@@ -356,9 +359,9 @@ backend : %(backend)s
#image.lut : 256 # the size of the colormap lookup table
#image.origin : upper # lower | upper
#image.resample : False
#image.composite_image : True # When True, all the images on a set of axes are
# combined into a single composite image before
# saving a figure as a vector graphics file,
#image.composite_image : True # When True, all the images on a set of axes are
# combined into a single composite image before
# saving a figure as a vector graphics file,
# such as a PDF.

### CONTOUR PLOTS
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp