Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Remapping trajectories to both sides (sorta)

edited January 2019 in Mousetrap

I may be overthinking this question...

I have responses that I've counterbalanced across participants. Half of people saw "BLUE" on the left and "PURPLE" on the right and half saw "PURPLE" on the left and "BLUE" on the right. However, I'd like to graph them without remapping them all to one side. (I suspect there's an inherent motor bias and I'd like to look at the trajectories going to different sides of the screen to check this out).

I tried using the following code from your paper Pascal but it remapped trajectories so that all factors were going to both sides.

d.var$side <- ifelse(d.var$response_get_RESP==d.var$RESP_LEFT, "left", "right")

MT <- mt_remap_symmetric(MT, remap_xpos = "no")

mt_plot_aggregate(MT2, use = "tn_trajectories", points = F, x = "xpos", y = "ypos", subject_id = "subject_nr", color = "RESPxCOLOR", linetype = "side", facet_col = "TRIAL")

The code above maps both BLUE and PURPLE responses to both left and right.

What I want is all BLUE responses to be mapped to the left and all PURPLE responses to be mapped to the right (even though they were counter balanced across participants). Then the trajectories can be broken down by my other factor (color: blue, purple, ambiguous). Three trajectories to the blue response in the left corner, three trajectories to the purple response in the right corner.


  • Hi Mike,

    I think the following example illustrates what you would like to do:

    # Import example raw data
    mt_data <- mt_import_mousetrap(mt_example_raw)
    # We assume a centered coordinate system.
    # If not, you can use mt_align_start to center the start position horizontally
    # Remap all trajectories up and to the left
    mt_data <- mt_remap_symmetric(mt_data)
    # Define remapping vector, one value for each trajectory
    # -1 means that typical trajectories will be mirrored to the right
    remap_vector <- ifelse(mt_data$data$Condition=="Typical", -1, 1)
    # Remap typical trajectories to the right
    mt_data$trajectories[,,"xpos"] <- mt_data$trajectories[,,"xpos"]*remap_vector
    # Time-normalize trajectories
    mt_data <- mt_time_normalize(mt_data)
    # Plot trajectories
    mt_plot(mt_data, use="tn_trajectories", color = "Condition")

    Let me know if you have any questions when adapting it to your purpose.



Sign In or Register to comment.