Hot answers tagged

25

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" ,...


22

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], ...


18

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 ...


16

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; ...


13

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 ...


8

There are two problems. One is that in your DSolve call, you should solve for the functions {a, b, ...} instead of the expressions {a[t], b[t],...}. (In my experience, it's almost always better this way.) The other is that to get the proper list structure for BarChart, you should use First@DSolve[..] to remove an unnecessary `{}. dsol = First@ DSolve[{...


8

Histogram does not support a grouped ChartLayout. Hence the workaround using BarChart: I've arranged the 'histogram' into a bar chart so that the data can be displayed side by side. An alternative to using BarChart with "Grouped" layout is to use a custom ChartElementFunction to produce the desired Histogram layout: ClearAll[groupedHistogram] ...


7

Perhaps this: Get the tick values: ticks = FrameTicks /. Options[First @ bars, FrameTicks] Get the x tick values: xticks = ticks[[2, 1, All, 1]] Visualize the x tick values with dots on top of the bar chart: Show[bars, Graphics[{AbsolutePointSize[4], Point[{#, 0}]} & /@ xticks]] This gives you all the center points of each bar, but also ...


7

Here is a version that builds up the "full Tufte" version of the plot presented above by building up the corresponding Graphics primitives. Quite a few styling decisions must be made with respect to colors, spacings, overall aspect ratio of the plot, etc. I went with choices that were aesthetically pleasing to me, but of course it should be relatively easy ...


7

A solution for PieChart aficionados: GraphicsGrid[Partition[ Table[PieChart[(Rest /@ data)[[i]], ChartLabels -> Placed[Range[8], "RadialOutside"], PlotLabel -> data[[i, 1]]], {i, Length[data[[All, 1]]]}], 4], ImageSize -> 400] Or, if you are interested in the temporal evolution of each process: GraphicsGrid[Partition[ Table[...


7

Rather than Show, you can use Prolog + Inset with Scaled: Plot[ 140 PDF[SmoothKernelDistribution[#], x] & /@ {S086, T086, X086}, {x, 0, 100}, Evaluated -> True, PlotStyle -> { {Thickness[0.01], RGBColor[0.23, 0.42, 0.63]}, {Thickness[0.01], RGBColor[0.29, 0.53, 0.80]}, {Thickness[0.01], RGBColor[0.62, 0.73, 0.88]}}, Frame -> True,...


7

Update Using @kglr suggestions to overcome Histogram3D's ColorFunction limitation. Histogram3D[ Flatten[MapIndexed[ConstantArray[#2, #1] &, #, {2}], 2] & /@ {terrain, water}, Automatic, "Count", ChartLayout -> "Stacked", ChartStyle -> {Opacity[1], Blue}, ChartElementFunction -> {ChartElementDataFunction[ "GradientScaleCube", "...


6

Module[{data, range}, data = TimeSeries[#, ResamplingMethod -> {"Constant", 0}] &@{{1891, 1}, {1892, 1}, {1897, 1}, {1898, 1}, {1903, 1}, {1904, 1}, {1905, 1}, {1908, 4}, {1909, 6}, {1910, 6}, {1911, 16}, {1912, 33}, {1913, 35}, {1914, 43}, {1915, 39}, {1916, 31}, {1917, 42}, {1918, 52}, {1919, 44}, {1920, 53}, {1921, 33}, {...


6

Depending on exactly what you're trying to do, adding Frame->{False,True,False,False},Axes->{True,False},PlotRangePadding->None to keep your x axis and use only the frame on the y-axis should work. BarChart[{{0.123, 0.492}, {2.865, 0.055}, {1.03, 1.084}, {4.282, 0.053}} , AxesLabel -> {None, Rotate["Value", 90 Degree]} , ChartLabels -> ...


6

The data in the question presents a good case for visualization with Chernoff faces. For that data, actually, the Chernoff faces work "out of the box" pretty well! Make faces Load Chernoff faces plotting package: Import["https://raw.githubusercontent.com/antononcube/\ MathematicaForPrediction/master/ChernoffFaces.m"] As it is explained in the question ...


6

You can divide all of your data by 1/10th of the smallest absolute value before doing the log transform. This essentially scales the data to all have logs greater than one without adding a discontinuity on your axis. Then you can show the sign*log of positive and negative values from your original data on the same axis. d = {-3.7*^-7, -1.81*^8, 1.5*^6, -5.3*...


6

Why not simply data = Table[RandomInteger[{1, 20}], {20}]; Define the partition par = {{1, 8}, {9, 13}, {14, 16}, {17, 20}}; Plot BarChart[ Take[data, #] & /@ par, ChartLabels -> {{"1st", "2d", "3rd", "4th"}, CharacterRange["a", "t"]}] Update bar = BarChart[ data, ChartLabels -> CharacterRange["a", "t"]]; lip = ListPlot[ ...


6

I'm not sure whether this is documented or not. You can pass additional arguments to the ChartElementFunction like this: r[{{xmin_, xmax_}, {ymin_, ymax_}}, y_, {origin_}] := Rectangle[{xmin, ymin + origin}, {xmax, ymax + origin}] BarChart[{{1} -> 1, {1} -> 2, {2} -> 3}, ChartElementFunction -> r] edit Perhaps ...


5

I assume it is asked to find the tallies for (1) "source", (2) "target", and (3) the sequence of words "source", "and", "target". If that is the case this code does it. words = {"source", "source", "and", "target", "source", "and", "target", "target", "source", "and", "target", "target", "source", "and", "target", "target", "target", "target", "...


5

I figured it out -- turns out the default opacity is not 1 for the borders, making them appear gray. I modified EdgeForm: EdgeForm[{Thickness[thick], Black, Opacity[1]}] and it worked just fine.


5

Is this helpful? Grid[Partition[BarChart /@ (Transpose[Thread[{#1, ##2}] & /@ data]), 4]] You could standardize the plot range.


5

This isn't pretty, but it works: BarChart[{ {Labeled[1,"c1"],Labeled[3,"c2"],Labeled[4,"c3"]},{Labeled[4,"c4"], Labeled[5,"c5"]}}, ChartLabels -> {{"r1","r2"},None} ]


5

A small change to the LabelingFunction seems to do the trick: BarChart[{{0.123, 0.492}, {2.865, 0.055}, {1.03, 1.084}, {4.282, 0.053}}, AxesLabel -> {"", "Value"}, ChartLabels -> {Placed[{"data1", "data2", "data3", "data4"}, {{0.5, 0}, {0.8, 1.2}}, Rotate[#, (1.75/7) Pi] &], Placed[{"", ""}, Above]}, LabelingFunction -> ( ...


5

bar = BarChart[{{4, 4, 1, 0.05}, {3, 3, 1, 1}, {1, 1, 2, 2}, {2, 2, 4, 4}}] c = Cases[bar[[1]], _RGBColor, Infinity] Union@c // InputForm {RGBColor[0.4992, 0.5552, 0.8309304], RGBColor[0.7116405333333333, 0.4816, 0.5483194666666666], RGBColor[0.928, 0.5210666666666667, 0.2], RGBColor[0.982864, 0.7431472, 0.3262672]}


4

While not a Bar Chart per se, I usually prefer to use the result from HistrogramList directly with ListPlot and then join the points with InterpolationOrder->0. SeedRandom[1465]; data = RandomVariate[NormalDistribution[0, 1], 1000]; mapoints=Thread[{#[[1]], Append[#[[2]], 0.0]}] &@HistogramList[data]; ListPlot[mapoints, Joined -> True, ...


4

Maybe here's a small improvement Show[ bars, ListLinePlot[means, DataRange -> {2.6, 19}], ListPlot[means, DataRange -> {2.6, 19}], GridLines -> {{2.6, 6.7, 10.8, 14.9, 19}, {1, 2, 3, 4}}, ImageSize -> Large, ImagePadding -> {{10, 10}, {10, 10}}] The gridlines run through the centers of the "meshpoints" and are uniformely spaced at {...


4

Is it sufficient to simply visualise the RealExponent - in this case, at least. I added some chart junk for added benefit. BarChart[RealExponent[{mylist1[[All, 2]], mylist2[[All, 2]]}]/.-Infinity->0, AxesOrigin -> {0, 0}, AxesLabel -> {"", "Exponent"}, ChartLegends -> mylist1[[All, 1]], ChartLabels -> {Placed[{Panel["mylist1"], Panel["...


4

You can define a function to label the data using Labeled as in @David's answer: lblngF = MapIndexed[Function[{d, p},Labeled[d, #2[[1]][[## & @@ p]]]], #, {#2[[2]]}] &; lblF = Fold[lblngF, #, Thread[{Reverse@#2, {2, 1}}]] &; dt = {{1, 3, 4}, {4, 5}}; labels = {{"r1", "r2"}, {{"c1", "c2", "c3"}, {"c4", "c5"}}}; BarChart[lblF[dt, labels]] ...


4

You can use the metadata form of BarChart's data elements, $\text{form}_i\to m_i$, to specify the bar colour when a category is omitted. You do have to specify the colours in ChartStyle as well. data = {{1,2,3},{None,2,None},{1,None,5}}; BarChart[ First@MapThread[ Thread@*Rule, { {data /. None -> Nothing}, {Pick[{Orange, Brown, Blue}, #, ...


4

You can easily add the water matrix to the terrain matrix (and zero it where there is no water): t = ListPlot3D[terrain, InterpolationOrder -> 0, ColorFunction -> "TemperatureMap", Mesh -> None, Filling -> 0, FillingStyle -> Gray, PlotRange -> All, BoundaryStyle -> None]; w = ListPlot3D[(terrain + water)*Sign[water], ...



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