Hello, using Julia 1.5 on Atom, I want to make a boxplot comparing values from different dataframes. It is almost how I want it, but the x label needs to be fixed and I can’t figure it out. I used the series plot recipe, but I think it doesn’t work as I expect because the data are from different dataframes.
using DataFrames, StatsPlots
df1 = rand(5, 5)
df2= rand(5, 5)
df3 = rand(5, 5)
df4 = rand(5, 5)
df5 = rand(5, 5)
df1= DataFrame(df1)
df2= DataFrame(df2)
df3= DataFrame(df3)
df4= DataFrame(df4)
df5= DataFrame(df5)
@df df1 boxplot(:x1, title = "Comparing", ylabel = "Target biomass ratio", label = "10 animals")
@df df2 boxplot!(:x1, label = "25 animals")
@df df3 boxplot!(:x1, label = "50 animals")
@df df4 boxplot!(:x1, label = "75 animals")
@df df5 boxplot!(:x1, label = "100 animals", leg = false)
boxplot!(xlabel = ["10 animals", "25 animals" ,"50 animals", "75 animals", "100 animals"])
Producing this, which is close, but I don’t the numbers 1 through 5 and neither the quotation marks or square brackets around the x labels.
In the future I want to include more dataframes, but have them grouped by the same x label. So
df1 = rand(5, 5)
df2= rand(5, 5)
df3 = rand(5, 5)
df4 = rand(5, 5)
df5 = rand(5, 5)
df6 = rand(5, 5)
df7 = rand(5, 5)
df8 = rand(5, 5)
df9 = rand(5, 5)
df10 = rand(5, 5)
df1= DataFrame(df1)
df2= DataFrame(df2)
df3= DataFrame(df3)
df4= DataFrame(df4)
df5= DataFrame(df5)
df6= DataFrame(df6)
df7= DataFrame(df7)
df8= DataFrame(df8)
df9= DataFrame(df9)
df10= DataFrame(df10)
With df1
and df6
having the same, singular label of “10 Animals” etc. Is there a way to do this? A work colleague suggested R and the melt function, but that is quite confusing to me and I’d rather work in Julia.