X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions doc/api/api_changes/code_removal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ The ``GraphicsContextBase.set_graylevel``, ``FigureCanvasBase.onHilite`` and
``mpl_toolkits.axes_grid1.mpl_axes.Axes.toggle_axisline`` methods have been
removed.

The ``ArtistInspector.findobj`` method, which was never working due to the lack
of a ``get_children`` method, has been removed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what was lacking get_children?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The ArtistInspector class.



`Axes.set_aspect("normal")`
---------------------------
Expand Down
8 changes: 3 additions & 5 deletions examples/api/custom_projection_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def __init__(self, round_to=1.0):
self._round_to = round_to

def __call__(self, x, pos=None):
degrees = (x / np.pi) * 180.0
degrees = np.round(degrees / self._round_to) * self._round_to
degrees = np.round(np.rad2deg(x) / self._round_to) * self._round_to
if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
return r"$%0.0f^\circ$" % degrees
else:
Expand Down Expand Up @@ -278,8 +277,7 @@ def format_coord(self, lon, lat):

In this case, we want them to be displayed in degrees N/S/E/W.
"""
lon = lon * (180.0 / np.pi)
lat = lat * (180.0 / np.pi)
lon, lat = np.rad2deg([lon, lat])
if lat >= 0.0:
ns = 'N'
else:
Expand Down Expand Up @@ -330,7 +328,7 @@ def set_longitude_grid_ends(self, degrees):
class -- it provides an interface to something that has no
analogy in the base Axes class.
"""
self._longitude_cap = degrees * (np.pi / 180.0)
self._longitude_cap = np.deg2rad(degrees)
self._xaxis_pretransform \
.clear() \
.scale(1.0, self._longitude_cap * 2.0) \
Expand Down
4 changes: 2 additions & 2 deletions examples/mplot3d/pathpatch3d_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):
text3d(ax, (4, -2, 0), "X-axis", zdir="z", size=.5, usetex=False,
ec="none", fc="k")
text3d(ax, (12, 4, 0), "Y-axis", zdir="z", size=.5, usetex=False,
angle=.5*3.14159, ec="none", fc="k")
angle=np.pi / 2, ec="none", fc="k")
text3d(ax, (12, 10, 4), "Z-axis", zdir="y", size=.5, usetex=False,
angle=.5*3.14159, ec="none", fc="k")
angle=np.pi / 2, ec="none", fc="k")

# Write a Latex formula on the z=0 'floor'
text3d(ax, (1, 5, 0),
Expand Down
10 changes: 5 additions & 5 deletions examples/pylab_examples/leftventricle_bulleye.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):

# Create the bounds for the segments 1-12
for i in range(6):
theta_i = i*60*np.pi/180
theta_i = np.deg2rad(i * 60)
ax.plot([theta_i, theta_i], [r[1], 1], '-k', lw=linewidth)

# Create the bounds for the segmentss 13-16
for i in range(4):
theta_i = i*90*np.pi/180 - 45*np.pi/180
theta_i = np.deg2rad(i * 90 - 45)
ax.plot([theta_i, theta_i], [r[0], r[1]], '-k', lw=linewidth)

# Fill the segments 1-6
r0 = r[2:4]
r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T
for i in range(6):
# First segment start at 60 degrees
theta0 = theta[i*128:i*128+128] + 60*np.pi/180
theta0 = theta[i*128:i*128+128] + np.deg2rad(60)
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
z = np.ones((128, 2))*data[i]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
Expand All @@ -86,7 +86,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
r0 = np.repeat(r0[:, np.newaxis], 128, axis=1).T
for i in range(6):
# First segment start at 60 degrees
theta0 = theta[i*128:i*128+128] + 60*np.pi/180
theta0 = theta[i*128:i*128+128] + np.deg2rad(60)
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
z = np.ones((128, 2))*data[i+6]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
Expand All @@ -100,7 +100,7 @@ def bullseye_plot(ax, data, segBold=None, cmap=None, norm=None):
r0 = np.repeat(r0[:, np.newaxis], 192, axis=1).T
for i in range(4):
# First segment start at 45 degrees
theta0 = theta[i*192:i*192+192] + 45*np.pi/180
theta0 = theta[i*192:i*192+192] + np.deg2rad(45)
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
z = np.ones((192, 2))*data[i+12]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
Expand Down
3 changes: 1 addition & 2 deletions examples/pylab_examples/tripcolor_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
[-0.057, 0.881], [-0.062, 0.876], [-0.078, 0.876], [-0.087, 0.872],
[-0.030, 0.907], [-0.007, 0.905], [-0.057, 0.916], [-0.025, 0.933],
[-0.077, 0.990], [-0.059, 0.993]])
x = xy[:, 0]*180/3.14159
y = xy[:, 1]*180/3.14159
x, y = np.rad2deg(xy).T

triangles = np.asarray([
[67, 66, 1], [65, 2, 66], [ 1, 66, 2], [64, 2, 65], [63, 3, 64],
Expand Down
11 changes: 5 additions & 6 deletions examples/units/basic_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ def __init__(self, fn_name, obj):

def __call__(self, *args):
ret = PassThroughProxy.__call__(self, *args)
if (type(ret) == type(NotImplemented)):
return NotImplemented
return TaggedValue(ret, self.unit)
return (NotImplemented if ret is NotImplemented
else TaggedValue(ret, self.unit))


class ConvertAllProxy(PassThroughProxy):
Expand Down Expand Up @@ -95,10 +94,10 @@ def __call__(self, *args):
arg_units.append(None)
converted_args = tuple(converted_args)
ret = PassThroughProxy.__call__(self, *converted_args)
if (type(ret) == type(NotImplemented)):
if ret is NotImplemented:
return NotImplemented
ret_unit = unit_resolver(self.fn_name, arg_units)
if (ret_unit == NotImplemented):
if ret_unit is NotImplemented:
return NotImplemented
return TaggedValue(ret, ret_unit)

Expand Down Expand Up @@ -216,7 +215,7 @@ def __mul__(self, rhs):
value = rhs.get_value()
unit = rhs.get_unit()
unit = unit_resolver('__mul__', (self, unit))
if (unit == NotImplemented):
if unit is NotImplemented:
return NotImplemented
return TaggedValue(value, unit)

Expand Down
2 changes: 1 addition & 1 deletion examples/units/ellipse_with_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
width, height = 1e-1*cm, 3e-1*cm
angle = -30

theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0
theta = np.deg2rad(np.arange(0.0, 360.0, 1.0))
x = 0.5 * width * np.cos(theta)
y = 0.5 * height * np.sin(theta)

Expand Down
2 changes: 1 addition & 1 deletion examples/user_interfaces/embedding_in_tk_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def draw_figure(canvas, figure, loc=(0, 0)):
canvas.pack()

# Generate some example data
X = np.linspace(0, 2.0*3.14, 50)
X = np.linspace(0, 2 * np.pi, 50)
Y = np.sin(X)

# Create the figure we desire to add to an existing canvas
Expand Down
Loading
X Tutup