Highlight the graph between points in histogram with intervals

Hello, can someone please advise me how I should do this graph:

data = {13, 13.1, 13.2, 13.3, 14.5, 12.6, 11.3, 12.1, 10.5, 10.3, 10.7, 10.1}
Histogram[data, {Min[data], Max[data], 0.3}]
point1 = 12
point2 = 13

I have entered data and histogram. I have awarded points “point1 point2”
I need to highlight the graph between points.

I need this:

Thank you for the advice :slight_smile: :slight_smile: :slight_smile:

Hi Martin, a quick and dirty way could be this:

data = {13, 13.1, 13.2, 13.3, 14.5, 12.6, 11.3, 12.1, 10.5, 10.3, 10.7, 10.1} ; 
point1 = 12; point2 = 13;
Show[Histogram[data, {Min[data], Max[data], 0.3}],
 Graphics[{Blue, Opacity[.5], Rectangle[{point1, 0}, {point2, 1.3}]}]]

giving:

Regards – Henrik

Thank you for answer :slight_smile:
and it is only paint the picture chart? Or that Mathematica can not.

This should work:

col1 = RGBColor[0.987, 0.807, 0.495];
col2 = Lighter@Blue;
f[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] :=
 Piecewise[{
   {{col1, Rectangle[{xmin, ymin}, {xmax, ymax}]}, 
    xmin >= point2 || xmax <= point1},
   {{col2, Rectangle[{xmin, ymin}, {xmax, ymax}]}, 
    xmin >= point1 && xmax <= point2},
   {{col1, Rectangle[{xmin, ymin}, {point1, ymax}], col2, 
     Rectangle[{point1, ymin}, {point2, ymax}], col1, 
     Rectangle[{point2, ymin}, {xmax, ymax}]}, 
    xmin < point1 && xmax > point2},
   {{col1, Rectangle[{xmin, ymin}, {point1, ymax}], col2, 
     Rectangle[{point1, ymin}, {xmax, ymax}]}, xmin < point1},
   {{col2, Rectangle[{xmin, ymin}, {point2, ymax}], col1, 
     Rectangle[{point2, ymin}, {xmax, ymax}]}, xmax > point2}
   }]
Histogram[data, {Min[data], Max[data], 0.3}, 
 ChartElementFunction -> f]

Thank you :slight_smile: