Tag Info

Hot answers tagged

7

Here is an alternative to RegionPlot that potentially produces higher quality: it's based on Tube with varying radius, as I also used in this answer: With[ {a = 1, R = .7, n = 40, xMax = 1.5}, Manipulate[ Graphics3D[ GeometricTransformation[ {CapForm[None], {Opacity[.5], Pink, #, Cyan, GeometricTransformation[#, {{-1, 0, 0}, ...


5

The function domCol below is about 100 times faster than DominantColors. Basic plan: Create enough color bins throughout the color space occupied by the image; count the number of pixels in each bin; return the sorted colors. The function works in the LAB color space so we can use EuclideanDistance for the distance between colors. The centers of the bins ...


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


4

Here's an approach using ParametricPlot3D, in which spheres are plotted and then sliced off using the option RegionFunction. It's not clear to me how you intend to have the inner regions "blank" as they are occluded, but the options to Show let you vary the appearance. outerSphere[sphereCenter_: {0, 0, 0}, regionLimit_: 0.6, color_, opacity_] := Module[ ...


4

MapIndexed can be used to apply styling to elements conditionally based upon the their indices within the matrix. For example: format[v_, {_, 1}] := framed[v, White, Blue] format[v_, {_, 2}] := MatrixForm[v, TableSpacing -> {None, None}] format[v_, {_, 2, 1, _} | {_, 2, _, 4}] := framed[v, Black, Darker[Yellow, 0.01]] format[v_, _] := v framed[v_, f_, ...


4

mfnested = MapAt[MatrixForm, nested, {{}, {;; , ;;}}]; colF = MapAt[Function[{i}, Item[i, Background -> #2[[1]]]], #, #2[[2]]] &; Fold[colF, mfnested, {{Yellow, {{1, All, 2, 1, 1, All}, {1, All, 2, 1, All, -1}}}, {Lighter@Blue, {{All, All, 1}}}}] Grid[MapAt[Grid[#, Background -> {{-1 -> Yellow}, {1 -> Yellow}}] &, ...


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

Use of ColorQuantize Much faster. Not exactly the same, but close and for an art project is OK I think. i = ExampleData[{"TestImage", "Lena"}]; QuaCol[i_, n_] := RGBColor /@ Union[Flatten[ImageData[ColorQuantize[i, n]], 1]]


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


2

The problem is not with DominantColors Try varying the number of colours selected by running this snippet. I vary the number of selected colours from 1 to 10, and measure the time to calculate DominantColours ten times: Table[ First@AbsoluteTiming@ Table[DominantColors[p, i], {p, RandomChoice[pieces, 10]}] , {i, 10}] (* {6.544491, 7.658153, ...


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



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