Hey! I'm trying to recreate something in KNIME I did with SPSS a while back. Among other things I need to visualize the path someone took in a virtual environment. But I don't know if it is possible in KNIME. There is an image attached of what I mean. The overlay inside the coordiante system I did myself after I had the path visualization.
I got the X and Y coordinates at fixed time intervals, and the distance to a given target. Can someone tell me how to get a similar visualization in KNIME?
If there is no such node for path visualization in Knime, I suppose it's possible using the Python integration and matplotlib?
I'm open to suggestions!
Or the R View nodes? If you have the S script for the SPSS visualisation, it might go a long way to the R script you need too
With a little research (I am totally new to this) I found how I could get a path visualization by using geom_path from the ggplot2 package. So I used the Table to R node and connected it to a R View (Workspace) node which contains following script:
locx = rframe$LocationX
x_label = "X"
locy = rframe$LocationY
y_label = "Y"
distance = rframe$Distance
legend_title = "Distance to Target"
id = rframe$ID
trial = rframe$Trial
title = paste("Path of Participant #", id,", Trial: ",trial, sep='')
labels = labs(list( title = title, x = x_label, y = y_label, color = legend_title))
plot <- ggplot(data = rframe, lineend = "round", linejoin = "round", linemitre = 1, arrow = arrow(), show.legend = FALSE, aes(x = locx, y = locy, color = distance, size = 2))
plot <- plot + geom_path() + ylim(-1000, 1000) + xlim(-1000, 1000) + coord_fixed() + guides(size=FALSE)
plot + labels + scale_colour_gradient(limits = c(0, 1400), low = "red", high = "blue", space = "Lab", na.value = "grey50", guide = "colourbar") #+ facet_grid(id ~ trial)
The arguments for ggplot doesn't seem to work properly. The line appears segmented. Does somebody know how to fix that?
To control the line join and line end parameters, you need to put the correspondent arguments into the geom_path() object:
plot <- plot + geom_path(lineend = "round", linejoin = "round")
If you want to have anti-aliasing, you need to export your plots using ggsave(). I recommend exporting them as SVG because it's 2016 and everything else is so much nineties.