I've done a cluster analysis on a set of datapoints (listV) and used Mathematica to obtain a smoothed histogram with the x and y axes inverted. To aid visualisation I would like to fill the area underneath the histogram towards the y axis beginning at a value for each histogram determined from the earlier cluster analysis (lets call this A1), with width equal to the standard deviation determined from the analysis as well (A1 ± S1; shown in listA). There is a crude cartoon (Sorry - Paint!) of how it would look like next to a plot of the clusters in question. Due to inverting the x/y axis the Filling command does not seem to work.
My question is if it would be possible to fill this area for all four datasets in the plot?
I've also tried RegionPlot but have not managed to get it to work as yet (and am still trying!). A shortened version of the code is shown below. Thanks!
listA={{A1, S1},{A2, S2},{A3, S3},{A4, S4}}
listV = {data1[[All, 2]], data2[[All, 2]], data3[[All, 2]], data4[[All, 2]]};
sHV = SmoothHistogram[listV, 0.881, "PDF",
PlotRange -> {Automatic, Automatic},
ImageSize -> {500, 300},
PlotRange -> {1, 2.5},
];
plotSHV =Show[sHV /. x_Line :> Reverse[x, 3], PlotRange -> {Automatic, {1, 2.5}}, AxesOrigin -> {0, 1}]
What was done in the end:
Thank you for the answers. After working a bit more on it I've used the answers below in combination with Jens' function here, so that the smoothed histogram plots are stacked and look less cluttered. I'm pretty happy so far with the result. I've included the code below. Probably (definitely) not the cleanest, but I hope it helps anyone with a similar problem.
plots1 = {{
Show[
{
SmoothHistogram[data1[[All, 2]], hData1, "PDF"],
SmoothHistogram[data1[[All, 2]], hData1, "PDF",
PlotRange -> {{2, 9}, {0, 0.5}}, Filling -> Axis,
FillingStyle -> Opacity[0.75, data1Colour],
RegionFunction ->
Function[{x, y}, data1shadeMin < x <data1shadeMax]]
}
/.
{
x_Line:>GeometricTransformation[Rotate[x, -Pi/2, {0, 0}],ReflectionTransform[{0, 1}]],
x_Polygon:>GeometricTransformation[Rotate[x, -Pi/2, {0, 0}],ReflectionTransform[{0, 1}]]
},
plotSettings,
PlotRange -> {Automatic, {2, 9}},
AxesOrigin -> {0, 2}
],
(*Other plots are omitted, they are just a repeat of this one.*)
}}
plotSHdata1 = Show
[
Rasterize[Grid[{{plotdata1, plotGrid[plots1, 400, 300]}}]],
Graphics[{Thick, Black,
Line[{ImageScaled[{0.3, 0.62}], ImageScaled[{0.96, 0.62}]}]}],
Graphics[{Thick, Black,
Line[{ImageScaled[{0.15, 0.495}], ImageScaled[{0.67, 0.495}]}]}],
Graphics[{Thick, Black,
Line[{ImageScaled[{0.16, 0.48}], ImageScaled[{0.774, 0.48}]}]}],
Graphics[{Thick, Black,
Line[{ImageScaled[{0.29, 0.54}], ImageScaled[{0.874, 0.54}]}]}],
Epilog -> {
Inset[
SwatchLegend[{Orange, Green, Blue, Red}, {1, 2, 3, 4},
LegendLayout -> "Row", LegendFunction -> Framed,
LabelStyle -> {FontSize -> 17}, LegendMarkerSize -> {12}]
, ImageScaled[{0.78, 0.063}]
],
Style[{Text["label", ImageScaled[{0.585, 0.97}]]}, labelColour,
labelFont],
Style[{Text["Probability Density Function (PDF)",
ImageScaled[{0.78, 0.16}]]}, labelColour, labelFont]
}
]