Tag Info

Hot answers tagged

19

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


17

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


16

This may be what you are looking for. img = Import["http://i.imgur.com/Wd9lPRa.jpg"] Now use DominantColors. Graphics[{#, Disk[]}] & /@ DominantColors[img, 4]


16

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


15

Without looking at performance, but only on understanding: First, you create a function f which takes a value and a count and which reproduces the value exactly count times. In the simplest case f[val_, count_] := ConstantArray[val, count] and you can call f[3,4] to get {3,3,3,3}. Now, you combine your input arrays so that you can call f directly for each ...


14

For those without v9, here's another attempt based on FindClusters, but using a different colour space. The idea is to reduce the effect of overall brightness on the "distance" between colours, so that the clustering gives more weight to differences of hue and is less likely to pick out different shades of gray. newspace[{r_, g_, b_}] := {r - g, b - g, (r + ...


13

Is this what you mean? I put different colors in the background, to make clear what I added: Show[Histogram3D[dataHistogramSet, FaceGrids -> {Bottom, Front, Left}, ChartStyle -> "GrayTones", ViewPoint -> {2.78, 1.3, 1.43}, PlotLabel -> "Histogram of Dataset 1"], Graphics3D[ Translate[{EdgeForm[], {Red, Polygon[{{1995, 0, 0}, ...


13

Another potentially useful command of this kind is the CommonestFilter which looks locally about each pixel and chooses the most common value to display. Setting the neighborhood large causes large regions of constant color. For example img = Import["http://i.imgur.com/Wd9lPRa.jpg"] CommonestFilter[img, n] where img is the image from the OPs question ...


13

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]


13

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


12

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


12

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


11

Under mma 8 you can use the undocumented {"Raw", n} bin specification to get exactly the number of bins you would like. Otherwise the bin widths and boundaries are chosen to be "nice" numbers. Here is an example: data = RandomVariate[NormalDistribution[0, 1], 200]; Histogram[data, {"Raw", 5}] (I saw this first in a comment by Brett Champion to the ...


11

So this generates the heatmap: << Calendar` year = 1990; yearLen = DaysBetween[{year, 1, 1}, {year, 12, 31}] + 1; data = RandomReal[1, yearLen]; days = Map[DayOfWeek[{year, 1, #}] &, Range[3, 9]]; day1 = Position[days, DayOfWeek[{year, 1, 1}]][[1, 1]]; dayn = Position[days, DayOfWeek[{year, 12, 1}]][[1, 1]]; Paddata = Join[ConstantArray[100, day1 ...


11

Try use DominantColors on particular selections instead of the whole. After import select regions you want to analyze and copy that (optionally) multiple selections as a list of images. (New in 9?) img = Import["http://oaadonline.oxfordlearnersdictionaries.com" <> "/media/oaad8/fullsize/f/fru/fruit/fruit_fruit.jpg"] Paste it and apply dominants ...


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


10

You can use a custom ChartElementDataFunction as follows: cedF[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] :={If[xmax <= 8, RGBColor[1, 0, 0], Sequence[]], Dynamic@EdgeForm[Directive[Thickness[.015], Lighter@CurrentValue["Color"]]], Rectangle[{xmin, ymin}, {xmax, ymax}, RoundingRadius -> 5]}; Histogram[RandomVariate[NormalDistribution[10, 2], ...


10

You may be able to use the new WeightedData in version 9 with HistogramDistribution to create a weighted histogram. I've reduced the number of points for speed but it should hopefully scale to your actual problem. raw = RandomReal[1, {10000000, 2}]; binned = Table[{.01*Ceiling[raw[[i, 1]]/.01], .01* Ceiling[raw[[i, 2]]/.01], RandomInteger[1000]}, {i, ...


10

If I understand correctly, this question is about complete automation for uniform look. Hence the specifics of solution below. Import data: data = Import["http://pastebin.com/download.php?i=fZKMqxK9"]; Define filter that automatically separates data by gender: filter[gender_] := Rest[Transpose[Select[data, #[[1]] == gender &]]] For complete ...


10

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


9

I'm sure you'll get more sensible answers, but here's some FaceGrid abuse: Histogram3D[dataHistogramSet, FaceGrids -> With[{abuse = Table[{k, LightGray}, {k, 2002, 2005, 0.01}]~Join~ Table[{k, Gray}, {k, 2005, 2010, 0.01}]}, {{Front, {abuse, None}}, {Bottom, {abuse, None}}, Left}], ChartStyle -> "GrayTones", ViewPoint -> ...


9

You might also enjoy playing with ColorQuantize, which reduces the number of colors used in an image. Here's a BarChart of the results of quantization: colorquantized = SortBy[ Tally[ Flatten[ImageData[ColorQuantize[img, 12, Dithering -> False]], 1]], Last]; BarChart[colorquantized[[All, 2]], ChartStyle -> RGBColor /@ ...


8

Perhaps like this: data = {"A", "A", "B", "B", "B"}; elements = DeleteDuplicates[data]; rep = MapIndexed[# -> #2[[1]] &, elements]; Histogram[data /. rep, ChartStyle -> "Pastel", ChartLegends -> elements] EDIT: Incorporating @Simon Wood´s splendid suggestion (we learn that the legend is a plain Column, which should be considered a good ...


8

values = RandomSample[Range[100], 5] (*{72,75,44,25,60}*) counts = RandomInteger[{1, 5}, 5] (* {4,3,1,1,1} *) Inner and Table: Inner[Table[#1, {#2}] &, values, counts, Join] (*thanks: Halirutan *) Inner and ConstantArray: Flatten@Inner[ConstantArray, values, counts, List] both give {72, 72, 72, 72, 75, 75, 75, 44, 25, 60} Update: ...


8

A custom height function for Histogram3D: Key ideas: (1) get the list of data points in each bin using BinLists, (2) Map func2 to each 2D data point and func1 to the results to define the heights for each bin: ClearAll[binListF, heightF]; binListF[data_][bins_, counts_] := BinLists[data, {bins[[1]]}, {bins[[2]]}]; heightF[data_][func1_: Total, func2_: ...


8

Add the argument "Probability" to the Histogram command. To be precise, if list is your list of data, then Histogram[list,Automatic,"Probability"] should do the trick. The Automatic argument specifies the bin size.


8

Here's another take. Not that successful though. It might have educational value. i = Import@"http://i.imgur.com/Wd9lPRa.jpg"; Extract pixel values into a list of length 9k+. data = Flatten[ImageData[i], 1]; Dimensions@data {9603, 3} Show the pixels as 3D points with (x, y, z) for (R, G, B) components. Table[Graphics3D[todraw, Axes -> True, ...


8

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


7

Your question strikes me more as a probability and statistics problem than a Mathematica problem, but I'll offer this extended comment. You could create a list of every distribution Mathematica provides and a function to evaluate all of them. The following can give you some guidance of the method and its pitfalls: Probabilistics - Monte Carlo I'd suggest ...


7

From reading over your post it seems that there are two problems you're having trouble with: How to bin lists of numbers into bins that may not be consecutive How to represent the output of your calculation To address #2 first, I think your idea to use a 3D SparseArray, where each element is a list of mass bin counts, is a good one. As you found, and as ...



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