i can't seem figure out why can't plot simplest of dataframes in r
using plotly
. here's example want plot 2d scatter plot of dataframe named b
:
b <- data.frame(cat=c(1, 2, 3, 4, 5), rabbit=c(1.1, 2.2, 3.3, 4.4, 5.5), dog=c(-1, -2, -3, -4, -5)) library(plotly) p <- plot_ly(b, x = cat, y = rabbit, mode= "markers")
if print b
, you'll see it's dataframe of 5 samples, column names cat
, rabbit
, dog
, expected. when execute above in jupyter (don't know if matters), following error:
error in plot_ly(b, x = cat, y = rabbit, mode = "markers"): object 'rabbit' not found
traceback:
- plot_ly(b, x = cat, y = rabbit, mode = "markers")
what doing wrong? far can tell, b
legitimate dataframe, , cat
, rabbit
column names.
Comments
Post a Comment