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

Skip to content

Commit c05a3ea

Browse files
committed
more screenshot updates
svn path=/trunk/matplotlib/; revision=6203
1 parent 199f960 commit c05a3ea

19 files changed

Lines changed: 259 additions & 106 deletions

File tree

doc/_static/eeg_large.png

653 KB
Loading

doc/_static/eeg_small.png

435 KB
Loading

doc/_templates/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ <h1>Welcome</h1>
2222

2323
For the power user, you have full control of line styles, font
2424
properties, axes properties, etc, via an object oriented interface
25-
or via a handle graphics interface familiar to matlab users. A
26-
summary of the goals of matplotlib and the progress so far can be
27-
found <a href=goals.html>here</a>.<p>
25+
or via a handle graphics interface familiar to matlab users.
2826

29-
The plotting functions in the <a href=api/pyplot_api.html>pyplot
30-
interface</a> have a high degree of Matlab&reg compatibility.<p>
27+
The plotting functions in the <a href=api/pyplot_api.html>pyplot</a>
28+
interface have a high degree of Matlab&reg compatibility.<p>
3129

3230
<br>
3331
<table border=1 cellpadding=3 cellspacing=2>

doc/devel/documenting_mpl.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,26 @@ since it is probably better to choose the correct figure size and dpi
229229
in mpl and let it handle the scaling. ``:include-source:`` will
230230
present the contents of the file, marked up as source code.
231231

232+
You can also point to local files with relative path. Use the
233+
sym-link for mpl_examples in case we do a reorganization of the doc
234+
directory at some point, eg::
235+
236+
.. plot:: ../mpl_examples/pylab_examples/simple_plot.py
237+
238+
If the example file needs to access data, it is easy to get screwed up
239+
with relative paths since the python example may be run from a diffent
240+
location in the plot directive build framework. To work around this,
241+
you can add your example data to mpl-data/example and refer to it in
242+
the example file like so::
243+
244+
import matplotlib
245+
# datafile is a file object
246+
datafile = matplotlib.get_example_data('goog.npy')
247+
r = np.load(datafile).view(np.recarray)
248+
249+
Try to keep the example datafiles relatively few and relatively small
250+
to control the size of the binaries we ship.
251+
232252
Static figures
233253
--------------
234254

doc/pyplots/plotmap.hires.png

-331 KB
Loading

doc/pyplots/plotmap.pdf

-86.2 KB
Binary file not shown.

doc/pyplots/plotmap.png

-125 KB
Loading

doc/pyplots/plotmap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
3232
topodat,x,y = m.transform_scalar(topoin,lons,lats,nx,ny,returnxy=True)
3333
# create the figure.
34-
fig=figure(figsize=(8,8))
34+
fig=figure(figsize=(6,6))
3535
# add an axes, leaving room for colorbar on the right.
3636
ax = fig.add_axes([0.1,0.1,0.7,0.7])
3737
# plot image over map with imshow.
@@ -46,8 +46,8 @@
4646
colorbar(cax=cax) # draw colorbar
4747
axes(ax) # make the original axes current again
4848
# plot blue dot on boulder, colorado and label it as such.
49-
xpt,ypt = m(-104.237,40.125)
50-
m.plot([xpt],[ypt],'bo')
49+
xpt,ypt = m(-104.237,40.125)
50+
m.plot([xpt],[ypt],'bo')
5151
text(xpt+100000,ypt+100000,'Boulder')
5252
# draw coastlines and political boundaries.
5353
m.drawcoastlines()

doc/users/screenshots.rst

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Bar charts
6868

6969
The :func:`~matplotlib.pyplot.bar`
7070
command takes error bars as an optional argument. You can also use up
71-
and down bars, stacked bars, candlestic' bars, etc, ... See
71+
and down bars, stacked bars, candlestick bars, etc, ... See
7272
`bar_stacked.py <examples/pylab_examples/bar_stacked.py>`_ for another example.
7373
You can make horizontal bar charts with the
7474
:func:`~matplotlib.pyplot.barh` command.
@@ -83,7 +83,7 @@ Pie charts
8383

8484
The :func:`~matplotlib.pyplot.pie` command
8585
uses a matlab(TM) compatible syntax to produce py charts. Optional
86-
features include auto-labeling the percentage of area, "exploding" one
86+
features include auto-labeling the percentage of area, exploding one
8787
or more wedges out from the center of the pie, and a shadow effect.
8888
Take a close look at the attached code that produced this figure; nine
8989
lines of code.
@@ -108,7 +108,7 @@ Scatter demo
108108

109109
The :func:`~matplotlib.pyplot.scatter` command makes a scatter plot
110110
with (optional) size and color arguments. This example plots changes
111-
in Intel's stock price from one day to the next with the sizes coding
111+
in Google stock price from one day to the next with the sizes coding
112112
trading volume and the colors coding price change in day i. Here the
113113
alpha attribute is used to make semitransparent circle markers with
114114
the Agg backend (see :ref:`what-is-a-backend`)
@@ -150,21 +150,21 @@ You can plot date data with major and minor ticks and custom tick
150150
formatters for both the major and minor ticks; see matplotlib.ticker
151151
and matplotlib.dates for details and usage.
152152

153-
todoplot:: ../mpl_examples/api/date_demo.py
153+
plot:: ../mpl_examples/api/date_demo.py
154154

155155
.. _screenshots_jdh_demo:
156156

157157
Financial charts
158158
================
159159

160160
You can make much more sophisticated financial plots. This example
161-
emulates one of the `ChartDirector`<http://www.advsofteng.com/gallery_finance.html>
161+
emulates one of the `ChartDirector <http://www.advsofteng.com/gallery_finance.html>`
162162
financial plots. Some of the data in the plot, are real financial
163163
data, some are random traces that I used since the goal was to
164164
illustrate plotting techniques, not market analysis!
165165

166166

167-
todoplot:: ../mpl_examples/pylab_examples/finance_work2.py
167+
plot:: ../mpl_examples/pylab_examples/finance_work2.py
168168

169169

170170
.. _screenshots_basemap_demo:
@@ -182,4 +182,89 @@ stereographic. See the `tutorial
182182

183183
.. plot:: plotmap.py
184184

185+
.. _screenshots_log_demo:
186+
187+
Log plots
188+
=========
189+
190+
The :func:`~matplotlib.pyplot.semilogx`,
191+
:func:`~matplotlib.pyplot.semilogy` and
192+
:func:`~matplotlib.pyplot.loglog` functions generate log scaling on the
193+
respective axes. The lower subplot uses a base10 log on the xaxis and
194+
a base 4 log on the yaxis. Thanks to Andrew Straw, Darren Dale and
195+
Gregory Lielens for contributions to the log scaling
196+
infrastructure.
197+
198+
199+
200+
plot:: ../mpl_examples/pylab_examples/log_demo.py
201+
202+
.. _screenshots_polar_demo:
203+
204+
Polar plots
205+
===========
206+
207+
The :func:`~matplotlib.pyplot.polar` command generates polar plots.
208+
209+
plot:: ../mpl_examples/pylab_examples/polar_demo.py
210+
211+
.. _screenshots_legend_demo:
212+
213+
Legends
214+
=======
215+
216+
The :func:`~matplotlib.pyplot.legend` command automatically
217+
generates figure legends, with Matlab compatible legend placement
218+
commands. Thanks to Charles Twardy for input on the legend
219+
command
220+
221+
plot:: ../mpl_examples/pylab_examples/legend_demo.py
222+
223+
.. _screenshots_mathtext_examples_demo:
224+
225+
Mathtext_examples
226+
=================
227+
228+
A sampling of the many TeX expressions now supported by matplotlib's
229+
internal mathtext engine. The mathtext module provides TeX style
230+
mathematical expressions using freetype2 and the BaKoMa computer
231+
modern or STIX fonts. See the matplotlib.mathtext module for
232+
additional. matplotlib mathtext is an independent implementation, and
233+
does not required TeX or any external packages installed on your
234+
computer.
235+
236+
plot:: ../mpl_examples/pylab_examples/mathtext_examples.py
237+
238+
.. _screenshots_tex_demo:
239+
240+
Native TeX rendering
241+
====================
242+
243+
Although matplotlib's internal math rendering engine is quite
244+
powerful, sometimes you need TeX, and matplotlib supports external TeX
245+
rendering of strings with the *usetex* option.
246+
247+
plot:: tex_demo.py
248+
249+
.. _screenshots_eeg_demo:
250+
251+
=========
252+
253+
You can embed matplotlib into pygtk, wxpython, Tk, FLTK or Qt
254+
applications. Here is a screenshot of an eeg viewer called pbrain
255+
which is part of the NeuroImaging in Python suite `NIPY
256+
<http://neuroimaging.scipy.org>`. Pbrain is written in pygtk using
257+
matplotlib. The lower axes uses :func:`~matplotlib.pyplot.specgram`
258+
to plot the spectrogram of one of the EEG channels. The code demo
259+
linked above is a much simpler example of embedding matplotlib in
260+
pygtk. For an example of how to use the navigation toolbar in your
261+
applications, see examples/user_interfaces/embedding_in_gtk2.py. If
262+
you want to use matplotlib in a wx application, see
263+
examples/user_interfaces/embedding_in_wx2.py. If you want to work
264+
with `glade <http://glade.gnome.org>`_, see
265+
examples/user_interfaces/mpl_with_glade.py
266+
267+
.. image:: ../_static/eeg_small.png
268+
269+
185270

examples/api/date_demo.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
and num2date
1212
1313
"""
14-
1514
import datetime
15+
import numpy as np
16+
import matplotlib
1617
import matplotlib.pyplot as plt
1718
import matplotlib.dates as mdates
1819
import matplotlib.mlab as mlab
@@ -21,18 +22,26 @@
2122
months = mdates.MonthLocator() # every month
2223
yearsFmt = mdates.DateFormatter('%Y')
2324

24-
r = mlab.csv2rec('../data/goog.csv')
25-
r.sort()
25+
# load a numpy record array from yahoo csv data with fields date,
26+
# open, close, volume, adj_close from the mpl-data/example directory.
27+
# The record array stores python datetime.date as an object array in
28+
# the date column
29+
datafile = matplotlib.get_example_data('goog.npy')
30+
r = np.load(datafile).view(np.recarray)
2631

2732
fig = plt.figure()
2833
ax = fig.add_subplot(111)
2934
ax.plot(r.date, r.adj_close)
3035

36+
3137
# format the ticks
3238
ax.xaxis.set_major_locator(years)
3339
ax.xaxis.set_major_formatter(yearsFmt)
3440
ax.xaxis.set_minor_locator(months)
35-
ax.autoscale_view()
41+
42+
datemin = datetime.date(r.date.min().year, 1, 1)
43+
datemax = datetime.date(r.date.max().year+1, 1, 1)
44+
ax.set_xlim(datemin, datemax)
3645

3746
# format the coords message box
3847
def price(x): return '$%1.2f'%x

0 commit comments

Comments
 (0)