Tag Info

Hot answers tagged

24

Here's some code that could help you to start: sample data: data = RandomReal[{-1, 1}, 30]; plot: angleBar[max_, length_: .1][{{t0_, t1_}, {r0_, r1_}}, v_, meta_] := Block[{angle, coords, x, y}, angle = t0 + (t1 - t0)/2; coords = {Cos[angle], Sin[angle]}; x = r0 coords; y = r1 coords; {{Gray, Dashed, Line[{x, ...


22

Answers to your 4 questions step by step to see how each of these changes the composite plot: 1. The image padding around the two images differs so you need to set a fixed value for each. With ImagePadding -> {{50, 50}, {50, 10}} as an option for both plots I get this: 2. ChartLabels -> Placed[Style[#, "Text"] & /@ labels, Below],ImagePadding ...


21

What about perceived co-operative strength (well, at least something derived from counting the times two candidates were mentioned together): t = 1/Table[ Count[votes, _?(MemberQ[#, i] && MemberQ[#, j] &)], {i, 6}, {j, 6}]/. ComplexInfinity -> DirectedInfinity[1] // Quiet Do[t[[i, i]] = DirectedInfinity[1], {i, ...


21

With small tables of values, complex graphics can obscure the data. Ed Tufte has recommended just showing the counts. He also points out the worth of presenting the values in a meaningful order: here, the rows go from first to third place while the columns are (roughly) in order of the standings. raw = Import[ ...


19

Often I find it easier to construct such graphics directly from Graphics primitives. First your data: purple = RGBColor[97/255, 16/255, 106/255]; orange = RGBColor[245/255, 132/255, 31/255]; labels = {"FY15 Q1/2", "FY15 Q3/4", "FY16 Q1/2", "FY16 Q3/4", "FY17 Q1/Q2", "FY17 Q3/Q4", "FY18 Q1/2", "FY18 Q3/4"}; starvedTime = {7.55, 11.23, 8.58333, ...


13

Buried in the Details section of the documentation for BoxWhiskerChart is a reference to an option called ScalingFunctions which when set "the data coordinate is scaled using s." So, first some data: data = RandomVariate[RayleighDistribution[RandomInteger[500]], {8, 50}]; without the scaling functions: BoxWhiskerChart[data, "Outliers", ChartStyle -> ...


13

Maybe this helps: BarChart[#, BarOrigin -> Left, ChartLayout -> "Stacked", BarSpacing -> 0.5, ChartLabels -> {Placed[{{"A", "B", "C"}, {Total@#[[1]], Total@#[[2]], Total@#[[3]]}}, {Before, After}], None}, LabelingFunction -> (Placed[#1, Center] &)] &@{{1, 2, 3}, {2, 4, 1}, {3, 1, 1}} EDIT: slightly cleaner: BarChart[#, ...


13

If we assume that the votes are listed in the order they were cast, we can look at how the race evolved over time during the election period and monitor step by step who were in the leading positions. In this case I'm just calculating the number of votes without taking into account the rank. Here the very dirty code to create this animation: data = ...


13

With a bit of manual parameters: barFilled[gap_, h_, seg_][{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{width, line, yt, yb, lend}, {yb, yt} = Sort[{ymin, ymax}]; width = xmax - xmin; line = Table[{{xmin, i}, {xmax, i + width}}, {i, yb, yt - width, h/seg}]; lend = line[[-1, 1, 2]]; line = {Line[line], Line[Table[{{xmin + i, yb}, {xmax, ...


12

How about a BubbleChart3D showing the three choices as 3 axes: names = {"??", "RM", "JM", "Vb", "Wz", "Fx", "EK"}; data = Tooltip[Flatten[{##}], ToString[names[[1 + #1]]] <> " : " <> ToString[#2]] & @@@ Tally[votes]; With[{tt = Transpose[{Range[0, 6], names}]}, BubbleChart3D[data, AxesLabel -> Framed /@ {"First", "Second", ...


11

Another interesting way of looking at the voting data would be to visualize the 2nd and 3rd choices for a given 1st choice. In a way, this is a breakdown of Sjoerd's plot when a given candidate is the 1st choice. For example, among those who voted for me as the 1st choice, they were evenly split between J. M., Mr.Wizard and Verbeia for 2nd choice and a ...


10

There's an Method option, "BoxRange" that can be used to control the calculation of the box parameters: BoxWhiskerChart[data, GridLines -> {None, Quartiles[data]}, Method -> {"BoxRange" -> (Flatten[{Min[#], Quartiles[#], Max[#]}] &)}] The first example under Properties & Relations that shows how the various properties of the chart ...


9

Assuming two time intervals, t1 = "5:20"; t2 = "7:20"; t3 = "6:01"; t4 = "8:07"; toMin[t_] := ToExpression /@ StringSplit[t, ":"] /. {h_, m_} :> 60 h + m Graphics[{ {Opacity[.4], EdgeForm[Black], Gray, Rectangle[{toMin@t1, 0}, {toMin@t2, 1}], Red, Rectangle[{toMin@t3, .5}, {toMin@t4, 1.5}]}, Text[t1, Offset[{0, -20}, {toMin@t1, 0}]], Text[t2, ...


8

What BoxWhiskerChart[] is actually using for the quartiles (and the median as well) is Quantile[data, {1/4, 1/2, 3/4}], or more explicitly, Quantile[data, {1/4, 1/2, 3/4}, {{0, 0}, {1, 0}}] (what the docs calls the "inverse empirical CDF" parameters). Quartiles[data] (and thus also Median[]), on the other hand, is equivalent to Quantile[data, {1/4, 1/2, ...


8

Something like this? BarChart[{{1, 2, 3}, {1, 3, 2}, {5, 2}}, ChartLabels -> {"a", "b", "c"}, BaseStyle -> Directive[FontFamily -> "Zapfino", FontSize -> 16]] At first glance, the online documentation for BarChart doesn't describe any useful font options, but when you see the phrase "BarChart has the same options as Graphics with the ...


8

With the data beeing data = RandomVariate[NormalDistribution[0, 1], 200]; the range of the box specified to be one sigma (approx. 68.3 %tile range) by sigma=Erf[1/Sqrt[2]] and a limit for the fences defined to be 10 % fencesLimit = 0.1 we can plot a BoxWhiskerChart using: BoxWhiskerChart[data, "Median", Method -> "BoxRange" -> (Quantile[#, ...


7

There has to be a better way than this: BarChart[{1, 2, 3, 4, 5, 6}, ChartElements -> Graphics[{Blue, Thick, Line[{{0, 0}, {0.5, 0.05}}]}]]


7

To use BubbleChart as you have indicated in your comment to Jonathan's answer, a bit of work is required. First, BubbleChart expects data of the form: {x, y, w} So, we need to turn your data into something like that, but we need to take a pointer from the documentation to include all of the data. To do that, we add the extra information as metadata: {#1, ...


7

The built-in Joined option to BarChart doesn't really do what you want. So what I'd suggest is overlaying a BarChart on a ListLinePlot that creates the lines. Here is a simplified two-stacks-of-bars version. data = {{4, 3, 0, 0, 4.5}, {0, 3, 5, 6, 0}}; The first point is that you will need to have zero-value elements in the bar chart data to ensure you ...


6

This first solution is not exactly what you're looking for, but it gets close: BarChart[{{1, 2, 3}, -{4, 5, 6}}, ChartLabels -> {Placed[{"r1", "r2"}, {.5, 2}], Placed[{"c1", "c2", "c2"}, Axis]}] To get the correct representation you need to tweak a bit some values: BarChart[{{1, 2, 3}, -{4, 5, 6}}, ChartLabels -> {Placed[{"r1", "r2"}, ...


6

If I have time later tonight I'll give you a graphic matching demo as I did for other users here and here. As usual I recommend building a specific graphic from Graphics (or Graphics3D) primitives so I suggest you spend some time reading about those, e.g. Cuboid. As a quick fix you can use BarChart3D as follows: data = SparseArray[Tuples[{1, 4}, 2] -> ...


6

For the specific task of styling BarChart labels I would use Style directly. When using the BaseStyle option other elements are affected, potentially in undesirable ways, and some directives are not applied to the labels: BarChart[{{1, 2, 3}, {1, 3, 2}, {5, 2}}, ChartLabels -> {"a", "b", "c"}, BaseStyle -> Directive[Red, FontFamily -> "Stencil ...


6

It seems to be possible with ChartElementsFunction but by default BubbleChart just takes 3 arguments so you would have to play with this option. To do precisely what you want it seems easier to define your own graphics object like this: ellipse[v_]:=Disk[{v[[1]],v[[2]]},{v[[3]]/10,v[[4]]/10}] datatoplot=RandomReal[1, {10, 4}]; blankplot=ListPlot[{0, ...


6

some thoughts, I hope this is what you are after: ad (1): It seems (I couldn't find it in the docs) that when you provide a 2-element List of ChartLabels, the first element in a stacked BarChart is treated as a label for a (stacked) bar, the second one is then the intra-bar-label, so to speak. You can view this here: BarChart[{{1, 2, 3}, {3, 2, 1}, {1, ...


6

This and this give the answer by using LabelingFunction. Thus you can use BarChart[{{5, 6, 7, 5, 7}, {8, 5, 6, 7, 8}}, LabelingFunction -> (Placed[#1, Center] &), ChartLayout -> "Stacked"] And have:


6

BarChart[Labeled[#, Total[#], Above] & /@ {{1, 2}, {2, 3}, {2, 4}}, ChartLayout -> "Stacked", ChartLabels -> {Range[2004, 2006], None}, LabelingFunction -> (Placed[#1, Center] &)]


6

This can be done in one of two ways. In both cases I am bypassing the creation of sizesStr: sizes = {10718, 881, 395, 387, 375, 309, 297}; BarChart[sizes, BarOrigin -> Left, LabelingFunction -> (Placed[ Row[{#1, " kB"}], {{1, 0.5}, {0, 0.5}}] &)] For that example I am using Row to "join" the value with the unit. I am using the Placed ...


5

The disks aren't getting antialiased. (This is probably leaking from turning off antialiasing for the lines and rectangles.) If you turn antialiasing back on: filledCircle[size_] := Graphics[{Black, Style[Disk[], Antialiasing -> True]}, ImageSize -> size] it should look better:


5

Simply use option: TicksStyle -> Directive[20, Opacity[0], FontOpacity -> 0.3] Credit to R.M for showing me FontOpacity.


5

Appearance->"Line" option setting gives line graphs: TradingChart[{"GOOG", {{2010, 1, 1}, {2010, 6, 1}}}, {"Open", "Low", "High", "Volume"}, Appearance -> "Line"] You can also use ChartElementFunction->"Line": TradingChart[{"GOOG", {{2010, 1, 1}, {2010, 6, 1}}}, {"Open", "Low", "High"}, ChartElementFunction -> "Line"] By the way, ...



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