I would like to rotate the following latex figure to have the violin vertical (https://tex.stackexchange.com/questions/662974/how-can-i-make-a-violin-plot-in-pgfplots):
begin{filecontents*}{data1.dat}
5 1
6 1
3 1
3 1
7 1
8 1
3 1
8 1
7 1
9 1
5 1
end{filecontents*}
begin{filecontents*}{data2.dat}
12 2
14 2
12 2
8 2
22 2
22 2
12 2
12 2
7 2
12 2
2 2
end{filecontents*}
begin{filecontents*}{data3.dat}
20 3
20 3
21 3
20 3
22 3
21 3
20 3
24 3
22 3
21 3
20 3
end{filecontents*}
documentclass[tikz, border=1 cm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.18}
usepgfplotslibrary{fillbetween}
begin{document}
begin{tikzpicture}
begin{axis}[
xmin=0, xmax=25,
ymin=0, ymax=4,
ytick={1,2,3},
yticklabels={Condition 1, Condition 2, Condition 3},
]
addplot[draw=none] gnuplot[raw gnuplot] {
plot 0; %included to avoid warning of empty plot
set table "kdensity1.dat";
plot "data1.dat" using 1:2 smooth kdensity bandwidth 1.;
unset table;
set table "kdensity2.dat";
plot "data2.dat" using 1:2 smooth kdensity bandwidth 1.;
unset table;
set table "kdensity3.dat";
plot "data3.dat" using 1:2 smooth kdensity bandwidth 1.;
unset table;
};
addplot[draw=none, name path=p1, y filter/.expression={1+0.1*y}] table {kdensity1.dat};
addplot[draw=none, name path=m1, y filter/.expression={1-0.1*y}] table {kdensity1.dat};
addplot[red!50] fill between [of=p1 and m1];
addplot[draw=none, name path=p2, y filter/.expression={2+0.1*y}] table {kdensity2.dat};
addplot[draw=none, name path=m2, y filter/.expression={2-0.1*y}] table {kdensity2.dat};
addplot[green!50] fill between [of=p2 and m2];
addplot[draw=none, name path=p3, y filter/.expression={3+0.1*y}] table {kdensity3.dat};
addplot[draw=none, name path=m3, y filter/.expression={3-0.1*y}] table {kdensity3.dat};
addplot[blue!50] fill between [of=p3 and m3];
end{axis}
end{tikzpicture}
end{document}
I have tried using a scope (https://tikz.dev/tikz-transformations) as follows, but it also changes the shape:
begin{scope}[xslant=-1,yslant=-1]
end{scope}
Would you please have any advice to change the direction of the violins?