# Tag Info

26

None of the solutions so far makes use of the fact that the data are percentages and hence add op to (nearly) 100. (* Add the rows of the data list *) Total[Rest /@ data, {2}] (* out *) {99.96, 99.98, 99.98, 99.99, 99.99, 99.99, 99.99, 99.97, 100., 99.99,100., 100.} Borrowing from Pinguin Dirk: BarChart[Rest /@ data ,ChartLayout -> "Stacked" ,...

25

One More way! The means of each data is the blue dot. bars are color coded according to the standard deviation within each sub list. ListLinePlot[Mean /@ data, Prolog -> MapThread[{Thickness[.04], ColorData["SandyTerrain"][#3], Line[{{#2, First@#1}, {#2, Last@#1}}], Opacity[0.7], White, Dashed, Thickness[0.003], Arrowheads[0.025], ...

22

I was sure Histogram can be modified to have the hatching style. Little late but what about this! g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{yval, line}, yval = Range[ymin, ymax, 15]; line = Line /@ Transpose@{Most@({xmin, #} & /@ yval),Rest@({xmax, #} & /@ yval)}; {FaceForm[White],Polygon[{{xmin, ymin}, {xmax, ymin}, {xmax, ymax}, {...

22

Here's my contribution for the first type of chart: bins = Tally @ Ceiling[data, 5]; labelfn = Text[HoldForm[# °], 8 {Sin[# °], Cos[# °]}] &; ptfn = Rotate[Point @ Thread @ {10 + Range@#2, 0}, Pi/2 - # °, {0, 0}] &; linefn = Rotate[Line[{{9.5, 0}, {10, 0}}], Pi/2 - # °, {0, 0}] &; Graphics[{ Circle[{0, 0}, 10], labelfn /@ {0, 90, 180, ...

22

I think you could achieve what you want by overlaying two Histogram objects, one with no Edges but colored bars, the second one with Edges, but transparent bars, as in this example: data = RandomVariate[NormalDistribution[10, 2], 500]; Show[{ Histogram[data, ChartStyle -> Directive[Opacity, EdgeForm[AbsoluteThickness]]], Histogram[data, ...

20

Since nobody who supposedly thought this was a good question seems actually to have wanted to write an answer, here is one from me. Let us define a bimodal distribution: dist = MixtureDistribution[ {0.6, 0.4}, {NormalDistribution[-0.8, 1.3], NormalDistribution[2.7, 0.4]} ]; pdfplot = Plot[PDF[dist, x], {x, -5, 5}] To simulate your data we draw some ...

20

Out of curiosity I tried this: DistributionChart[Rest /@ data, ChartLabels -> {data[[All, 1]]}, ChartElementFunction -> "HistogramDensity", ChartStyle -> {LightRed, LightGreen, LightBlue}, BarOrigin -> Left] As for 'interpretation', here's my attempt. This type of chart tries to show the distribution of the values in each 'row'. The ...

19

The function f takes as arguments the raw, unbinned data, the number of sectors, and a boolean parameter to indicate whether polar gridlines are to be drawn. data = {8, 9, 13, 13, 14, 18, 22, 27, 30, 34, 38, 38, 40, 44, 45, 47, 48, 48, 48, 48, 50, 53, 56, 57, 58, 58, 61, 63, 64, 64, 64, 65, 65, 68, 70, 73, 78, 78, 78, 83, 83, 88, 88, 88, 90, 92, 92, 93, 95,...

17

Since nobody has used this function yet, I will place it here. Your data seems to be organised almost perfectly for ArrayPlot. First I removed the first column from the rest of the values and added to the axes ticks. The rest is just displayed via ArrayPlot, with a particular color scale. {xs, values} = {First[#], Transpose@Rest[#]} &@Thread@data; ...

17

The underlying problem is that Histogram creates a set of Rectangles which represent the bars. You can inspect this by looking at the underlying form of the created graphics h = Histogram[RandomVariate[NormalDistribution[10, 2], 500], Automatic, "PDF", PerformanceGoal -> "Speed"]; InputForm[h] This reveals that each bar in the histogram is ...

17

Here's a similar figure with made-up data: dist1 = NormalDistribution[0.002, 1/100]; dist2 = NormalDistribution[-0.002, 1/10]; randomWalk[] := NestWhileList[# + 0.7 RandomVariate[dist1] + 0.3 RandomVariate[dist2] &, 0.5, 0 < # < 1 &]; SeedRandom {foo, res} = Reap[Do[Sow[Length@#, Clip[Last@#, {0, 1}]] &@randomWalk[], {...

16

I would do something like: t = RandomVariate[NormalDistribution[0, 1], 10000]; a = Histogram[t, 30, ChartStyle -> White]; b = Histogram[t, 30, ChartElements -> Graphics[{Black, Line[{{0, 0}, {1, 1}}]}]]; Show[a, b]

16

Here's my take at replicating your circular plot. To get the ticks right isn't as easy as one might think, there is no option to put the ticks on the inside of the circle. The ticks will have to be produced manually... CircularDotHistogram[data_, n_, clockwise_: True] := Module[{hist, pts, deg2rad, angdata}, hist = HistogramList[data, n][]; deg2rad[...

16

Here is a bit clumsy (had very little time) approach виа combination of new functionality Entity and regions. (* get the states *) divisions = EntityValue[Entity["AdministrativeDivision", {_, "UnitedStates"}], "Entities"]; (* get polygons of borders *) dat = EntityValue[ divisions, {"Population", "Polygon"}] /. {GeoPosition -> Identity, ...

16

For the case where the height function is "Count", we can use the formula from the linked page in a custom ChartElementFunction with the sample size (Length[data]) passed as metadata: ceF[d_: .2, nsd_: 3, color_: Automatic][cedf_: "Rectangle"] := Module[{e = nsd /2 Sqrt[#[[2, 2]] (1 - #[[2, 2]]/ #3[])]}, {ChartElementData[cedf][##], Thick, ...

15

data1 = RandomVariate[NormalDistribution[0, 1], 1000]; data2 = RandomVariate[NormalDistribution[0.3, 1], 1000]; One way is PairedHistogram PairedHistogram[data1, data2] A different layout can be achieved by hacking the height specification of Histogram. Show[ Histogram[data1, Automatic], Histogram[data2, Automatic, -#2 &] ] Update In practice, ...

15

Here is something using a custom ChartElementFunction Module[{c = 0}, half[{{xmin_, xmax_}, {ymin_, ymax_}}, data_, metadata_] := (c++; Map[Reverse[({0, Mean[{xmin, xmax}]} + # {1, (-1)^c})] &, First@Cases[ First@Cases[InputForm[SmoothHistogram[data, Filling -> Axis]], gc_GraphicsComplex :> Normal[gc], ∞], ...

15

ClearAll[toSimplex, nF] toSimplex = #[] {1, 0} + #[] {1, Sqrt@3}/2 &/@(Normalize[#, Total[#]/Max[#] &]&/@#)&; n = 10; centroids = N[RegionCentroid /@ triangles[n]]; nF = Nearest[centroids -> "Index"]; SeedRandom pts0 = RandomReal[{0, 1}, {1000, 2}]; pts = toSimplex @ pts0; groups = GatherBy[pts, nF[#, 1] &]; ...

14

Here is extended version of PlatoManiac's solution which allows changing of the direction of the hatching and also tuning the distance between hatches: g[step_?NumberQ][{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{yval, lines, xstart, xend}, yval = Range[ymin, ymax, Abs[step]]; If[step > 0, {xstart, xend} = {xmin, xmax}, {xstart, xend} = {...

14

As discussed in the comment, it seems you want: BarChart[Rest /@ data, ChartLabels -> {data[[All, 1]], None}, BarSpacing -> {0, 2}] see other options in BarChart to format as you desire (as I do not know what it is for, it's hard to suggest other things), bonne chance! or a version with labels for the bars, placed above the bars (see ...

14

I just so happen to have a 4GB data file laying around, so I thought I might give this a try. My data file has one floating point number per line and the number of lines is wc -l datafile.dat 264627000 datafile.dat so a good 264 million data points. Trying to Import it, temp = Import["datafile.dat"]; takes longer than it took to clean my office so I ...

13

The FrameTicks specification changed in v6. Previously, the form {right, bottom, left, top} was used, but in v6, it was changed to {{left, right}, {bottom, top}} To maintain compatibility between the versions, the older form is still allowed for the older plots. But, quite a few plots were added since that point (e.g. Histogram was added in v7), and ...

13

Why not just assemble the chart from rectangles? data = {{-6.65, 55}, {-6.45, 15}, {-6.27, 10}, {-6, 5}, {-5.85, 3}, {-6.46, 6}, {-6.25, 3}, {-6.17, 2}}; Graphics[{EdgeForm[{Thick, Black}], RGBColor[0.3, 0.4, 0.4], Rectangle[{#1 - 0.05, 0}, {#1 + 0.05, #2}] & @@@ data}, Frame -> True, AspectRatio -> 0.7, FrameLabel -> {"Binding Energy", "...

13

You can simply get the SmoothKernelDistribution and build the plot as you'd like: data = Table[Sin[x]^3 + 1, {x, 0, 6 Pi, 0.1}]; dist = SmoothKernelDistribution[data]; LogLogPlot[PDF[dist, x], {x, 0.01, 2}]

13

Ideally you could have used the ColorFunction option, but sadly for Histogram it seems that it only takes the height as an input. You can hack it by combining two histograms: With[{d = RandomVariate[NormalDistribution[], 1000]}, Show[ Histogram[Select[d, # < 0 &], PlotRange -> {{Min[d], Max[d]}, Automatic}], Histogram[Select[d, # >= 0 &...

13

I believe that when you specify "PDF", the value on the ordinate is the average probability density within a given bin. And to get the "within-this-bin" probability, you need to multiply the ordinate by the bin width (5 in this case); and that's what you get when you specify the "Probability" option.

12

You can use the PDF of a HistogramDistribution for the outline. dist = HistogramDistribution[T, 30] p1 = Plot[PDF[dist, t], {t, -4, 4}, PlotStyle -> Black, Exclusions -> None, PlotPoints -> 100]; p2 = Histogram[T, 30, "PDF", ChartElements -> Graphics[{Black, Line[{{0, 0}, {1, 1}}]}]]; Show[p1, p2] The problem here is that it isn't a ...

12

Here's another approach : (* divide polygon pts to clean up artificials when polygon has holes *) FindContourBreaks[pts_List] := Module[{i, lines, breaks = {}}, lines = {pts[[#[]]], pts[[#[]]]} & /@ Partition[RotateLeft[Flatten[{#, #} & /@ Range[Length[pts]], 1]], 2]; Position[lines, Alternatives @@ ...

11

Thanks to ybeltukov I realised that post-processing way is not so bulletproof. Let's write a little bit longer solution to take control. ChartElementFunction, is a handy way to deal with this (only a little bit adapted example for documentation): f[{{xmin_, xmax_}, {ymin_, ymax_}, {zmin_, zmax_}}, ___] := { RGBColor[Mean[{xmin, xmax}], Mean[{...

11

Update: We can use WeightedData to represent binned data and work with it in the usual way: values = MovingAverage[First[bins], 2]; weights = Last[bins]; binsize = bins[[1,2]] - bins[[1,1]] (* assuming a constant bin size!! *) distr = HistogramDistribution[WeightedData[values, weights], {binsize}] Original answer: HistogramDistribution creates a ...

Only top voted, non community-wiki answers of a minimum length are eligible