tikzplot42 0.6.5__tar.gz → 0.6.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/PKG-INFO +1 -1
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/pyproject.toml +1 -1
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/axes.py +121 -53
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/axes.pyi +20 -17
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/axes3d.py +2 -1
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/colorbar.py +7 -3
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/elements.py +13 -2
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/figure.pyi +1 -1
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/plots.pyi +3 -3
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot42.egg-info/PKG-INFO +1 -1
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test27.py +1 -1
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/LICENSE +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/README.md +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/setup.cfg +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/__init__.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/__init__.pyi +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/arrows.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/axes3d.pyi +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/border_finder.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/colorbar.pyi +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/colors.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/config.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/config.pyi +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/elements.pyi +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/figure.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/latex_special.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/pie.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/plots.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/py.typed +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/state.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/styles.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/styles.pyi +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot/texts.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot42.egg-info/SOURCES.txt +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot42.egg-info/dependency_links.txt +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot42.egg-info/requires.txt +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/src/tikzplot42.egg-info/top_level.txt +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test1.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test10.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test11.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test12.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test13.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test14.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test15.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test16.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test17.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test18.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test19.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test2.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test20.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test21.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test22.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test23.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test24.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test25.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test26.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test28.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test3.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test4.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test5.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test6.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test7.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test8.py +0 -0
- {tikzplot42-0.6.5 → tikzplot42-0.6.7}/tests/test9.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tikzplot42"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.7"
|
|
8
8
|
description = "TikzPlot to make TikZ/PGFPlots plots with matplotlib.pyplot-like syntax."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Zan Ambrozic", email = "zan.ambrozic7@gmail.com" }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Any, Iterable, Tuple
|
|
2
2
|
import copy
|
|
3
|
+
import warnings
|
|
3
4
|
|
|
4
5
|
import numpy as _np
|
|
5
6
|
import matplotlib.pyplot as _plt
|
|
@@ -189,7 +190,7 @@ class BaseAxes:
|
|
|
189
190
|
def _check_kwargs(self, func, allowed, **kwargs):
|
|
190
191
|
blacklist = set(kwargs) - allowed
|
|
191
192
|
for b in blacklist:
|
|
192
|
-
|
|
193
|
+
warnings.warn(f"Ignoring unknown kwarg for {func}: {b}", Warning)
|
|
193
194
|
return {k: v for k, v in kwargs.items() if k in allowed}
|
|
194
195
|
|
|
195
196
|
def plot(self, *args, **kwargs):
|
|
@@ -301,32 +302,36 @@ class BaseAxes:
|
|
|
301
302
|
|
|
302
303
|
x_min, x_max = (x.min(), x.max())
|
|
303
304
|
y_min, y_max = (y.min(), y.max())
|
|
305
|
+
domain_dx = abs(x_max - x_min) if x_max != x_min else 1.0
|
|
306
|
+
domain_dy = abs(y_max - y_min) if y_max != y_min else 1.0
|
|
304
307
|
x_1d = _np.asarray(x[0, :] if x.ndim == 2 else x).flatten()
|
|
305
308
|
y_1d = _np.asarray(y[:, 0] if y.ndim == 2 else y).flatten()
|
|
306
|
-
|
|
307
|
-
|
|
309
|
+
x_1d_n = (x_1d - x_min) / domain_dx
|
|
310
|
+
y_1d_n = (y_1d - y_min) / domain_dy
|
|
311
|
+
interp_u = RegularGridInterpolator((x_1d_n, y_1d_n), u.T / domain_dx, bounds_error=False, fill_value=0.0)
|
|
312
|
+
interp_v = RegularGridInterpolator((x_1d_n, y_1d_n), v.T / domain_dy, bounds_error=False, fill_value=0.0)
|
|
308
313
|
start_points_set = start_points is not None
|
|
309
314
|
if start_points is None:
|
|
310
315
|
nx = int(10 * density)
|
|
311
316
|
ny = int(10 * density)
|
|
312
|
-
xs = _np.linspace(
|
|
313
|
-
ys = _np.linspace(
|
|
317
|
+
xs = _np.linspace(0, 1, nx + 1)
|
|
318
|
+
ys = _np.linspace(0, 1, ny + 1)
|
|
314
319
|
xc = 0.5 * (xs[:-1] + xs[1:])
|
|
315
320
|
yc = 0.5 * (ys[:-1] + ys[1:])
|
|
316
321
|
seed_x, seed_y = _np.meshgrid(xc, yc)
|
|
317
322
|
seeds = _np.column_stack([seed_x.ravel(), seed_y.ravel()])
|
|
318
323
|
if not broken_streamlines:
|
|
319
324
|
dist_to_boundary = _np.minimum(
|
|
320
|
-
_np.minimum(seeds[:, 0]
|
|
321
|
-
_np.minimum(seeds[:, 1]
|
|
325
|
+
_np.minimum(seeds[:, 0], 1 - seeds[:, 0]),
|
|
326
|
+
_np.minimum(seeds[:, 1], 1 - seeds[:, 1])
|
|
322
327
|
)
|
|
323
328
|
sort_idx = _np.argsort(dist_to_boundary)
|
|
324
329
|
seeds = seeds[sort_idx]
|
|
325
330
|
else:
|
|
326
|
-
seeds = _np.asarray(start_points)
|
|
331
|
+
seeds = _np.asarray(start_points).copy()
|
|
332
|
+
seeds[:, 0] = (seeds[:, 0] - x_min) / domain_dx
|
|
333
|
+
seeds[:, 1] = (seeds[:, 1] - y_min) / domain_dy
|
|
327
334
|
|
|
328
|
-
domain_dx = abs(x_max - x_min)
|
|
329
|
-
domain_dy = abs(y_max - y_min)
|
|
330
335
|
if start_points_set and not broken_streamlines:
|
|
331
336
|
ignore_length = True
|
|
332
337
|
skip_used_starts = False
|
|
@@ -353,9 +358,10 @@ class BaseAxes:
|
|
|
353
358
|
current_line_seeds = _np.zeros(len(seeds), dtype=bool)
|
|
354
359
|
nx_seed = int(10 * density)
|
|
355
360
|
ny_seed = int(10 * density)
|
|
356
|
-
dx_seed =
|
|
357
|
-
dy_seed =
|
|
361
|
+
dx_seed = 1.0 / nx_seed
|
|
362
|
+
dy_seed = 1.0 / ny_seed
|
|
358
363
|
R_SQ_THRESH = 0.0625
|
|
364
|
+
closed_loop_start_guard = 2 * _np.sqrt(R_SQ_THRESH) * max(dx_seed, dy_seed)
|
|
359
365
|
def integrate_seed(start_point, maxlength=100.0, max_step=0.05, direction='both'):
|
|
360
366
|
x0, y0 = start_point
|
|
361
367
|
eps = 1e-8
|
|
@@ -367,7 +373,7 @@ class BaseAxes:
|
|
|
367
373
|
return [vel_x / norm, vel_y / norm]
|
|
368
374
|
def out_of_bounds_event(s, state):
|
|
369
375
|
px, py = state
|
|
370
|
-
return min(px
|
|
376
|
+
return min(px, 1 - px, py, 1 - py)
|
|
371
377
|
out_of_bounds_event.terminal = True # type: ignore
|
|
372
378
|
out_of_bounds_event.direction = -1 # type: ignore
|
|
373
379
|
def stagnation_event(s, state):
|
|
@@ -377,7 +383,7 @@ class BaseAxes:
|
|
|
377
383
|
stagnation_event.terminal = True # type: ignore
|
|
378
384
|
stagnation_event.direction = -1 # type: ignore
|
|
379
385
|
def closed_loop_event(s, state):
|
|
380
|
-
if abs(s) <
|
|
386
|
+
if abs(s) < closed_loop_start_guard:
|
|
381
387
|
return 1.0
|
|
382
388
|
px, py = state
|
|
383
389
|
dist_sq = ((px - x0) / dx_seed)**2 + ((py - y0) / dy_seed)**2
|
|
@@ -409,16 +415,44 @@ class BaseAxes:
|
|
|
409
415
|
s_eval = _np.linspace(0.0, s_final, max(50, int(abs(s_final) * 50)))
|
|
410
416
|
dense_pts = sol.sol(s_eval)
|
|
411
417
|
x_pts, y_pts = dense_pts[0], dense_pts[1]
|
|
418
|
+
closed_at_seed = sol.t_events[2].size > 0
|
|
419
|
+
is_closed = closed_at_seed
|
|
420
|
+
if not is_closed:
|
|
421
|
+
cell_x = _np.sqrt(R_SQ_THRESH) * dx_seed
|
|
422
|
+
cell_y = _np.sqrt(R_SQ_THRESH) * dy_seed
|
|
423
|
+
min_loop_length = max(dx_seed, dy_seed)
|
|
424
|
+
visited = defaultdict(list)
|
|
425
|
+
for i, (px, py) in enumerate(zip(x_pts, y_pts)):
|
|
426
|
+
key = (int(px / cell_x), int(py / cell_y))
|
|
427
|
+
for gx in range(key[0] - 1, key[0] + 2):
|
|
428
|
+
for gy in range(key[1] - 1, key[1] + 2):
|
|
429
|
+
for j in visited.get((gx, gy), []):
|
|
430
|
+
if abs(s_eval[i] - s_eval[j]) < min_loop_length:
|
|
431
|
+
continue
|
|
432
|
+
dist_sq = ((px - x_pts[j]) / dx_seed)**2 + ((py - y_pts[j]) / dy_seed)**2
|
|
433
|
+
if dist_sq < R_SQ_THRESH:
|
|
434
|
+
x_pts = x_pts[j:i + 1]
|
|
435
|
+
y_pts = y_pts[j:i + 1]
|
|
436
|
+
x_pts[-1] = x_pts[0]
|
|
437
|
+
y_pts[-1] = y_pts[0]
|
|
438
|
+
is_closed = True
|
|
439
|
+
break
|
|
440
|
+
if is_closed:
|
|
441
|
+
break
|
|
442
|
+
if is_closed:
|
|
443
|
+
break
|
|
444
|
+
if is_closed:
|
|
445
|
+
break
|
|
446
|
+
visited[key].append(i)
|
|
447
|
+
if closed_at_seed:
|
|
448
|
+
x_pts = _np.append(x_pts, x0)
|
|
449
|
+
y_pts = _np.append(y_pts, y0)
|
|
412
450
|
if mark_used:
|
|
413
451
|
for px, py in zip(x_pts, y_pts):
|
|
414
452
|
dist_sq = ((px - seeds[:, 0]) / dx_seed)**2 + ((py - seeds[:, 1]) / dy_seed)**2
|
|
415
453
|
close_seeds = dist_sq < R_SQ_THRESH
|
|
416
454
|
seed_used[close_seeds] = True
|
|
417
455
|
current_line_seeds[close_seeds] = True
|
|
418
|
-
is_closed = (sol.t_events[2].size > 0)
|
|
419
|
-
if is_closed:
|
|
420
|
-
x_pts = _np.append(x_pts, x0)
|
|
421
|
-
y_pts = _np.append(y_pts, y0)
|
|
422
456
|
return x_pts, y_pts, is_closed
|
|
423
457
|
if direction == 'forward':
|
|
424
458
|
return finalize_trajectory_and_mark(run_solver(maxlength))
|
|
@@ -431,7 +465,7 @@ class BaseAxes:
|
|
|
431
465
|
return x_fwd, y_fwd, True
|
|
432
466
|
fwd_pts = _np.column_stack([x_fwd, y_fwd]) if len(x_fwd) > 5 else None
|
|
433
467
|
def hit_fwd_line_event(s, state):
|
|
434
|
-
if fwd_pts is None or abs(s) <
|
|
468
|
+
if fwd_pts is None or abs(s) < closed_loop_start_guard:
|
|
435
469
|
return 1.0
|
|
436
470
|
px, py = state
|
|
437
471
|
dist_sq = ((px - fwd_pts[:, 0]) / dx_seed)**2 + ((py - fwd_pts[:, 1]) / dy_seed)**2
|
|
@@ -441,7 +475,15 @@ class BaseAxes:
|
|
|
441
475
|
sol_bwd = run_solver(-maxlength, extra_events=[hit_fwd_line_event])
|
|
442
476
|
x_bwd, y_bwd, is_closed_bwd = finalize_trajectory_and_mark(sol_bwd)
|
|
443
477
|
hit_fwd_line = sol_bwd.t_events[4].size > 0 if len(sol_bwd.t_events) > 4 else False
|
|
444
|
-
|
|
478
|
+
if is_closed_bwd:
|
|
479
|
+
return x_bwd[::-1], y_bwd[::-1], True
|
|
480
|
+
if hit_fwd_line and fwd_pts is not None:
|
|
481
|
+
px, py = x_bwd[-1], y_bwd[-1]
|
|
482
|
+
dist_sq = ((px - fwd_pts[:, 0]) / dx_seed)**2 + ((py - fwd_pts[:, 1]) / dy_seed)**2
|
|
483
|
+
join_idx = int(_np.argmin(dist_sq))
|
|
484
|
+
x_fwd = x_fwd[:join_idx + 1]
|
|
485
|
+
y_fwd = y_fwd[:join_idx + 1]
|
|
486
|
+
is_closed = hit_fwd_line
|
|
445
487
|
if len(x_bwd) > 0 and len(x_fwd) > 0:
|
|
446
488
|
x_full = _np.concatenate([x_bwd[::-1], x_fwd[1:]])
|
|
447
489
|
y_full = _np.concatenate([y_bwd[::-1], y_fwd[1:]])
|
|
@@ -470,7 +512,7 @@ class BaseAxes:
|
|
|
470
512
|
grid_cell_size_y = dy_seed * 0.5
|
|
471
513
|
spatial_grid = defaultdict(list)
|
|
472
514
|
def get_grid_key(px, py):
|
|
473
|
-
return int(
|
|
515
|
+
return int(px / grid_cell_size_x), int(py / grid_cell_size_y)
|
|
474
516
|
def perp_dist(px, py, ax, ay, bx, by):
|
|
475
517
|
npx, npy = px / dx_seed, py / dy_seed
|
|
476
518
|
nax, nay = ax / dx_seed, ay / dy_seed
|
|
@@ -531,11 +573,14 @@ class BaseAxes:
|
|
|
531
573
|
st = {}
|
|
532
574
|
settings: dict[str, Any] = {"streamplot": {}}
|
|
533
575
|
for x_seg, y_seg in final_streamlines:
|
|
576
|
+
x_plot = x_min + x_seg * (x_max - x_min)
|
|
577
|
+
y_plot = y_min + y_seg * (y_max - y_min)
|
|
534
578
|
if cmap is not None:
|
|
535
|
-
|
|
536
|
-
|
|
579
|
+
points = _np.column_stack([x_seg, y_seg])
|
|
580
|
+
vs = _np.hypot(interp_u(points) * domain_dx, interp_v(points) * domain_dy)
|
|
581
|
+
lines[0].append(list(zip(x_plot, y_plot, vs)))
|
|
537
582
|
else:
|
|
538
|
-
lines[0].append(list(zip(
|
|
583
|
+
lines[0].append(list(zip(x_plot, y_plot)))
|
|
539
584
|
ol = None
|
|
540
585
|
settings["empty line"] = "jump"
|
|
541
586
|
if cmap is not None:
|
|
@@ -561,14 +606,10 @@ class BaseAxes:
|
|
|
561
606
|
arrow_u = []
|
|
562
607
|
arrow_v = []
|
|
563
608
|
arrow_c = []
|
|
564
|
-
scale_x = 1.0 / domain_dx if domain_dx > 0 else 1.0
|
|
565
|
-
scale_y = 1.0 / domain_dy if domain_dy > 0 else 1.0
|
|
566
609
|
for x_seg, y_seg in final_streamlines:
|
|
567
610
|
if len(x_seg) < 2:
|
|
568
611
|
continue
|
|
569
|
-
|
|
570
|
-
dy_norm = _np.diff(y_seg) * scale_y
|
|
571
|
-
step_lengths = _np.hypot(dx_norm, dy_norm)
|
|
612
|
+
step_lengths = _np.hypot(_np.diff(x_seg), _np.diff(y_seg))
|
|
572
613
|
cum_len = _np.concatenate([[0.0], _np.cumsum(step_lengths)])
|
|
573
614
|
total_len = cum_len[-1]
|
|
574
615
|
if total_len == 0.0:
|
|
@@ -581,12 +622,12 @@ class BaseAxes:
|
|
|
581
622
|
frac = (t_len - cum_len[idx]) / ds if ds > 0 else 0.0
|
|
582
623
|
px = x_seg[idx] + frac * (x_seg[idx + 1] - x_seg[idx])
|
|
583
624
|
py = y_seg[idx] + frac * (y_seg[idx + 1] - y_seg[idx])
|
|
584
|
-
pu = float(interp_u((px, py)))
|
|
585
|
-
pv = float(interp_v((px, py)))
|
|
625
|
+
pu = float(interp_u((px, py))) * domain_dx
|
|
626
|
+
pv = float(interp_v((px, py))) * domain_dy
|
|
586
627
|
p_norm = _np.hypot(pu, pv)
|
|
587
628
|
if p_norm > 1e-8:
|
|
588
|
-
arrow_x.append(px)
|
|
589
|
-
arrow_y.append(py)
|
|
629
|
+
arrow_x.append(x_min + px * (x_max - x_min))
|
|
630
|
+
arrow_y.append(y_min + py * (y_max - y_min))
|
|
590
631
|
arrow_u.append(pu / p_norm)
|
|
591
632
|
arrow_v.append(pv / p_norm)
|
|
592
633
|
arrow_c.append(p_norm)
|
|
@@ -881,7 +922,7 @@ class BaseAxes:
|
|
|
881
922
|
|
|
882
923
|
stack = kwargs.pop("stacked", False)
|
|
883
924
|
datas = {}
|
|
884
|
-
for kw in ["color", "c", "facecolor", "fc", "edgecolor", "ec", "label", "hatch", "hatch_color", "hatch_linewidth", "hatch_distance"]:
|
|
925
|
+
for kw in ["alpha", "color", "c", "facecolor", "fc", "edgecolor", "ec", "label", "hatch", "hatch_color", "hatch_linewidth", "hatch_distance"]:
|
|
885
926
|
if kw in kwargs:
|
|
886
927
|
if isinstance(kwargs[kw], (list)):
|
|
887
928
|
if len(kwargs[kw]) != len(datasets):
|
|
@@ -939,7 +980,7 @@ class BaseAxes:
|
|
|
939
980
|
data = datasets[i]
|
|
940
981
|
settings = base_settings.copy()
|
|
941
982
|
kws = datas.get(i, {})
|
|
942
|
-
passing_args = ["facecolor", "fc", "color", "c", "edgecolor", "ec", "label", "hatch", "hatch_color", "hatch_linewidth", "hatch_distance"]
|
|
983
|
+
passing_args = ["facecolor", "fc", "color", "c", "edgecolor", "ec", "label", "hatch", "hatch_color", "hatch_linewidth", "hatch_distance", "alpha"]
|
|
943
984
|
for a in passing_args:
|
|
944
985
|
if a in kws:
|
|
945
986
|
settings[a] = kws[a]
|
|
@@ -1043,7 +1084,7 @@ class BaseAxes:
|
|
|
1043
1084
|
except (ValueError, TypeError):
|
|
1044
1085
|
h_arr = _np.asarray(heights)
|
|
1045
1086
|
if h_arr.ndim == 2:
|
|
1046
|
-
datasets = [
|
|
1087
|
+
datasets = [h_arr[:, i] for i in range(h_arr.shape[1])] #pyright: ignore reportGeneralTypeIssues
|
|
1047
1088
|
else:
|
|
1048
1089
|
raise ValueError("Invalid dataset structure.")
|
|
1049
1090
|
else:
|
|
@@ -1051,13 +1092,13 @@ class BaseAxes:
|
|
|
1051
1092
|
if h_arr.ndim == 1:
|
|
1052
1093
|
datasets = [h_arr]
|
|
1053
1094
|
elif h_arr.ndim == 2:
|
|
1054
|
-
datasets = [
|
|
1095
|
+
datasets = [h_arr[:, i] for i in range(h_arr.shape[1])] #pyright: ignore reportGeneralTypeIssues
|
|
1055
1096
|
else:
|
|
1056
1097
|
raise ValueError(f"Input must be 1D or 2D, got {h_arr.ndim}D.")
|
|
1057
1098
|
|
|
1058
1099
|
xs = kwargs.pop("positions", range(len(datasets)))
|
|
1059
|
-
if len(xs) != len(datasets):
|
|
1060
|
-
raise Warning("Length of positions does not match length of datasets.")
|
|
1100
|
+
if len(xs) != len(datasets[0]):
|
|
1101
|
+
raise Warning(f"Length of positions ({len(xs)}) does not match length of datasets ({len(datasets)}).")
|
|
1061
1102
|
if _np.diff(xs).min() != _np.diff(xs).max():
|
|
1062
1103
|
raise Warning("Positions must be equidistant.")
|
|
1063
1104
|
dist = _np.diff(xs).min()
|
|
@@ -1194,6 +1235,17 @@ class BaseAxes:
|
|
|
1194
1235
|
self._update_levels("ymin" if orientation == "vertical" else "xmin", min(m, 0))
|
|
1195
1236
|
self._update_levels("ymax" if orientation == "vertical" else "xmax", M)
|
|
1196
1237
|
|
|
1238
|
+
is_polar = False ## Temporary fix, needs proper implementation to fix edges and alignment in general cases for polar plots.
|
|
1239
|
+
if isinstance(self, Axes):
|
|
1240
|
+
if self._projection=="polar": is_polar = True
|
|
1241
|
+
elif isinstance(self, Secondary):
|
|
1242
|
+
if self._primary._projection=="polar": is_polar = True
|
|
1243
|
+
if is_polar:
|
|
1244
|
+
k = _np.repeat(k, 3)[1:-1]
|
|
1245
|
+
v = _np.repeat(v, 3)[:-2]
|
|
1246
|
+
v[::3] = 0
|
|
1247
|
+
v[0] = 0
|
|
1248
|
+
|
|
1197
1249
|
if _np.count_nonzero(edge) > 0:
|
|
1198
1250
|
lower = self._get_overlay()
|
|
1199
1251
|
if bar_type + " stacked" in self._overlay_special.get(lower, {}):
|
|
@@ -1232,6 +1284,9 @@ class BaseAxes:
|
|
|
1232
1284
|
|
|
1233
1285
|
fill = kwargs.pop("facecolor", kwargs.pop("fc", kwargs.pop("color", kwargs.pop("c", None))))
|
|
1234
1286
|
draw = kwargs.pop("edgecolor", kwargs.pop("ec", None))
|
|
1287
|
+
opacity = kwargs.pop("alpha", 1)
|
|
1288
|
+
if opacity != 1:
|
|
1289
|
+
element_args["alpha"] = opacity
|
|
1235
1290
|
if fill:
|
|
1236
1291
|
fill = self._match_color(fill)
|
|
1237
1292
|
settings["fill"] = fill
|
|
@@ -1240,7 +1295,7 @@ class BaseAxes:
|
|
|
1240
1295
|
settings["draw"] = draw
|
|
1241
1296
|
else:
|
|
1242
1297
|
settings["draw"] = "none"
|
|
1243
|
-
for kw in ["label", "hatch", "hatch_color", "hatch_linewidth", "hatch_distance"]:
|
|
1298
|
+
for kw in ["label", "hatch", "hatch_color", "hatch_linewidth", "hatch_distance", "ecolor", "capsize"]:
|
|
1244
1299
|
if kw in kwargs:
|
|
1245
1300
|
element_args[kw] = kwargs.pop(kw)
|
|
1246
1301
|
note = ",\n".join([self._parse_entry(k, v) for k, v in self._overlay_special.get(overlay, {}).items()]) if overlay in self._overlay_special else None
|
|
@@ -1250,6 +1305,10 @@ class BaseAxes:
|
|
|
1250
1305
|
else:
|
|
1251
1306
|
settings["xbar legend"] = None
|
|
1252
1307
|
settings[bar_type] = None
|
|
1308
|
+
if is_polar:
|
|
1309
|
+
for q in ["ybar", "xbar", "ybar interval", "xbar interval"]:
|
|
1310
|
+
settings.pop(q, None)
|
|
1311
|
+
note = ""
|
|
1253
1312
|
return self._plot(k, v, yerr=kwargs.get("yerr", None), xerr=kwargs.get("xerr", None), overlay=overlay, settings=settings, note=note, **element_args)
|
|
1254
1313
|
|
|
1255
1314
|
def bar_label(self, container, labels=None, **kwargs):
|
|
@@ -1722,7 +1781,7 @@ class BaseAxes:
|
|
|
1722
1781
|
|
|
1723
1782
|
def set_ylabel(self, label, **kwargs):
|
|
1724
1783
|
self._not_hidable()
|
|
1725
|
-
kws = {"fontsize", "color", "c", "loc", "
|
|
1784
|
+
kws = {"fontsize", "color", "c", "loc", "rotation"}
|
|
1726
1785
|
kwargs = self._check_kwargs("set_ylabel", kws, **kwargs)
|
|
1727
1786
|
st = {}
|
|
1728
1787
|
if "fontsize" in kwargs:
|
|
@@ -1749,12 +1808,17 @@ class BaseAxes:
|
|
|
1749
1808
|
else:
|
|
1750
1809
|
st["at"] = {}
|
|
1751
1810
|
st["anchor"] = {}
|
|
1752
|
-
if "
|
|
1753
|
-
if kwargs["
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
if
|
|
1757
|
-
|
|
1811
|
+
if "rotation" in kwargs:
|
|
1812
|
+
if isinstance(kwargs["rotation"], (int, float)):
|
|
1813
|
+
st["rotate"] = str(kwargs["rotation"])
|
|
1814
|
+
elif isinstance(kwargs["rotation"], str):
|
|
1815
|
+
if kwargs["rotation"] not in ["vertical", "horizontal"]:
|
|
1816
|
+
raise Warning(f"Invalid rotation: {kwargs['rotation']}. Must be one of 'vertical' or 'horizontal'.")
|
|
1817
|
+
if kwargs["rotation"] == "horizontal":
|
|
1818
|
+
if isinstance(self, Secondary):
|
|
1819
|
+
st["rotate"] = "-90"
|
|
1820
|
+
else:
|
|
1821
|
+
st["rotate"] = "-90"
|
|
1758
1822
|
else:
|
|
1759
1823
|
st["rotate"] = "-90"
|
|
1760
1824
|
else:
|
|
@@ -1884,7 +1948,7 @@ class BaseAxes:
|
|
|
1884
1948
|
if isinstance(self, Secondary):
|
|
1885
1949
|
return self._primary.set_xlabel(label, **kwargs)
|
|
1886
1950
|
self._not_hidable()
|
|
1887
|
-
kws = {"fontsize", "color", "c", "loc", "
|
|
1951
|
+
kws = {"fontsize", "color", "c", "loc", "rotation"}
|
|
1888
1952
|
kwargs = self._check_kwargs("set_xlabel", kws, **kwargs)
|
|
1889
1953
|
st = {}
|
|
1890
1954
|
if "fontsize" in kwargs:
|
|
@@ -1905,11 +1969,14 @@ class BaseAxes:
|
|
|
1905
1969
|
else:
|
|
1906
1970
|
st["at"] = {}
|
|
1907
1971
|
st["anchor"] = {}
|
|
1908
|
-
if "
|
|
1909
|
-
if kwargs["
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1972
|
+
if "rotation" in kwargs:
|
|
1973
|
+
if isinstance(kwargs["rotation"], (int, float)):
|
|
1974
|
+
st["rotate"] = str(kwargs["rotation"])
|
|
1975
|
+
elif isinstance(kwargs["rotation"], str):
|
|
1976
|
+
if kwargs["rotation"] not in ["vertical", "horizontal"]:
|
|
1977
|
+
raise Warning(f"Invalid rotation: {kwargs['rotation']}. Must be one of 'vertical' or 'horizontal'.")
|
|
1978
|
+
if kwargs["rotation"] == "vertical":
|
|
1979
|
+
st["rotate"] = "-90"
|
|
1913
1980
|
else:
|
|
1914
1981
|
st["rotate"] = {}
|
|
1915
1982
|
if "\n" in label:
|
|
@@ -3107,6 +3174,7 @@ class Axes(BaseAxes):
|
|
|
3107
3174
|
axis_opt_str[i] += entry
|
|
3108
3175
|
if TikzConfig.SCHOOL_AXIS:
|
|
3109
3176
|
axis_opt_str[1] += f",\n axis lines=middle,\n xlabel style={{at={{(ticklabel* cs:{1+TikzConfig.SCHOOL_AXIS_LABEL_MARGIN})}},anchor=north}},\n ylabel style={{at={{(ticklabel* cs:{1+TikzConfig.SCHOOL_AXIS_LABEL_MARGIN})}},anchor=east}}"
|
|
3177
|
+
axis_opt_str[2] += f",\n axis lines=middle,\n xlabel style={{at={{(ticklabel* cs:{1+TikzConfig.SCHOOL_AXIS_LABEL_MARGIN})}},anchor=north}},\n ylabel style={{at={{(ticklabel* cs:{1+TikzConfig.SCHOOL_AXIS_LABEL_MARGIN})}},anchor=east}}"
|
|
3110
3178
|
if ("xmin" in self._axis_options and self._axis_options["xmin"] == 0) or ("xmax" in self._axis_options and self._axis_options["xmax"] == 0):
|
|
3111
3179
|
self._axis_options["extra x ticks"] = r"{0}"
|
|
3112
3180
|
if ("ymin" in self._axis_options and self._axis_options["ymin"] == 0) or ("ymax" in self._axis_options and self._axis_options["ymax"] == 0):
|
|
@@ -145,10 +145,10 @@ class BaseAxes:
|
|
|
145
145
|
Size of arrows along streamlines. Default is 1.0.
|
|
146
146
|
|
|
147
147
|
minlength: float, optional
|
|
148
|
-
Minimum length of streamlines. Streamlines shorter than this will be discarded. Default is 0.1.
|
|
148
|
+
Minimum length of streamlines (relative, where 1 is the dimension of the domain). Streamlines shorter than this will be discarded. Default is 0.1.
|
|
149
149
|
|
|
150
150
|
maxlength: float, optional
|
|
151
|
-
Maximum length of streamlines. Streamlines longer than this will be truncated. Default is 4.0.
|
|
151
|
+
Maximum length of streamlines (relative, where 1 is the dimension of the domain). Streamlines longer than this will be truncated. Default is 4.0.
|
|
152
152
|
|
|
153
153
|
integration_direction: {"forward", "backward", "both"}, optional
|
|
154
154
|
Direction of integration for streamlines. Default is "both".
|
|
@@ -479,19 +479,19 @@ class BaseAxes:
|
|
|
479
479
|
rwidth: float | None = None,
|
|
480
480
|
range: Tuple[float,float] | None = None,
|
|
481
481
|
alpha: float = 1.0,
|
|
482
|
-
color: ColorLike | Sequence[ColorLike] = ...,
|
|
483
|
-
facecolor: ColorLike | Sequence[ColorLike] = ...,
|
|
484
|
-
fc: ColorLike | Sequence[ColorLike] = ...,
|
|
485
|
-
edgecolor: ColorLike | Sequence[ColorLike] = ...,
|
|
486
|
-
ec: ColorLike | Sequence[ColorLike] = ...,
|
|
487
|
-
align: Literal["left", "mid", "right"] = ...,
|
|
482
|
+
color: ColorLike | Sequence[ColorLike]|None = ...,
|
|
483
|
+
facecolor: ColorLike | Sequence[ColorLike]|None = ...,
|
|
484
|
+
fc: ColorLike | Sequence[ColorLike]|None = ...,
|
|
485
|
+
edgecolor: ColorLike | Sequence[ColorLike]|None = ...,
|
|
486
|
+
ec: ColorLike | Sequence[ColorLike]|None = ...,
|
|
487
|
+
align: Literal["left", "mid", "right"]|None = ...,
|
|
488
488
|
stacked: bool = False,
|
|
489
489
|
fill: bool = True,
|
|
490
|
-
hatch: str|Sequence[str] = ...,
|
|
491
|
-
hatch_color: ColorLike|Sequence[ColorLike] = ...,
|
|
492
|
-
hatch_linewidth: float|Sequence[float] = ...,
|
|
493
|
-
hatch_distance: float|Sequence[float] = ...,
|
|
494
|
-
label: Optional[str|Sequence[str]] = ...,
|
|
490
|
+
hatch: str|Sequence[str]|None = ...,
|
|
491
|
+
hatch_color: ColorLike|Sequence[ColorLike]|None = ...,
|
|
492
|
+
hatch_linewidth: float|Sequence[float]|None = ...,
|
|
493
|
+
hatch_distance: float|Sequence[float]|None = ...,
|
|
494
|
+
label: Optional[str|Sequence[str]]|None = ...,
|
|
495
495
|
#**kwargs: Any
|
|
496
496
|
) -> Sequence[Graph]:
|
|
497
497
|
"""
|
|
@@ -1863,7 +1863,7 @@ class BaseAxes:
|
|
|
1863
1863
|
"""
|
|
1864
1864
|
...
|
|
1865
1865
|
|
|
1866
|
-
def set_ylabel(self, label: str, fontsize: Optional[FontSize] = ..., color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., loc: Literal["top", "center", "bottom"] = ...,
|
|
1866
|
+
def set_ylabel(self, label: str, fontsize: Optional[FontSize] = ..., color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., loc: Literal["top", "center", "bottom"] = ..., rotation: Literal["vertical", "horizontal"]|float|int|None = ...) -> None:
|
|
1867
1867
|
"""
|
|
1868
1868
|
Set y-axis label.
|
|
1869
1869
|
|
|
@@ -1881,8 +1881,8 @@ class BaseAxes:
|
|
|
1881
1881
|
loc: {"top", "center", "bottom"}, optional
|
|
1882
1882
|
Location of label, default center
|
|
1883
1883
|
|
|
1884
|
-
|
|
1885
|
-
Rotation of label, default vertical
|
|
1884
|
+
rotation: {"vertical", "horizontal"}, int or float, optional
|
|
1885
|
+
Rotation of label, default vertical. Angle in degrees from default position.
|
|
1886
1886
|
"""
|
|
1887
1887
|
...
|
|
1888
1888
|
def set_ylim(self, *args: Any, bottom: Optional[float] = ..., top: Optional[float] = ...) -> None:
|
|
@@ -1953,7 +1953,7 @@ class BaseAxes:
|
|
|
1953
1953
|
"""
|
|
1954
1954
|
...
|
|
1955
1955
|
|
|
1956
|
-
def set_xlabel(self, label: str, fontsize: Optional[FontSize] = ..., color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., loc: Optional[Literal["left", "center", "right"]] = ...) -> None:
|
|
1956
|
+
def set_xlabel(self, label: str, fontsize: Optional[FontSize] = ..., color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., loc: Optional[Literal["left", "center", "right"]] = ..., rotation: Optional[Literal["vertical", "horizontal"]]|float|int|None = ...) -> None:
|
|
1957
1957
|
"""
|
|
1958
1958
|
Set x-axis label.
|
|
1959
1959
|
|
|
@@ -1970,6 +1970,9 @@ class BaseAxes:
|
|
|
1970
1970
|
|
|
1971
1971
|
loc: {"left", "center", "right"}, optional
|
|
1972
1972
|
Label location, default "center"
|
|
1973
|
+
|
|
1974
|
+
rotation: {"vertical", "horizontal"}, int or float, optional
|
|
1975
|
+
Rotation of label, default horizontal. Angle in degrees from default position.
|
|
1973
1976
|
"""
|
|
1974
1977
|
...
|
|
1975
1978
|
def set_title(self, title: str, fontsize: Optional[FontSize] = ..., color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., loc: Optional[Literal["left", "center", "right"]] = ...) -> None:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Any, Iterable
|
|
2
2
|
import copy
|
|
3
|
+
import warnings
|
|
3
4
|
|
|
4
5
|
import numpy as _np
|
|
5
6
|
import matplotlib.pyplot as _plt
|
|
@@ -259,7 +260,7 @@ class Axes3:
|
|
|
259
260
|
def _check_kwargs(self, func, allowed, **kwargs):
|
|
260
261
|
blacklist = set(kwargs) - allowed
|
|
261
262
|
for b in blacklist:
|
|
262
|
-
|
|
263
|
+
warnings.warn(f"Ignoring unknown kwarg for {func}: {b}", Warning)
|
|
263
264
|
return {k: v for k, v in kwargs.items() if k in allowed}
|
|
264
265
|
|
|
265
266
|
def plot(self, xs, ys, zs, zdir="z", **kwargs):
|
|
@@ -221,7 +221,7 @@ class _Colorbar:
|
|
|
221
221
|
|
|
222
222
|
return list(zip(r, g, b))
|
|
223
223
|
|
|
224
|
-
def _generate_tex_colormap(self, cmap_name):
|
|
224
|
+
def _generate_tex_colormap(self, cmap_name, full_cbar=False):
|
|
225
225
|
if isinstance(cmap_name, str):
|
|
226
226
|
rev = False
|
|
227
227
|
if cmap_name.endswith("_r"):
|
|
@@ -255,7 +255,11 @@ class _Colorbar:
|
|
|
255
255
|
for i in range(self._divs):
|
|
256
256
|
r,g,b = colors[i]
|
|
257
257
|
output.append(f"rgb({lims[i]})=({r:.4f}, {g:.4f}, {b:.4f}) rgb({lims[i+1]-0.001})=({r:.4f}, {g:.4f}, {b:.4f})")
|
|
258
|
-
output.append("}")
|
|
258
|
+
output.append("}")
|
|
259
|
+
if not full_cbar and self._lower is not None and self._upper is not None:
|
|
260
|
+
output[-1] += ","
|
|
261
|
+
output.append(f"point meta min={{{self._lower}}},")
|
|
262
|
+
output.append(f"point meta max={{{self._upper}}}")
|
|
259
263
|
return "\n".join(output)
|
|
260
264
|
|
|
261
265
|
def __str__(self):
|
|
@@ -263,7 +267,7 @@ class _Colorbar:
|
|
|
263
267
|
from .axes3d import Axes3
|
|
264
268
|
tridim = isinstance(self._axis, Axes3)
|
|
265
269
|
lines = []
|
|
266
|
-
lines.append(f"colormap={self._generate_tex_colormap(self._cmap)},")
|
|
270
|
+
lines.append(f"colormap={self._generate_tex_colormap(self._cmap, full_cbar=True)},")
|
|
267
271
|
lines.append(f"colorbar{' horizontal' if self._horizontal else ''},")
|
|
268
272
|
lines.append(r"colorbar style={")
|
|
269
273
|
if hasattr(self._axis._fig, "_style"):
|
|
@@ -49,6 +49,11 @@ class BaseGraph:
|
|
|
49
49
|
if hasattr(err[0], "__len__") and len(err[0]) == 2:
|
|
50
50
|
return np.asarray(err), True
|
|
51
51
|
return np.asarray(err), False
|
|
52
|
+
if isinstance(err, (list, tuple)) and len(err) == 2:
|
|
53
|
+
if len(err[0]) == n and len(err[1]) == n:
|
|
54
|
+
return np.asarray(err).T, True
|
|
55
|
+
else:
|
|
56
|
+
return np.vstack([np.asarray([err[0]] * n), np.asarray([err[1]] * n)]).T, True
|
|
52
57
|
raise ValueError("Invalid errorbar specification")
|
|
53
58
|
|
|
54
59
|
def _style_string(self):
|
|
@@ -842,9 +847,15 @@ class Graph(BaseGraph):
|
|
|
842
847
|
else:
|
|
843
848
|
table_opts = "x=x,y=y"
|
|
844
849
|
if self._xerr is not None:
|
|
845
|
-
|
|
850
|
+
if self._x_asym:
|
|
851
|
+
table_opts += ",x error plus=xerrplus,x error minus=xerrminus"
|
|
852
|
+
else:
|
|
853
|
+
table_opts += ",x error=xerror"
|
|
846
854
|
if self._yerr is not None:
|
|
847
|
-
|
|
855
|
+
if self._y_asym:
|
|
856
|
+
table_opts += ",y error plus=yerrplus,y error minus=yerrminus"
|
|
857
|
+
else:
|
|
858
|
+
table_opts += ",y error=yerror"
|
|
848
859
|
if "scatter" in self._settings:
|
|
849
860
|
if "cmap" in self._style:
|
|
850
861
|
table_opts += ",meta=color"
|
|
@@ -214,7 +214,7 @@ class Figure:
|
|
|
214
214
|
"""
|
|
215
215
|
...
|
|
216
216
|
|
|
217
|
-
def subplot_mosaic(self, mosaic: str | list[list[str]], *, sharex: bool = False, sharey: bool = False, width_ratios: Optional[Sequence[float]] = None, height_ratios: Optional[Sequence[float]] = None, empty_sentinel: str = ".", figsize: Optional[tuple[float, float]] = None) -> dict[str,
|
|
217
|
+
def subplot_mosaic(self, mosaic: str | list[list[str]], *, sharex: bool = False, sharey: bool = False, width_ratios: Optional[Sequence[float]] = None, height_ratios: Optional[Sequence[float]] = None, empty_sentinel: str = ".", figsize: Optional[tuple[float, float]] = None) -> dict[str, Axes]:
|
|
218
218
|
"""
|
|
219
219
|
Create a figure and a set of subplots arranged in a mosaic layout.
|
|
220
220
|
|
|
@@ -203,7 +203,7 @@ def subplots(
|
|
|
203
203
|
"""
|
|
204
204
|
...
|
|
205
205
|
|
|
206
|
-
def subplot_mosaic(mosaic: str | list[list[str]], *, sharex: bool = False, sharey: bool = False, width_ratios: Optional[Sequence[float]] = None, height_ratios: Optional[Sequence[float]] = None, empty_sentinel: str = ".", figsize: Optional[tuple[float, float]] = None) -> tuple[Figure, dict[str,
|
|
206
|
+
def subplot_mosaic(mosaic: str | list[list[str]], *, sharex: bool = False, sharey: bool = False, width_ratios: Optional[Sequence[float]] = None, height_ratios: Optional[Sequence[float]] = None, empty_sentinel: str = ".", figsize: Optional[tuple[float, float]] = None) -> tuple[Figure, dict[str, Axes]]:
|
|
207
207
|
"""
|
|
208
208
|
Create a figure and a set of subplots arranged in a mosaic layout.
|
|
209
209
|
|
|
@@ -639,10 +639,10 @@ def streamplot(self, x, y, u, v, density: float = 1.0, linewidth: float|None = .
|
|
|
639
639
|
Size of arrows along streamlines. Default is 1.0.
|
|
640
640
|
|
|
641
641
|
minlength: float, optional
|
|
642
|
-
Minimum length of streamlines. Streamlines shorter than this will be discarded. Default is 0.1.
|
|
642
|
+
Minimum length of streamlines (relative, where 1 is the dimension of the domain). Streamlines shorter than this will be discarded. Default is 0.1.
|
|
643
643
|
|
|
644
644
|
maxlength: float, optional
|
|
645
|
-
Maximum length of streamlines. Streamlines longer than this will be truncated. Default is 4.0.
|
|
645
|
+
Maximum length of streamlines (relative, where 1 is the dimension of the domain). Streamlines longer than this will be truncated. Default is 4.0.
|
|
646
646
|
|
|
647
647
|
integration_direction: {"forward", "backward", "both"}, optional
|
|
648
648
|
Direction of integration for streamlines. Default is "both".
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import tikzplot.plots as plt
|
|
2
2
|
import numpy as np
|
|
3
3
|
from tikzplot import TikzConfig
|
|
4
|
-
TikzConfig.modifyParam(MAX_POINTS_PER_ELEMENT=
|
|
4
|
+
TikzConfig.modifyParam(MAX_POINTS_PER_ELEMENT=4900, REDUCE_METHOD=0)
|
|
5
5
|
|
|
6
6
|
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
|
|
7
7
|
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|