Simple Plots
You can create a simple plot by running a console in your favorite language.
To create a simple plot, run a console in your favorite language and paste in the
following code sample:
R
# A standard R plot
plot(rnorm(1000))
# A ggplot2 plot
library("ggplot2")
qplot(hp, mpg, data=mtcars, color=am,
facets=gear~cyl, size=I(3),
xlab="Horsepower", ylab="Miles per Gallon")
Python
import matplotlib.pyplot as plt
import random
plt.plot([random.normalvariate(0,1) for i in xrange(1,1000)])
Cloudera Data Science Workbench processes each line of code individually (unlike
notebooks that process code per-cell). This means if your plot requires multiple commands,
you will see incomplete plots in the workbench as each line is processed.
To get around this behavior, wrap all your plotting commands in one Python function.
Cloudera Data Science Workbench will then process the function as a whole, and not as
individual lines. You should then see your plots as expected.