File: matplotlib3.6.patch

package info (click to toggle)
dolfin 2019.2.0~legacy20240219.1c52e83-21
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,012 kB
  • sloc: xml: 104,040; cpp: 102,227; python: 24,356; sh: 460; makefile: 330; javascript: 226
file content (40 lines) | stat: -rw-r--r-- 1,622 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Index: dolfin/python/dolfin/common/plotting.py
===================================================================
--- dolfin.orig/python/dolfin/common/plotting.py	2023-01-06 13:54:33.846478549 +0100
+++ dolfin/python/dolfin/common/plotting.py	2023-01-06 13:57:38.740138228 +0100
@@ -203,7 +203,7 @@
         X = [X[:, i] for i in range(gdim)]
         U = [w0[i * nv: (i + 1) * nv] for i in range(gdim)]
 
-        # Compute magnitude
+        # Compute colour from magnitude
         C = U[0]**2
         for i in range(1, gdim):
             C += U[i]**2
@@ -211,11 +211,12 @@
 
         mode = kwargs.pop("mode", "glyphs")
         if mode == "glyphs":
-            args = X + U + [C]
             if gdim == 3:
+                args = X + U # no colour option (C) for quiver3D
                 length = kwargs.pop("length", 0.1)
-                return ax.quiver(*args, length=length, **kwargs)
+                return ax.quiver3D(*args, length=length, **kwargs)
             else:
+                args = X + U + [C]
                 return ax.quiver(*args, **kwargs)
         elif mode == "displacement":
             Xdef = [X[i] + U[i] for i in range(gdim)]
@@ -273,10 +274,7 @@
 
     gdim = mesh.geometry().dim()
     if gdim == 3 or kwargs.get("mode") in ("warp",):
-        # Importing this toolkit has side effects enabling 3d support
-        from mpl_toolkits.mplot3d import axes3d  # noqa
-        # Enabling the 3d toolbox requires some additional arguments
-        ax = plt.gca(projection='3d')
+        ax = plt.axes(projection='3d')
     else:
         ax = plt.gca()
         ax.set_aspect('equal')