Skip to content

Instantly share code, notes, and snippets.

@al2na
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al2na/f07335599062ba14c54e to your computer and use it in GitHub Desktop.
Save al2na/f07335599062ba14c54e to your computer and use it in GitHub Desktop.
rcharts NVD3 scatterplot with different shapes and color code adjustment. Works in reveal.js slides
y=readRDS("data/othersmRNA.pca.table.rds")
p1=nPlot(PC2 ~ PC1, data = y,group="cellDisease", type = "scatterChart",
filter="disease")
p1$xAxis(axisLabel = 'PC1')
p1$yAxis(axisLabel = 'PC2')
p1$chart(color = y$color) # color for each dot
p1$chart(sizeRange = c(100,100)) # for dot sizes
#here the magic
p1$chart(scatter.onlyCircles = FALSE) # it sets the js to have only
p1$chart(shape = '#! function(d){return d.shape} !#') # here you hack-in shapes, from the table created earlier
p1$set(height = 600) # set the height of the plot in pixels
p1$show('iframesrc')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment