Skip to content

Commit 0773f42

Browse files
committed
Formatting
1 parent e25eca9 commit 0773f42

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

mathics/builtin/drawing/plot.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,12 @@ def __init__(self, expr, range_exprs, options, evaluation):
495495
contours = expr.get_option(options, "Contours", evaluation)
496496
if contours is not None:
497497
c = contours.to_python()
498-
if not (c=="System`Automatic" or isinstance(c, int) or isinstance(c, tuple) and all(isinstance(cc, (int,float)) for cc in c) ):
498+
if not (
499+
c == "System`Automatic"
500+
or isinstance(c, int)
501+
or isinstance(c, tuple)
502+
and all(isinstance(cc, (int, float)) for cc in c)
503+
):
499504
self.error(expr, "invcontour", contours)
500505
self.contours = c
501506

@@ -592,7 +597,7 @@ class _Plot3D(Builtin):
592597
),
593598
"invcontour": (
594599
"Contours option must be Automatic, an integer, or a list of numbers."
595-
)
600+
),
596601
}
597602

598603
# Plot3D, ComplexPlot3D

mathics/eval/drawing/plot3d_vectorized.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def emit(graphics, i, xyzs, quads):
258258
# computed contour levels have equal distance between them,
259259
# and half that between first/last contours and zmin/zmax
260260
dz = (zmax - zmin) / levels
261-
levels = zmin + np.arange(levels) * dz + dz/2
261+
levels = zmin + np.arange(levels) * dz + dz / 2
262262

263263
# one contour line per contour level
264264
for level in levels:
@@ -277,12 +277,18 @@ def emit(graphics, i, xyzs, quads):
277277
if background:
278278
with Timer("contour background"):
279279
# add extra levels below zmin and above zmax to define end ranges
280-
levels = [zmin-(levels[0]-zmin)] + list(levels) + [zmax+(zmax-levels[-1])]
280+
levels = (
281+
[zmin - (levels[0] - zmin)]
282+
+ list(levels)
283+
+ [zmax + (zmax - levels[-1])]
284+
)
281285
for lo, hi in zip(levels[:-1], levels[1:]):
282286
# use masks and fancy indexing to assign (lo+hi)/2 to all zs between lo and hi
283287
zs[(lo < zs) & (zs <= hi)] = (lo + hi) / 2
284-
colors = density_colors(zs) # same colors as density plot
285-
graphics.add_complex(xyzs[:, 0:2], lines=None, polys=quads, colors=colors)
288+
colors = density_colors(zs) # same colors as density plot
289+
graphics.add_complex(
290+
xyzs[:, 0:2], lines=None, polys=quads, colors=colors
291+
)
286292

287293
# plot_options.plotpoints = [n * 10 for n in plot_options.plotpoints]
288294
return make_plot(plot_options, evaluation, dim=2, is_complex=False, emit=emit)

0 commit comments

Comments
 (0)