From: <jd...@us...> - 2008-06-10 22:49:05
|
Revision: 5465 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5465&view=rev Author: jdh2358 Date: 2008-06-10 15:49:02 -0700 (Tue, 10 Jun 2008) Log Message: ----------- some tweaks to image size and backend docs Modified Paths: -------------- trunk/matplotlib/doc/devel/outline.rst trunk/matplotlib/doc/users/annotations.rst trunk/matplotlib/doc/users/event_handling.rst trunk/matplotlib/doc/users/figures/make.py trunk/matplotlib/doc/users/figures/pyplot_simple.py trunk/matplotlib/doc/users/mathtext.rst trunk/matplotlib/doc/users/pyplot_tutorial.rst trunk/matplotlib/doc/users/text_intro.rst trunk/matplotlib/doc/users/text_props.rst trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/backends/backend_template.py Modified: trunk/matplotlib/doc/devel/outline.rst =================================================================== --- trunk/matplotlib/doc/devel/outline.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/devel/outline.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -103,20 +103,20 @@ submission, you can put them here. As the author cleans them up or addresses them, they should be removed. -mathtext user's guide-- reviewd by JDH --------------------------------------- +mathtext user's guide-- reviewed by JDH +--------------------------------------- This looks good (see :ref:`mathtext-tutorial`) -- there are a few -minor things to close the book on this chapter. +minor things to close the book on this chapter: #. The main thing to wrap this up is getting the mathtext module -ported over to rest and included in the API so the links from the -user's guide tutorial work. + ported over to rest and included in the API so the links from the + user's guide tutorial work. #. This section might also benefit from a little more detail on the -customizations that are possible (eg an example fleshing out the rc -options a little bit). Admittedly, this is pretty clear from readin -ghte rc file, but it might be helpful to a newbie. + customizations that are possible (eg an example fleshing out the rc + options a little bit). Admittedly, this is pretty clear from + readin ghte rc file, but it might be helpful to a newbie. #. There is still a TODO in the file to include a complete list of symbols Modified: trunk/matplotlib/doc/users/annotations.rst =================================================================== --- trunk/matplotlib/doc/users/annotations.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/annotations.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -15,7 +15,7 @@ .. literalinclude:: figures/annotation_basic.py .. image:: figures/annotation_basic.png - :scale: 50 + :scale: 75 In this example, both the ``xy`` (arrow tip) and ``xytext`` locations (text location) are in data coordinates. There are a variety of other @@ -76,7 +76,7 @@ .. literalinclude:: figures/annotation_polar.py .. image:: figures/annotation_polar.png - :scale: 50 + :scale: 75 See the `annotations demo <http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.py>`_ for more Modified: trunk/matplotlib/doc/users/event_handling.rst =================================================================== --- trunk/matplotlib/doc/users/event_handling.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/event_handling.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -70,16 +70,18 @@ ================ All matplotlib events inherit from the base class -:class:`matplotlib.backend_bases.Event`, which store the attributes +:class:`matplotlib.backend_bases.Event`, which store the attributes: -=============== ================================================= -Event attribute Description -=============== ================================================= -``name`` the event name -``canvas`` the FigureCanvas instance generating the event -``guiEvent`` the GUI event that triggered the matplotlib event -=============== ================================================= + ``name`` + the event name + ``canvas`` + the FigureCanvas instance generating the event + + ``guiEvent`` + the GUI event that triggered the matplotlib event + + The most common events that are the bread and butter of event handling are key press/release events and mouse press/release and movement events. The :class:`~matplotlib.backend_bases.KeyEvent` and @@ -87,17 +89,21 @@ these events are both derived from the LocationEvent, which has the following attributes -======================= ======================================== -LocationEvent attribute Description -======================= ======================================== -``x`` x position - pixels from left of canvas -``y`` y position - pixels from right of canvas -``button`` button pressed None, 1, 2, 3 -``inaxes`` the Axes instance if mouse us over axes -``xdata`` x coord of mouse in data coords -``ydata`` y coord of mouse in data coords -======================= ======================================== + ``x`` + x position - pixels from left of canvas + ``y`` + y position - pixels from bottom of canvas + + ``inaxes`` + the :class:`~matplotlib.axes.Axes` instance if mouse is over axes + + ``xdata`` + x coord of mouse in data coords + + ``ydata`` + y coord of mouse in data coords + Let's look a simple example of a canvas, where a simple line segment is created every time a mouse is pressed:: @@ -129,13 +135,12 @@ the data and pixel coordinates in event.x and event.xdata. In addition to the ``LocationEvent`` attributes, it has -==================== ============================================================== -MouseEvent attribute Description -==================== ============================================================== -``button`` button pressed None, 1, 2, 3 -``key`` the key pressed: None, chr(range(255)), shift, win, or control -==================== ============================================================== + ``button`` + button pressed None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events) + ``key`` + the key pressed: None, chr(range(255), 'shift', 'win', or 'control' + Draggable Rectangle Exercise ---------------------------- @@ -281,7 +286,6 @@ self.rect.set_x(x0+dx) self.rect.set_y(y0+dy) - canvas = self.rect.figure.canvas axes = self.rect.axes # restore the background region @@ -293,8 +297,6 @@ # blit just the redrawn area canvas.blit(axes.bbox) - - def on_release(self, event): 'on release we reset the press data' if DraggableRectangle.lock is not self: @@ -309,6 +311,7 @@ # redraw the full figure self.rect.figure.canvas.draw() + def disconnect(self): 'disconnect all the stored connection ids' self.rect.figure.canvas.mpl_disconnect(self.cidpress) @@ -340,24 +343,29 @@ There are a variety of meanings of the ``picker`` property: -- ``None`` : picking is disabled for this artist (default) + ``None`` + picking is disabled for this artist (default) -- ``boolean`` : if True then picking will be enabled and the artist will - fire a pick event if the mouse event is over the artist + ``boolean`` + if True then picking will be enabled and the artist will fire a + pick event if the mouse event is over the artist -- ``float`` : if picker is a number it is interpreted as an epsilon - tolerance in points and the the artist will fire off an event if its - data is within epsilon of the mouse event. For some artists like - lines and patch collections, the artist may provide additional data - to the pick event that is generated, eg the indices of the data - within epsilon of the pick event. + ``float`` + if picker is a number it is interpreted as an epsilon tolerance in + points and the the artist will fire off an event if its data is + within epsilon of the mouse event. For some artists like lines + and patch collections, the artist may provide additional data to + the pick event that is generated, eg the indices of the data + within epsilon of the pick event. -- ``function`` : if picker is callable, it is a user supplied function - which determines whether the artist is hit by the mouse event. The - signature is ``hit, props = picker(artist, mouseevent)`` to - determine the hit test. If the mouse event is over the artist, - return ``hit=True`` and props is a dictionary of properties you want - added to the :class:`~matplotlib.backend_bases.PickEvent` attributes + ``function`` + if picker is callable, it is a user supplied function which + determines whether the artist is hit by the mouse event. The + signature is ``hit, props = picker(artist, mouseevent)`` to + determine the hit test. If the mouse event is over the artist, + return ``hit=True`` and props is a dictionary of properties you + want added to the :class:`~matplotlib.backend_bases.PickEvent` + attributes After you have enabled an artist for picking by setting the ``picker`` @@ -373,16 +381,18 @@ The :class:`~matplotlib.backend_bases.PickEvent` which is passed to your callback is always fired with two attributes: -- ``mouseevent`` : the mouse event that generate the pick event. The - mouse event in turn has attributes like ``x`` and ``y`` (the coords in - display space, eg pixels from left, bottom) and xdata, ydata (the - coords in data space). Additionally, you can get information about - which buttons were pressed, which keys were pressed, which Axes the - mouse is over, etc. See :class:`matplotlib.backend_bases.MouseEvent` for - details. + ``mouseevent`` the mouse event that generate the pick event. The + mouse event in turn has attributes like ``x`` and ``y`` (the + coords in display space, eg pixels from left, bottom) and xdata, + ydata (the coords in data space). Additionally, you can get + information about which buttons were pressed, which keys were + pressed, which :class:`~matplotlib.axes.Axes` the mouse is over, + etc. See :class:`matplotlib.backend_bases.MouseEvent` for + details. -- ``artist`` : the :class:`matplotlib.artist.Artist` that generated - the pick event. + ``artist`` + the :class:`~matplotlib.artist.Artist` that generated the pick + event. Additionally, certain artists like :class:`~matplotlib.lines.Line2D` and :class:`~matplotlib.collections.PatchCollection` may attach Modified: trunk/matplotlib/doc/users/figures/make.py =================================================================== --- trunk/matplotlib/doc/users/figures/make.py 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/figures/make.py 2008-06-10 22:49:02 UTC (rev 5465) @@ -2,7 +2,7 @@ import sys, os, glob import matplotlib import IPython.Shell -matplotlib.rcdefaults() +#matplotlib.rcdefaults() matplotlib.use('Agg') mplshell = IPython.Shell.MatplotlibShell('mpl') Modified: trunk/matplotlib/doc/users/figures/pyplot_simple.py =================================================================== --- trunk/matplotlib/doc/users/figures/pyplot_simple.py 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/figures/pyplot_simple.py 2008-06-10 22:49:02 UTC (rev 5465) @@ -1,4 +1,4 @@ import matplotlib.pyplot as plt plt.plot([1,2,3]) plt.ylabel('some numbers') - +plt.show() Modified: trunk/matplotlib/doc/users/mathtext.rst =================================================================== --- trunk/matplotlib/doc/users/mathtext.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/mathtext.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -233,7 +233,7 @@ .. literalinclude:: figures/pyplot_mathtext.py .. image:: figures/pyplot_mathtext.png - :scale: 50 + :scale: 75 Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst =================================================================== --- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -4,18 +4,18 @@ pyplot tutorial *************** -:mod:`matplotlib.pyplot` is a collection of functions that make -matplotlib work like matlab. Each ``pyplot`` function makes some -change to a figure: eg, create a figure, create a plotting area in a -figure, plot some lines in a plotting area, decorate the plot with -labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it +:mod:`matplotlib.pyplot` is a collection of command style functions +that make matplotlib work like matlab. Each ``pyplot`` function makes +some change to a figure: eg, create a figure, create a plotting area +in a figure, plot some lines in a plotting area, decorate the plot +with labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it keeps track of the current figure and plotting area, and the plotting functions are directed to the current axes .. literalinclude:: figures/pyplot_simple.py .. image:: figures/pyplot_simple.png - :scale: 50 + :scale: 75 You may be wondering why the x-axis ranges from 0-3 and the y-axis @@ -42,7 +42,7 @@ .. literalinclude:: figures/pyplot_formatstr.py .. image:: figures/pyplot_formatstr.png - :scale: 50 + :scale: 75 See the :func:`~matplotlib.pyplot.plot` documentation for a complete list of line styles and format strings. The @@ -60,10 +60,8 @@ .. literalinclude:: figures/pyplot_three.py .. image:: figures/pyplot_three.png - :scale: 50 + :scale: 75 - - .. _controlling-line-properties: Controlling line properties @@ -169,7 +167,7 @@ .. literalinclude:: figures/pyplot_two_subplots.py .. image:: figures/pyplot_two_subplots.png - :scale: 50 + :scale: 75 The :func:`~matplotlib.pyplot.figure` command here is optional because ``figure(1)`` will be created by default, just as a ``subplot(111)`` @@ -230,7 +228,7 @@ .. literalinclude:: figures/pyplot_text.py .. image:: figures/pyplot_text.png - :scale: 50 + :scale: 75 All of the :func:`~matplotlib.pyplot.text` commands return an @@ -278,7 +276,7 @@ .. literalinclude:: figures/pyplot_annotate.py .. image:: figures/pyplot_annotate.png - :scale: 50 + :scale: 75 In this basic example, both the ``xy`` (arrow tip) and ``xytext`` locations (text location) are in data coordinates. There are a Modified: trunk/matplotlib/doc/users/text_intro.rst =================================================================== --- trunk/matplotlib/doc/users/text_intro.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/text_intro.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -58,5 +58,5 @@ .. literalinclude:: figures/text_commands.py .. image:: figures/text_commands.png - :scale: 50 + :scale: 75 Modified: trunk/matplotlib/doc/users/text_props.rst =================================================================== --- trunk/matplotlib/doc/users/text_props.rst 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/doc/users/text_props.rst 2008-06-10 22:49:02 UTC (rev 5465) @@ -60,4 +60,4 @@ .. literalinclude:: figures/text_layout.py .. image:: figures/text_layout.png - :scale: 50 + :scale: 75 Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-06-10 22:49:02 UTC (rev 5465) @@ -640,6 +640,10 @@ ``canvas`` the FigureCanvas instance generating the event + ``guiEvent`` + the GUI event that triggered the matplotlib event + + """ def __init__(self, name, canvas,guiEvent=None): self.name = name Modified: trunk/matplotlib/lib/matplotlib/backends/backend_template.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_template.py 2008-06-10 18:36:33 UTC (rev 5464) +++ trunk/matplotlib/lib/matplotlib/backends/backend_template.py 2008-06-10 22:49:02 UTC (rev 5465) @@ -1,4 +1,4 @@ -""" +M""" This is a fully functional do nothing backend to provide a template to backend writers. It is fully functional in that you can select it as a backend with This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |