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

Skip to content

Commit 0ecfb47

Browse files
committed
update whats new
svn path=/branches/v0_99_maint/; revision=7400
1 parent 48df6e7 commit 0ecfb47

4 files changed

Lines changed: 149 additions & 4 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
from mpl_toolkits.axes_grid.axes_rgb import RGBAxes
4+
5+
def get_demo_image():
6+
# prepare image
7+
delta = 0.5
8+
9+
extent = (-3,4,-4,3)
10+
x = np.arange(-3.0, 4.001, delta)
11+
y = np.arange(-4.0, 3.001, delta)
12+
X, Y = np.meshgrid(x, y)
13+
import matplotlib.mlab as mlab
14+
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
15+
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
16+
Z = (Z1 - Z2) * 10
17+
18+
return Z, extent
19+
20+
21+
22+
def get_rgb():
23+
Z, extent = get_demo_image()
24+
25+
Z[Z<0] = 0.
26+
Z = Z/Z.max()
27+
28+
R = Z[:13,:13]
29+
G = Z[2:,2:]
30+
B = Z[:13,2:]
31+
32+
return R, G, B
33+
34+
35+
fig = plt.figure(1)
36+
ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])
37+
38+
r, g, b = get_rgb()
39+
kwargs = dict(origin="lower", interpolation="nearest")
40+
ax.imshow_rgb(r, g, b, **kwargs)
41+
42+
ax.RGB.set_xlim(0., 9.5)
43+
ax.RGB.set_ylim(0.9, 10.6)
44+
45+
46+
plt.draw()
47+
plt.show()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from mpl_toolkits.mplot3d import Axes3D
2+
from matplotlib import cm
3+
import pylab
4+
import random
5+
import numpy as np
6+
7+
fig = pylab.figure()
8+
ax = Axes3D(fig)
9+
X = np.arange(-5, 5, 0.25)
10+
Y = np.arange(-5, 5, 0.25)
11+
X, Y = np.meshgrid(X, Y)
12+
R = np.sqrt(X**2 + Y**2)
13+
Z = np.sin(R)
14+
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
15+
16+
pylab.show()
17+

doc/pyplots/whats_new_99_spines.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
from matplotlib.pyplot import show
4+
5+
6+
def adjust_spines(ax,spines):
7+
for loc, spine in ax.spines.iteritems():
8+
if loc in spines:
9+
spine.set_position(('outward',10)) # outward by 10 points
10+
else:
11+
spine.set_color('none') # don't draw spine
12+
13+
# turn off ticks where there is no spine
14+
if 'left' in spines:
15+
ax.yaxis.set_ticks_position('left')
16+
else:
17+
# no yaxis ticks
18+
ax.yaxis.set_ticks([])
19+
20+
if 'bottom' in spines:
21+
ax.xaxis.set_ticks_position('bottom')
22+
else:
23+
# no xaxis ticks
24+
ax.xaxis.set_ticks([])
25+
26+
fig = plt.figure()
27+
28+
x = np.linspace(0,2*np.pi,100)
29+
y = 2*np.sin(x)
30+
31+
ax = fig.add_subplot(2,2,1)
32+
ax.plot(x,y)
33+
adjust_spines(ax,['left'])
34+
35+
ax = fig.add_subplot(2,2,2)
36+
ax.plot(x,y)
37+
adjust_spines(ax,[])
38+
39+
ax = fig.add_subplot(2,2,3)
40+
ax.plot(x,y)
41+
adjust_spines(ax,['left','bottom'])
42+
43+
ax = fig.add_subplot(2,2,4)
44+
ax.plot(x,y)
45+
adjust_spines(ax,['bottom'])
46+
47+
show()

doc/users/whats_new.rst

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,57 @@ What's new in matplotlib
66

77
.. _whats-new-svn:
88

9-
What new in svn
10-
===============
9+
What new in matplotlib-0.99
10+
=============================
11+
12+
.. _whats-new-mplot3d:
13+
14+
mplot3d
15+
--------
16+
17+
18+
Reinier Heeres has ported John Porter's mplot3d over to the new
19+
matplotlib transformations framework, and it is now available as a
20+
toolkit mpl_toolkits.mplot3d. See the `examples
21+
<http://matplotlib.sourceforge.net/examples/mplot3d/index.html>`_ and
22+
:ref:`toolkit_mplot3d-tutorial`
23+
24+
.. plot:: pyplots/whats_new_mplot3d.py
25+
26+
.. _whats-new-axes-grid:
27+
28+
axes grid toolkit
29+
-----------------
30+
31+
Jae Joon has added a new toolkit to ease displaying multiple images in
32+
matplotlib, as well as some support for curvilinear grids to support
33+
the world coordinate system. See :ref:`axes_grid_users-guide-index`
34+
and `examples <http://matplotlib.sourceforge.net/examples/axes_grid/index.html>`_
35+
36+
.. plot:: pyplots/whats_new_axes_grid.py
37+
38+
.. _whats-new-spine:
1139

1240
Axis spine placement
1341
--------------------
1442

1543
Andrew Straw has added the ability to place "axis spines" -- the lines
16-
that denote the data limits -- in various arbitrary locations. See
44+
that denote the data limits -- in various arbitrary locations. No
45+
longer are your axis lines constrained to be a simple rectangle around
46+
the figure -- you can turn on or off left, bottom, right and top, as
47+
well as "detach" the spine to offset it away from the data. See
48+
:ref:`pylab_examples-spine_placement_demo` and
1749
:class:`matplotlib.spines.Spine`.
1850

51+
.. plot:: pyplots/whats_new_99_spines.py
52+
1953
.. _whats-new-0-98-4:
2054

2155
What new in 0.98.4
2256
==============================
2357

2458
It's been four months since the last matplotlib release, and there are
25-
a lot of new features and bug-fixes.
59+
a lot of new features and bug-fixes.
2660

2761
Thanks to Charlie Moad for testing and preparing the source release,
2862
including binaries for OS X and Windows for python 2.4 and 2.5 (2.6

0 commit comments

Comments
 (0)