Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e8b0a67

Browse filesBrowse files
committed
Simplify curvilinear grid examples.
Since 8840d6e we ensure that `x` and `y` passed to `tr` and `inv_tr` are already arrays (see the definition of `_UserTransform2D.transform_non_affine`), so we don't need additional casting-to-arrays.
1 parent 3d5c6d5 commit e8b0a67
Copy full SHA for e8b0a67

File tree

Expand file treeCollapse file tree

2 files changed

+4
-13
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-13
lines changed

‎examples/axisartist/demo_curvelinear_grid.py

Copy file name to clipboardExpand all lines: examples/axisartist/demo_curvelinear_grid.py
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ def curvelinear_test1(fig):
2727
Grid for custom transform.
2828
"""
2929

30-
def tr(x, y):
31-
x, y = np.asarray(x), np.asarray(y)
32-
return x, y - x
33-
34-
def inv_tr(x, y):
35-
x, y = np.asarray(x), np.asarray(y)
36-
return x, y + x
30+
def tr(x, y): return x, y - x
31+
def inv_tr(x, y): return x, y + x
3732

3833
grid_helper = GridHelperCurveLinear((tr, inv_tr))
3934

‎examples/axisartist/demo_curvelinear_grid2.py

Copy file name to clipboardExpand all lines: examples/axisartist/demo_curvelinear_grid2.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ def curvelinear_test1(fig):
2424
"""Grid for custom transform."""
2525

2626
def tr(x, y):
27-
sgn = np.sign(x)
28-
x, y = np.abs(np.asarray(x)), np.asarray(y)
29-
return sgn*x**.5, y
27+
return np.sign(x)*abs(x)**.5, y
3028

3129
def inv_tr(x, y):
32-
sgn = np.sign(x)
33-
x, y = np.asarray(x), np.asarray(y)
34-
return sgn*x**2, y
30+
return np.sign(x)*x**2, y
3531

3632
grid_helper = GridHelperCurveLinear(
3733
(tr, inv_tr),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.