gcalderone/Gnuplot.jl

multiple boxes in boxplots.

lazarusA opened this issue · 6 comments

If I put the following I get the right boxplot, but with some errors.

using Gnuplot, Random
yv = randn(100)
xv = ones(100)
@gp "set style fill solid 0.25 border -1"
@gp :- "set style boxplot outliers pointtype 7"
@gp :- "set style data boxplot"
@gp :- xv yv "notit" # what I'm suppose to specified here? 

But, if instead I tried this one, I don't get anything useful.

using Gnuplot, Random
yv2 = randn(100,3)
xv2 = ones(100, 3) .+ [1,2,3]'
@gp "set style fill solid 0.25 border -1"
@gp :- "set style boxplot outliers pointtype 7"
@gp :- "set style data boxplot"
@gp :- xv2 yv2 "notit" # what I'm suppose to specified here? 

moreover, it should be possible to simply specify the positions xv2 just once, like

xv2 = [2,3,4]

for the corresponding positions of the boxes, isn't?

Try the following:

x = 4.5
y = randn(1000)
@gp "set style fill solid 0.25 border -1"
@gp :- "set style boxplot outliers pointtype 7"
@gp :- "set style data boxplot"
@gp :- y "u ($x):1:(0.5):2 notit"

Only one box should appear, at x=4.5.

To plot three boxes at x=4.5, 5.5 and 6.5, each with a width of 0.5:

x = repeat([4.5, 5.5, 6.6], inner=100)
y = randn(100, 3)
width = 0.5
@gp "set style fill solid 0.25 border -1"
@gp :- "set style boxplot outliers pointtype 7"
@gp :- "set style data boxplot"
@gp :- x y "u (1):2:($width):1 notit"

Or alternatively:

x = [4.5, 5.5, 6.6]
y = randn(100, 3)
width = 0.5
@gp "set style fill solid 0.25 border -1"
@gp :- "set style boxplot outliers pointtype 7"
@gp :- "set style data boxplot"
for i in 1:3
    @gp :- y[:,i] "u ($(x[i])):1:($width) notit lc rgb 'cyan'"
end

I see, I do still need to send the appropriate commands in gnuplot.

This doesn't work :

x = repeat([4.5, 5.5, 6.6], inner=100)
y = randn(100, 3)
width = 0.5
@gp "set style fill solid 0.25 border -1"
@gp :- "set style boxplot outliers pointtype 7"
@gp :- "set style data boxplot"
@gp :- x y "u (1):2:($width):1 notit"

the others do. Thanks!

Please ensure, your repo is updated.
That example should work.

Oh, it's just that I'm using the stable release for my daily work, I mixed up terminals.

And yes, in dev is working ok.