@@ -23,6 +23,7 @@ function DynamicalSystems.interactive_trajectory(
2323 axis = NamedTuple (),
2424 lims = nothing ,
2525 statespace_axis = true ,
26+ statespace_names = state_name .(idxs),
2627 starting_step = 1 ,
2728 )
2829
@@ -40,7 +41,7 @@ function DynamicalSystems.interactive_trajectory(
4041 statespacelayout = fig[1 ,1 ] = GridLayout ()
4142 lims = isnothing (lims) ? _traj_lim_estimator (ds, u0s, idxs, [1 ], Δt)[1 ] : lims
4243 tailobs, finalpoints = _init_statespace_plot! (statespacelayout, ds, idxs,
43- lims, pds, colors, plotkwargs, markersize, tail, axis, fade, statespace_axis,
44+ lims, pds, colors, plotkwargs, markersize, tail, axis, fade, statespace_names, statespace_axis,
4445 )
4546 # Set up layouting and add controls
4647 if add_controls # Notice that `run` and `step` are already observables
@@ -130,15 +131,15 @@ vector_idx_observe(ds, u, idxs) = [observe_state(ds, i, u) for i in idxs]
130131" Create the state space axis and evolution controls. Return the axis."
131132function _init_statespace_plot! (
132133 layout, ds, idxs, lims, pds, colors, plotkwargs, markersize, tail, axis, fade,
133- statespace_axis # whether to show the statespace axis
134+ statespace_names, statespace_axis # whether to show the statespace axis
134135 )
135136 tailobs, finalpoints = _init_trajectory_observables (pds, tail)
136137 is3D = length (idxs) == 3
137138 axisposition = statespace_axis ? layout[1 ,1 ] : Figure ()[1 ,1 ]
138- xlabel = state_name (idxs [1 ])
139- ylabel = state_name (idxs [2 ])
139+ xlabel = statespace_names [1 ]
140+ ylabel = statespace_names [2 ]
140141 statespaceax = if is3D
141- zlabel = state_name (idxs [3 ])
142+ zlabel = statespace_names [3 ]
142143 Axis3 (axisposition; xlabel, ylabel, zlabel, axis... )
143144 else
144145 Axis (axisposition; xlabel, ylabel, axis... )
@@ -272,16 +273,17 @@ end
272273# Timeseries extension
273274# ##########################################################################################
274275function DynamicalSystems. interactive_trajectory_timeseries (
275- ds:: DynamicalSystem , fs:: Vector , u0s = [current_state (ds)];
276- linekwargs = isdiscretetime (ds) ? (linewidth = 1 ,) : (linewidth = 3 ,),
277- timeseries_names = [state_name (f) for f in fs],
278- colors = collect (cgrad (COLORSCHEME, length (u0s); categorical = true )),
279- timeseries_ylims = nothing ,
280- timelabel = " time" , timeunit = 1 ,
281- Δt = DynamicalSystems. isdiscretetime (ds) ? 1 : 0.01 ,
282- idxs = 1 : min (length (u0s[1 ]), 3 ),
283- lims = nothing ,
284- kwargs... )
276+ ds:: DynamicalSystem , fs:: Vector , u0s = [current_state (ds)];
277+ linekwargs = isdiscretetime (ds) ? (linewidth = 1 ,) : (linewidth = 3 ,),
278+ timeseries_names = state_name .(fs),
279+ colors = collect (cgrad (COLORSCHEME, length (u0s); categorical = true )),
280+ timeseries_ylims = nothing ,
281+ timelabel = " time" , timeunit = 1 ,
282+ Δt = DynamicalSystems. isdiscretetime (ds) ? 1 : 0.01 ,
283+ idxs = 1 : min (length (u0s[1 ]), 3 ),
284+ lims = nothing ,
285+ kwargs...
286+ )
285287
286288 # automatic limits
287289 if isnothing (timeseries_ylims) || isnothing (lims)
0 commit comments