Skip to content

Instantly share code, notes, and snippets.

@mbeltagy
Created July 16, 2015 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbeltagy/a5f5657dc092c8b3cc78 to your computer and use it in GitHub Desktop.
Save mbeltagy/a5f5657dc092c8b3cc78 to your computer and use it in GitHub Desktop.
Box plot on Data Frames
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