Tag Info

Hot answers tagged

8

There are ImageMeasurements for this: ImageMeasurements[image, "Mean"] (* {0.427958, 0.559264, 0.130725} *)


6

If ImageMeasurements didn't exist we could have used this one-liner: Total[#]/Length[#] &@Flatten[ImageData[img], 1] ImageData will give you a matrix of RGB vectors, Flatten[...,1] will then give you a one-dimensional list of RGB vectors. Total adds them together, by dividing by the number of RGB vectors we get the mean. Also take a look at ...


5

ListPlot data = RandomInteger[10, {10, 3}]; sdata = Style[{#, #2}, PointSize[.05], ColorData[{"Rainbow", Through@{Min, Max}@data[[All, -1]]}][#3]] & @@@ data; ListPlot[sdata, PlotRangePadding -> 3] Or ListPlot[List /@ data[[All, ;; 2]], PlotRangePadding -> 3, BaseStyle -> PointSize[.05], PlotStyle -> (ColorData[{"Rainbow", ...


3

you can also use RegionPlot RegionPlot[{function <= 1/2, function > 1/2}, {a, 0, 4 Pi}, {c, 0, 4 Pi}, PlotStyle -> {Red, Green}]


3

ContourPlot[Cos[c] + Cos[a], {a, 0, 4 Pi}, {c, 0, 4 Pi}, Contours -> {1/2}, ContourShading -> {Red, Green}]


3

One way is just to build it up from primitives. Here is some data: SeedRandom[123]; data = RandomReal[{1, 10}, {10, 3}]; rescale the z values: data[[All, 3]] = Rescale[data[[All, 3]], {1, 10}]; or rescale over min and max of the z values etc -- up to you. Then plot: Graphics[{AbsolutePointSize[15], MapThread[{Hue[#3], Point[{#1, #2}]} &, ...


3

Just use a color function that you can map over your keys keyList = {1, 2, 3}; keys = RandomChoice[keyList, 10];(*Dummy keys*) pts = RandomInteger[100, {Length@keys, 2}];(*Dummy Points*) colors[key_] := Hue[key/Length@keyList];(*A color function that you can modify*) ListPlot[ Transpose@{pts}, PlotStyle -> colors /@ keys ]


2

Actually, ChartStyle does work, but it does not apply the whole colour range to the first bar. This example, slightly modified from the documentation, shows what is actually going on. Table[DistributionChart[data, ChartElementFunction -> f, ChartStyle -> "DeepSeaColors"], {f, {"Quantile", "DensityQuantile", "FadingQuantile", "GlassQuantile"}}] ...


1

You can get a color gradient that is symmetric around zero using a custom Blend as the ColorFunction, plus ColorFunctionScaling -> False. DensityPlot[x + y , {x, -2, 2}, {y, -3, 2}, ColorFunction -> (Blend[{{-5, Green}, {0, White}, {4, Red}}, #] &), ColorFunctionScaling -> False] Knowing the minimum and maximum of the data range is ...


1

I think something like this is what you're after: ListPlot3D[Transpose[{x, y, z}], ColorFunction -> Function[{x, y, z}, Hue[x]]] Put whatever tickles your fancy into the function for the mapping of n to colors, and check the documentation for ColorFunction (and associated things like ColorFunctionScaling) to fine-tune.


1

list = {1, 2, 3, 4} ; keys = {7, 8, 9, 10}; styleddata = Style[#, {Black, Red}[[Mod[#2, 2, 1]]]] & @@@ Transpose[{list, keys}]; Or styleddata = Style[#, If[OddQ@#2, Black, Red]] & @@@ Transpose[{list, keys}]; styleddata = Style[#, #2 Black + (1 - #2) Red] & @@@Transpose[{list, Boole@OddQ@keys}]; ListPlot[styleddata, BaseStyle -> ...


1

The behavior you see is not a bug. It's because the default ColorFunctionScaling puts the arguments of the ColorFunction into the range 0 to 1. By using ColorFunctionScaling -> False you suppress this default scaling and get the rings centered at the minimum. With default ColorFunctionScaling, you would have to do the following: Plot3D[x^2 + y^2, {x, ...


1

-1 < orientation < 0 -> Blue, 0 < orientation < 1 -> Red Since your orientiation values appear to be between -1 and 1 this requirement translates to Sign[orientation] /. {-1 -> Blue, 1 -> Red} so: Visualization = Graphics[{Thickness -> 0.0025, SampleData /. {({centroidx_, centroidy_, orientation_, majordiameter_, ...



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