This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start date: January 5, 2011. Number of days: 45 | |
dates <- seq(as.Date("2011-01-05"), by=1, len=45) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start date: January 5, 2011. End date: March 15, 2011 | |
dates <- seq(as.Date("2011-01-05"), as.Date("2011-03-15"), by=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<title>Creating SVG groups with D3.js</title> | |
</head> | |
<body> | |
<div id="d3group"></div> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="svgpathSVGdata"></div> | |
<script type="text/javascript"> | |
var divElem = d3.select("#svgpathSVGdata"); | |
var svgcanvas = divElem.append("svg:svg") | |
.attr("width", 200) | |
.attr("height", 200); | |
// (1) Specifying path data the SVG way |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="svgpathSVGdata"></div> | |
<script type="text/javascript"> | |
var divElem = d3.select("#svgpathSVGdata"); | |
var svgcanvas = divElem.append("svg:svg") | |
.attr("width", 200) | |
.attr("height", 200); | |
// (1) Specifying path data the SVG way |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var divElem2 = d3.select("#svgpathD3data"); | |
svgcanvas2 = divElem2.append("svg:svg") | |
.attr("width", 200) | |
.attr("height", 200) | |
// (2) Creating path using D3 path data generators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load ggplot2 library | |
require(ggplot2) | |
# create data | |
normalVariate <- rnorm(50, 100, 10) | |
xvalues <- c(1:50) | |
df <- data.frame(xcol=xvalues, ycol=normalVariate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot normalVariate data in data frame, df, using ggplot2 | |
# Most basic plot without customizing any options. | |
plt <- ggplot() + geom_line(data=df, aes(x=xcol, y=ycol)) | |
print(plt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Line plot with custom title for the x-axis (observations) and | |
# y-axis (Value) | |
plt <- ggplot() + geom_line(data=df, aes(x=xcol, y=ycol)) + | |
xlab("Observation") + | |
ylab("Value") | |
print(plt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Line plot with custom color and thickness for the plotted line | |
plt <- ggplot() + geom_line(data=df, aes(x=xcol, y=ycol), | |
color='steelblue', | |
size=1) | |
print(plt) |
OlderNewer