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

Skip to content

Commit 7402853

Browse files
committed
some tweaks to image size and backend docs
svn path=/trunk/matplotlib/; revision=5465
1 parent cef23d6 commit 7402853

11 files changed

Lines changed: 93 additions & 81 deletions

File tree

doc/devel/outline.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,20 @@ If you want to make notes for the authorwhen you have reviewed a
103103
submission, you can put them here. As the author cleans them up or
104104
addresses them, they should be removed.
105105

106-
mathtext user's guide-- reviewd by JDH
107-
--------------------------------------
106+
mathtext user's guide-- reviewed by JDH
107+
---------------------------------------
108108

109109
This looks good (see :ref:`mathtext-tutorial`) -- there are a few
110-
minor things to close the book on this chapter.
110+
minor things to close the book on this chapter:
111111

112112
#. The main thing to wrap this up is getting the mathtext module
113-
ported over to rest and included in the API so the links from the
114-
user's guide tutorial work.
113+
ported over to rest and included in the API so the links from the
114+
user's guide tutorial work.
115115

116116
#. This section might also benefit from a little more detail on the
117-
customizations that are possible (eg an example fleshing out the rc
118-
options a little bit). Admittedly, this is pretty clear from readin
119-
ghte rc file, but it might be helpful to a newbie.
117+
customizations that are possible (eg an example fleshing out the rc
118+
options a little bit). Admittedly, this is pretty clear from
119+
readin ghte rc file, but it might be helpful to a newbie.
120120

121121
#. There is still a TODO in the file to include a complete list of symbols
122122

doc/users/annotations.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ arguments are ``(x,y)`` tuples.
1515
.. literalinclude:: figures/annotation_basic.py
1616

1717
.. image:: figures/annotation_basic.png
18-
:scale: 50
18+
:scale: 75
1919

2020
In this example, both the ``xy`` (arrow tip) and ``xytext`` locations
2121
(text location) are in data coordinates. There are a variety of other
@@ -76,7 +76,7 @@ keyword args like ``horizontalalignment``, ``verticalalignment`` and
7676
.. literalinclude:: figures/annotation_polar.py
7777

7878
.. image:: figures/annotation_polar.png
79-
:scale: 50
79+
:scale: 75
8080

8181
See the `annotations demo
8282
<http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.py>`_ for more

doc/users/event_handling.rst

Lines changed: 62 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ Event attributes
7070
================
7171

7272
All matplotlib events inherit from the base class
73-
:class:`matplotlib.backend_bases.Event`, which store the attributes
73+
:class:`matplotlib.backend_bases.Event`, which store the attributes:
74+
75+
``name``
76+
the event name
77+
78+
``canvas``
79+
the FigureCanvas instance generating the event
80+
81+
``guiEvent``
82+
the GUI event that triggered the matplotlib event
7483

75-
=============== =================================================
76-
Event attribute Description
77-
=============== =================================================
78-
``name`` the event name
79-
``canvas`` the FigureCanvas instance generating the event
80-
``guiEvent`` the GUI event that triggered the matplotlib event
81-
=============== =================================================
8284

8385
The most common events that are the bread and butter of event handling
8486
are key press/release events and mouse press/release and movement
@@ -87,16 +89,20 @@ events. The :class:`~matplotlib.backend_bases.KeyEvent` and
8789
these events are both derived from the LocationEvent, which has the
8890
following attributes
8991

90-
======================= ========================================
91-
LocationEvent attribute Description
92-
======================= ========================================
93-
``x`` x position - pixels from left of canvas
94-
``y`` y position - pixels from right of canvas
95-
``button`` button pressed None, 1, 2, 3
96-
``inaxes`` the Axes instance if mouse us over axes
97-
``xdata`` x coord of mouse in data coords
98-
``ydata`` y coord of mouse in data coords
99-
======================= ========================================
92+
``x``
93+
x position - pixels from left of canvas
94+
95+
``y``
96+
y position - pixels from bottom of canvas
97+
98+
``inaxes``
99+
the :class:`~matplotlib.axes.Axes` instance if mouse is over axes
100+
101+
``xdata``
102+
x coord of mouse in data coords
103+
104+
``ydata``
105+
y coord of mouse in data coords
100106

101107
Let's look a simple example of a canvas, where a simple line segment
102108
is created every time a mouse is pressed::
@@ -129,12 +135,11 @@ The :class:`~matplotlib.backend_bases.MouseEvent` that we just used is a
129135
the data and pixel coordinates in event.x and event.xdata. In
130136
addition to the ``LocationEvent`` attributes, it has
131137

132-
==================== ==============================================================
133-
MouseEvent attribute Description
134-
==================== ==============================================================
135-
``button`` button pressed None, 1, 2, 3
136-
``key`` the key pressed: None, chr(range(255)), shift, win, or control
137-
==================== ==============================================================
138+
``button``
139+
button pressed None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events)
140+
141+
``key``
142+
the key pressed: None, chr(range(255), 'shift', 'win', or 'control'
138143

139144
Draggable Rectangle Exercise
140145
----------------------------
@@ -281,7 +286,6 @@ Extra credit solution::
281286
self.rect.set_x(x0+dx)
282287
self.rect.set_y(y0+dy)
283288

284-
285289
canvas = self.rect.figure.canvas
286290
axes = self.rect.axes
287291
# restore the background region
@@ -293,8 +297,6 @@ Extra credit solution::
293297
# blit just the redrawn area
294298
canvas.blit(axes.bbox)
295299

296-
297-
298300
def on_release(self, event):
299301
'on release we reset the press data'
300302
if DraggableRectangle.lock is not self:
@@ -309,6 +311,7 @@ Extra credit solution::
309311

310312
# redraw the full figure
311313
self.rect.figure.canvas.draw()
314+
312315
def disconnect(self):
313316
'disconnect all the stored connection ids'
314317
self.rect.figure.canvas.mpl_disconnect(self.cidpress)
@@ -340,24 +343,29 @@ You can enable picking by setting the ``picker`` property of an
340343

341344
There are a variety of meanings of the ``picker`` property:
342345

343-
- ``None`` : picking is disabled for this artist (default)
346+
``None``
347+
picking is disabled for this artist (default)
344348

345-
- ``boolean`` : if True then picking will be enabled and the artist will
346-
fire a pick event if the mouse event is over the artist
349+
``boolean``
350+
if True then picking will be enabled and the artist will fire a
351+
pick event if the mouse event is over the artist
347352

348-
- ``float`` : if picker is a number it is interpreted as an epsilon
349-
tolerance in points and the the artist will fire off an event if its
350-
data is within epsilon of the mouse event. For some artists like
351-
lines and patch collections, the artist may provide additional data
352-
to the pick event that is generated, eg the indices of the data
353-
within epsilon of the pick event.
353+
``float``
354+
if picker is a number it is interpreted as an epsilon tolerance in
355+
points and the the artist will fire off an event if its data is
356+
within epsilon of the mouse event. For some artists like lines
357+
and patch collections, the artist may provide additional data to
358+
the pick event that is generated, eg the indices of the data
359+
within epsilon of the pick event.
354360

355-
- ``function`` : if picker is callable, it is a user supplied function
356-
which determines whether the artist is hit by the mouse event. The
357-
signature is ``hit, props = picker(artist, mouseevent)`` to
358-
determine the hit test. If the mouse event is over the artist,
359-
return ``hit=True`` and props is a dictionary of properties you want
360-
added to the :class:`~matplotlib.backend_bases.PickEvent` attributes
361+
``function``
362+
if picker is callable, it is a user supplied function which
363+
determines whether the artist is hit by the mouse event. The
364+
signature is ``hit, props = picker(artist, mouseevent)`` to
365+
determine the hit test. If the mouse event is over the artist,
366+
return ``hit=True`` and props is a dictionary of properties you
367+
want added to the :class:`~matplotlib.backend_bases.PickEvent`
368+
attributes
361369

362370

363371
After you have enabled an artist for picking by setting the ``picker``
@@ -373,16 +381,18 @@ pick callbacks on mouse press events. Eg::
373381
The :class:`~matplotlib.backend_bases.PickEvent` which is passed to
374382
your callback is always fired with two attributes:
375383

376-
- ``mouseevent`` : the mouse event that generate the pick event. The
377-
mouse event in turn has attributes like ``x`` and ``y`` (the coords in
378-
display space, eg pixels from left, bottom) and xdata, ydata (the
379-
coords in data space). Additionally, you can get information about
380-
which buttons were pressed, which keys were pressed, which Axes the
381-
mouse is over, etc. See :class:`matplotlib.backend_bases.MouseEvent` for
382-
details.
383-
384-
- ``artist`` : the :class:`matplotlib.artist.Artist` that generated
385-
the pick event.
384+
``mouseevent`` the mouse event that generate the pick event. The
385+
mouse event in turn has attributes like ``x`` and ``y`` (the
386+
coords in display space, eg pixels from left, bottom) and xdata,
387+
ydata (the coords in data space). Additionally, you can get
388+
information about which buttons were pressed, which keys were
389+
pressed, which :class:`~matplotlib.axes.Axes` the mouse is over,
390+
etc. See :class:`matplotlib.backend_bases.MouseEvent` for
391+
details.
392+
393+
``artist``
394+
the :class:`~matplotlib.artist.Artist` that generated the pick
395+
event.
386396

387397
Additionally, certain artists like :class:`~matplotlib.lines.Line2D`
388398
and :class:`~matplotlib.collections.PatchCollection` may attach

doc/users/figures/make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys, os, glob
33
import matplotlib
44
import IPython.Shell
5-
matplotlib.rcdefaults()
5+
#matplotlib.rcdefaults()
66
matplotlib.use('Agg')
77

88
mplshell = IPython.Shell.MatplotlibShell('mpl')

doc/users/figures/pyplot_simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import matplotlib.pyplot as plt
22
plt.plot([1,2,3])
33
plt.ylabel('some numbers')
4-
4+
plt.show()

doc/users/mathtext.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Here is an example illustrating many of these features in context.
233233
.. literalinclude:: figures/pyplot_mathtext.py
234234

235235
.. image:: figures/pyplot_mathtext.png
236-
:scale: 50
236+
:scale: 75
237237

238238

239239

doc/users/pyplot_tutorial.rst

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
pyplot tutorial
55
***************
66

7-
:mod:`matplotlib.pyplot` is a collection of functions that make
8-
matplotlib work like matlab. Each ``pyplot`` function makes some
9-
change to a figure: eg, create a figure, create a plotting area in a
10-
figure, plot some lines in a plotting area, decorate the plot with
11-
labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it
7+
:mod:`matplotlib.pyplot` is a collection of command style functions
8+
that make matplotlib work like matlab. Each ``pyplot`` function makes
9+
some change to a figure: eg, create a figure, create a plotting area
10+
in a figure, plot some lines in a plotting area, decorate the plot
11+
with labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it
1212
keeps track of the current figure and plotting area, and the plotting
1313
functions are directed to the current axes
1414

1515
.. literalinclude:: figures/pyplot_simple.py
1616

1717
.. image:: figures/pyplot_simple.png
18-
:scale: 50
18+
:scale: 75
1919

2020

2121
You may be wondering why the x-axis ranges from 0-3 and the y-axis
@@ -42,7 +42,7 @@ example, to plot the above with red circles, you would issue
4242
.. literalinclude:: figures/pyplot_formatstr.py
4343

4444
.. image:: figures/pyplot_formatstr.png
45-
:scale: 50
45+
:scale: 75
4646

4747
See the :func:`~matplotlib.pyplot.plot` documentation for a complete
4848
list of line styles and format strings. The
@@ -60,9 +60,7 @@ using arrays.
6060
.. literalinclude:: figures/pyplot_three.py
6161

6262
.. image:: figures/pyplot_three.png
63-
:scale: 50
64-
65-
63+
:scale: 75
6664

6765
.. _controlling-line-properties:
6866

@@ -169,7 +167,7 @@ scenes. Below is an script to create two subplots.
169167
.. literalinclude:: figures/pyplot_two_subplots.py
170168

171169
.. image:: figures/pyplot_two_subplots.png
172-
:scale: 50
170+
:scale: 75
173171

174172
The :func:`~matplotlib.pyplot.figure` command here is optional because
175173
``figure(1)`` will be created by default, just as a ``subplot(111)``
@@ -230,7 +228,7 @@ for a more detailed example)
230228
.. literalinclude:: figures/pyplot_text.py
231229

232230
.. image:: figures/pyplot_text.png
233-
:scale: 50
231+
:scale: 75
234232

235233

236234
All of the :func:`~matplotlib.pyplot.text` commands return an
@@ -278,7 +276,7 @@ these arguments are ``(x,y)`` tuples.
278276
.. literalinclude:: figures/pyplot_annotate.py
279277

280278
.. image:: figures/pyplot_annotate.png
281-
:scale: 50
279+
:scale: 75
282280

283281
In this basic example, both the ``xy`` (arrow tip) and ``xytext``
284282
locations (text location) are in data coordinates. There are a

doc/users/text_intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ these commands in action.
5858
.. literalinclude:: figures/text_commands.py
5959

6060
.. image:: figures/text_commands.png
61-
:scale: 50
61+
:scale: 75
6262

doc/users/text_props.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ upper right.
6060
.. literalinclude:: figures/text_layout.py
6161

6262
.. image:: figures/text_layout.png
63-
:scale: 50
63+
:scale: 75

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ class Event:
640640
``canvas``
641641
the FigureCanvas instance generating the event
642642
643+
``guiEvent``
644+
the GUI event that triggered the matplotlib event
645+
646+
643647
"""
644648
def __init__(self, name, canvas,guiEvent=None):
645649
self.name = name

0 commit comments

Comments
 (0)