r - Creating a hexplot -
i trying create figure 1 depicted in third column of following image:
link image in case of backup.
basically have x , y positions of 200 particles , have msd data these 200 positions. i'd msd value should determine color map particles in coordinates (x,y)
. msd should height, or z
position corresponding each particle in (x,y)
.
i surprised @ incompetence, because have been trying solve problem last couple of days none of google searches gave me result. closest thing have found concept of "self-organizing map" in matlab , r, not know how use r , matlab's toolbox som utterly useful needs.
i tried following code in matlab , attached plot result:
clear all; close all; clc; x = (dlmread('xdata.dat'))'; % x 1x200 array y = (dlmread('ydata.dat'))'; % y 1x200 array msd = (dlmread('msd_field.txt'))'; % msd 1x200 array [x,y] = meshgrid(x,y); z = meshgrid(msd); z = [x; y; z]; surf(z)
but think plot not useful @ all. want 2d scatter plot of (x,y)
depicting particle positions , on top of color code scatter plot values stored in msd plot showed in beginning. how can create through matlab, or other visualization tool? thank in advance.
it not clear whay want have. here scatter plot using ggplot2
.
## reproducible data set.seed(1) dat <- data.frame( x = round(runif(200,-30,30),2), y = round(runif(200,-2,30),2), msd = sample(c(0,2,3),200,rep=t)) ## scatter plot size/color of points depends in msd library(ggplot2) ggplot(dat) + geom_point(aes(x,y,size=msd,color=msd)) + theme_bw()
Comments
Post a Comment