Skip to content

Commit ec204a3

Browse files
committed
added maxt_ime param to limit TemporalNetwork visualisations
1 parent bbda877 commit ec204a3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pathpy/visualisation/html.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ def plot(network, **params):
151151
stamp within which time-stamped edges will be considered for the force-directed layout.
152152
Values larger than one result in smoothly changing layouts.
153153
Default value is 10.
154+
max_time: int (TemporalNetwork)
155+
maximum time stamp to visualise. Useful to limit visualisation of very long Temporal Networks.
156+
If None, the whole sequence will be shown. Default is None.
154157
active_edge_width: float (TemporalNetwork)
155158
A float value that specifies the width of currently active edges.
156159
Default value is 4.0.
@@ -458,6 +461,12 @@ def _generate_html_tempnet(tempnet, **params):
458461
if 'ts_per_frame' not in params:
459462
params['ts_per_frame'] = 1
460463

464+
if 'max_time' not in params:
465+
params['max_time'] = None
466+
467+
if params['max_time'] is not None:
468+
tempnet = tempnet.filter_edges(lambda u, v, t: t <= params['max_time'])
469+
461470
# auto-adjust simulation speed to temporal characteristics
462471
if params['ts_per_frame'] == 0:
463472
d = tempnet.inter_event_times()

0 commit comments

Comments
 (0)