Conditioning
Brian Mulloy, one of the founders of Swivel, wrote a nice comment on my post explaining how Swivel is in fact able to condition on data categories. For example, if you want to do a graph highlighting a particular category, or even using only data from a particular category, you are able to. The process has to start in the dataset view.
See his comment for the full explanation.
I guess I have to spend more time on it, but it still doesn’t seem to be able to do what I want. I downloaded my own data in csv format and created a couple of figures using the ggplot package in R. I don’t expect Swivel to have the same flexibility, since its objectives are very different from those of an academic statistical software. However, I don’t see why in the not so distant future something like this would be possible in a web application.
The code:
## load packages
library(ggplot)
## read data
data <- read.csv("data.csv")
## get the largest parties
l6p <- names(sort(table(data$Party),decreasing=TRUE))[1:10]
## get the largest states
eel6s <- names(sort(table(data$State),decreasing=TRUE))[1:6]
## data subset with largest parties and largest states
data <- subset(data,(Party%in%l6p)&(State%in%l6s),drop=TRUE)
##Plain
png(file="plot1.png")
qplot(X1st.Dimension,X2nd.Dimension,data=data)
graphics.off()
##color by party
png(file="plot2.png")
qplot(X1st.Dimension,X2nd.Dimension,data=data,col=Party)
graphics.off()
##color by party, one plot per state
png(file="plot3.png")
qplot(X1st.Dimension,X2nd.Dimension,facets=State~.,col=Party,data=data)
graphics.off()
##histogram per state
png(file="plot4.png")
qplot(X1st.Dimension,facets=State~.,data=data,type="histogram")
graphics.off()

