Skip to main content
deleted 51 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 2: The answers below addressed the question in OP's comment. Based Based on the accepted answer it now seems that removing the bottom of edge of rectangles is not neededessential. In that case, the option ChartBaseStyle gives the desired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Update 2: The answers below addressed the question in OP's comment. Based the accepted answer it now seems that removing the bottom of edge of rectangles is not needed. In that case, the option ChartBaseStyle gives the desired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Update 2: Based on the accepted answer it now seems that removing the bottom of edge of rectangles is not essential. In that case, the option ChartBaseStyle gives the desired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

deleted 7 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 2: The answers below addressed the question in OP's comment. FromBased the accepted answer, it is now clearseems that removing the bottom of edge of rectangles is not needed.

  In that case, the option ChartBaseStyle gives the resireddesired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Update 2: The answers below addressed the question in OP's comment. From the accepted answer, it is now clear that removing the bottom of edge of rectangles is not needed.

  In that case, the option ChartBaseStyle gives the resired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Update 2: The answers below addressed the question in OP's comment. Based the accepted answer it now seems that removing the bottom of edge of rectangles is not needed. In that case, the option ChartBaseStyle gives the desired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

added 455 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 2: The answers below addressed the question in OP's comment. From the accepted answer, it is now clear that removing the bottom of edge of rectangles is not needed.

In that case, the option ChartBaseStyle gives the resired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Update 2: The answers below addressed the question in OP's comment. From the accepted answer, it is now clear that removing the bottom of edge of rectangles is not needed.

In that case, the option ChartBaseStyle gives the resired result (there is no need for custom ChartElementFunctions):

Histogram[data, ChartBaseStyle -> EdgeForm[Thickness[.01]]]

enter image description here

Histogram[data, ChartStyle -> "Pastel", 
 ChartElementFunction -> "GlassRectangle", 
 ChartBaseStyle -> EdgeForm[{Opacity[1, Red], Thickness[.01]}]]

enter image description here

Update: The ChartElementFunction in the original post works only for the default setting for the option BarOrigin. The new function ceF2 works for arbitrary values for the BarOrigin option.

ceF2[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
 Module[{or = Charting`ChartStyleInformation["BarOrigin"], ll = Tuples[#][[{1, 2, 4, 3}]]},
   ll = RotateRight[ll, Switch[or, Bottom, 0, Top, 2, Left, 3, Right, 1]] ;
   {ChartElementDataFunction[cedf, o][##], 
    col, AbsoluteThickness[thickness], CapForm["Butt"], Line[ll]}] &

Examples:

Grid[Partition[Histogram[data, ChartStyle -> 1, ImageSize -> 300, 
     PlotLabel -> Style["BarOrigin -> " <> ToString[#], 16, "Panel"], 
     ChartElementFunction -> ceF2["FadingRectangle", "GradientOrigin" -> Top][
       Dynamic[Darker@CurrentValue["Color"]], 5], 
     BarOrigin -> #] & /@ {Bottom, Top, Left, Right}, 2]]

Mathematica graphics

Original post:

A more flexible chart element function that modifies built-in chart element functions to add thick lines:

ClearAll[ceF]
ceF[cedf_: "GlassRectangle", o : OptionsPattern[]][col_: Black, thickness_: 3] := 
  {ChartElementDataFunction[cedf, o][##], 
   col, AbsoluteThickness[thickness], CapForm["Butt"],
   Line[Tuples[#][[{1, 2, 4, 3}]]]} &

Examples:

SeedRandom[42];
data = RandomVariate[NormalDistribution[0, 1], 200];

Histogram[data, ChartStyle -> 1, ChartElementFunction -> ceF[][]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle"][Dynamic[Darker@Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, ChartStyle -> 1, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

Histogram[data, 5, ChartStyle -> {Red, Green, Blue, Orange, Cyan, Purple}, 
 ChartElementFunction -> 
  ceF["FadingRectangle", "GradientOrigin"->Top][Dynamic[Darker@CurrentValue["Color"]], 5]]

Mathematica graphics

deleted 174 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
deleted 174 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 1211 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 16 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 320 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading