# FillingStyle Thickness Distorting ListPlot image

I'm trying to create a histogram using ListPlot using the Filling->Axis and FillingStyle -> {{LightGray, Thickness[.1]}} as options. However, when I use this the columns are actually higher than the value in the lists. Below is an example

   n = 6;
p = 0.5;
(*calculate probabilities *)
list = Table[
c = Binomial[n, k];
d = p^k (1 - p)^(n - k);
{k, c* d}, {k, 0, n}]

top of each column*)
ListPlot[(list),
Joined -> False,
Axes -> True,
FrameTicks -> {Table[i, {i, 0 , n, 1}],
Table[i, {i, 0, 0.3, 0.05}]},
FrameLabel -> {"Successes k", "Probability"},
Frame -> {True, True, False, False},
PlotStyle -> Automatic,
Filling -> Axis,
FillingStyle -> {{LightGray, Thickness[.1]}},
ImageSize -> 6*72 ]


Does anyone have a suggestion for a solution for this problem while still using ListPlot?

Thanks,

Mike

This can be controlled by CapForm

ListPlot[(list), Joined -> False,
FrameTicks -> {Table[i, {i, 0, n, 1}], Table[i, {i, 0, 0.3, 0.05}]},
FrameLabel -> {"Successes k", "Probability"},
Frame -> {True, True, False, False}, PlotStyle -> Automatic,
Filling -> Bottom,
FillingStyle -> {{LightGray, Thickness[.1], CapForm[None]}},
ImageSize -> 6*72] • Never knew about CapForm, but it's exactly what I needed. Thanks! Jan 20, 2014 at 19:08
BarChart[Labeled[#2, #1] & @@@ list] As you figured out, the Thickness command applies to the width of the Filling line in both the horizontal and vertical directions. I don't see how to make the boxes wider without also increasing their maximum height.

Here is a quick and dirty way to get what you want:

ListPlot[Flatten[
Table[{list[[n, 1]] + dx, list[[n, 2]]}, {n,
Length[list]}, {dx, -.2, .2, .001}], 1], Filling -> Axis,
FillingStyle -> Directive[LightGray, Thickness[.001]],
PlotStyle -> None, Epilog -> First@ListPlot[list]] Edit: This is a better way to get what you are looking for.

    dx = 0.2; (*half width of the rectangles *)
Show[Table[
Graphics[{LightGray,
Rectangle[{list[[n, 1]] - dx, 0}, {list[[n, 1]] + dx,
list[[n, 2]]}]}], {n, Length[list]}], ListPlot[(list)],
PlotRange -> {0, All},
FrameTicks -> {Table[i, {i, 0, n, 1}], Table[i, {i, 0, 0.3, 0.05}]},
FrameLabel -> {"Successes k", "Probability"},
Frame -> {True, True, False, False}, AspectRatio -> .6,
ImageSize -> 6*72] (Although, as belisarius pointed out, you can use BarChart to get what you want, but you'll need to fiddle around with it to get better looking results).

I think you need to make some compromise for creating histogram by using ListPlot...I would suggest...

PlotStyle ->PointSize[Large],
Filling -> Axis,
FillingStyle -> {{LightGray, {Thickness[.025]}}} Or use barchart