Closed aConar closed 1 year ago
Dear Ale,
The add.trajectories function already has that capability. It might not have been obvious from the defaults but one can supply a vector of values, rather than just a single value. For example,
add.trajectories(TA, traj.pch = c(21, 22, 22, 22, 23), …)
will change the symbols of start- and end-points, compared to the interior points. Te trajectory plot is also an S3 generic plot, so one can add points of any color or symbol anywhere in the plot with the points function.
hope this helps!
Mike
On Aug 22, 2022, at 9:32 AM, aConar @.***> wrote:
Dear Mike, I'm working extensively with trajectories. I realize that when there are many trajectories, is visually better to represent them with different colors but its difficult to find a good constrasting palette (in my case 16 trajectories). In this scenario with so many different colors, it would be great if I can change start and end points with a different symbol, more than color, to show the start and end states of the PCVs or trajectories. Kind regards,
Ale
— Reply to this email directly, view it on GitHub https://github.com/mlcollyer/RRPP/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUNU4VVJDZNWTZFB43XFHLV2N6QJANCNFSM57HWFV4Q. You are receiving this because you are subscribed to this thread.
Dear Mike, I have two trajectories with 3 points each. Following your example above I use traj.pch = c(21, 22, 23). I expected end points (21 and 23) and interior point (22) different, but I get this error:
Error: For add.trajectories, traj.pch must be equal in length
to the number of trajectories or just one value
Kind regards,
Ale
Hi Ale,
Unfortunately the traj.pch corresponds to groups and their trajectories, for example, if you wanted group 1 to be pch = 21, group 2 to be pch = 22, etc. The add.trajectories function does not currently have the capabilities you seek, but this is something one can do “by hand” by getting comfortable with the output from a trajectory plot.
Below is an example with the motionpaths example data.
data(motionpaths) fit <- lm.rrpp(trajectories ~ groups, data = motionpaths, iter = 199) TA <- trajectory.analysis(fit, groups = motionpaths$groups, traj.pts = 5)
summary(TA, attribute = "MD")
summary(TA, attribute = "TC", angle.type = "deg")
summary(TA, attribute = "SD")
TP <- plot(TA, pch = 21, bg = as.numeric(motionpaths$groups), cex = 0.7, col = "gray") add.trajectories(TP, traj.pch = 21, traj.bg = 1:4, traj.cex = 0.8)
t.pts <- TP$trajectories t.pts gp1 <- t.pts[[1]] gp1 points(gp1, pch = c(21, 22, 22, 22, 23), bg = c("green", "blue", "blue", "blue", "red"), cex = 1.5)
One could likewise update this for the other three groups. It is a little too challenging to have arguments for between-trajectory formatting and within-trajectory formatting in add.trajetories. Once those capabilities are added to the add.trajectory function, it becomes no simpler than just using the points function as in the example above.
Hope this helps!
Mike
On Feb 20, 2023, at 10:20 AM, aConar @.***> wrote:
Dear Mike, I have two trajectories with 3 points each. Following your example above I use traj.pch = c(21, 22, 23). I expected end points (21 and 23) and interior point (22) different, but I get this error:
Error: For add.trajectories, traj.pch must be equal in length to the number of trajectories or just one value Kind regards,
Ale
— Reply to this email directly, view it on GitHub https://github.com/mlcollyer/RRPP/issues/6#issuecomment-1437183601, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUNU4VDRKXCOLICHJDNI4LWYODSTANCNFSM57HWFV4Q. You are receiving this because you commented.
Dear Mike, I'm working extensively with trajectories. I realize that when there are many trajectories, is visually better to represent them with different colors but its difficult to find a good constrasting palette (in my case 16 trajectories). In this scenario with so many different colors, it would be great if I can change start and end points with a different symbol, more than color, to show the start and end states of the PCVs or trajectories. Kind regards,
Ale