Created
July 16, 2015 16:03
-
-
Save mbeltagy/a5f5657dc092c8b3cc78 to your computer and use it in GitHub Desktop.
Box plot on Data Frames
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
function dataframeplot(d::DataFrame,facsym,idsym) | |
factors=sort(unique(d[facsym])) #We need this to do the boxpols | |
numpoints=size(d,1) | |
numfactors=length(factors) | |
data=Array(Array{Float64},numfactors) | |
for i=1:numfactors data[i]=[] end | |
for i=1:numpoints | |
idvar=d[idsym][i] | |
fac=d[facsym][i] | |
for j=1:numfactors | |
if factors[j]==fac | |
push!(data[j],idvar) | |
break; | |
end | |
end | |
end | |
boxplot(data,0,"wo",labels=factors) | |
xlabel(string(facsym)) | |
ylabel(string(idsym)); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment