Tag Info

Hot answers tagged

15

It seems that there is a significant overhead every time a color scheme is switched. Once a scheme is loaded each use is fast, but changing color schemes apparently unloads and reloads the mechanism. The result is that the speed of application is directly related to the frequency of switching. With sorted values there is only one switch and application is ...


13

Histogram Mean Color Balance Your example photographs imgList = Import /@ {"http://i.imgur.com/qzFttRD.jpg", "http://i.imgur.com/fh9tAK1.jpg", "http://i.imgur.com/b2kWM3y.jpg", "http://i.imgur.com/amNRIhh.jpg"}; ImageAssemble[imgList~Partition~2] The following code balances the colors of an image by transforming the histogram ...


9

Most of your lines are "multipoint" and your color function doesn't support them well. You can enforce "two points lines" by doing something like this (I'm following your map code styling here): Show[Graphics[{AngleColor[#[[2]] - #[[1]]], Line[#]}] & /@ Partition[#, 2, 1] & /@ # & /@ testD, Background -> Black, ImageSize -> 800] ...


7

Simple white balance As described in the Wikipedia article, the simplest white balance is to rescale the RGB channels to make white objects have white pixels. Here's a simple method where I define a white point in the original image by the 0.995 quantile of each colour channel: image = Import["http://i.stack.imgur.com/bUvXg.png"]; white = Quantile[#, ...


7

Here is something 10 x faster. I made the same assumption as george2079 so for each subinterval whole color scheme is used not just exact part like in Simon's answer. Maybe useful, maybe not. Usage colorF ~ createColorFunction ~ {"TemperatureMap", "AvocadoColors"}; pic = Image@ConstantArray[Range[0, 1, .001], 100] Colorize[pic, ColorFunction -> ...


6

Evaluating ColorData["Properties"] in 10.0.2 returns: {"AlternateNames", "ColorFunction", "ColorList", "ColorRules", "Image", "Name", "Panel", "ParameterCount", "Range", "StandardName"} This however is also incomplete. Some spelunking reveals that there are more. Here is a complete list from the function definition itself: "StandardName" "Name" ...


5

Here is an example of how to do it: f[x_, y_] := {Sin[x], Cos[y], Sin[2 x + y]} Block[{x, y, h, xMin = -1, xMax = 3, yMin = -3, yMax = 3}, Graphics[{}, PlotRange -> {{xMin, xMax}, {yMin, yMax}}, Epilog -> Inset[Show[ColorCombine[Table[Image[ DensityPlot[f[x, y][[i]], {x, xMin, xMax}, {y, yMin, yMax}, Frame -> None, ...


4

With caffeine as the example molecule molecule = Import["ExampleData/caffeine.xyz"] one can find all spheres that represent the single atoms using sphereList = Cases[molecule[[1, 4, 2]], _Sphere] {Sphere[1,24.],Sphere[12,24.],Sphere[14,24.],Sphere[15,24.],Sphere[16,24.],Sphere[17,24.], ...


4

You can change CurrentValue[EvaluationNotebook[], {AutoStyleOptions, "UndefinedSymbolStyle"}] (* {FontColor -> RGBColor[0., 0.173, 0.765]} *) to any color of your choice, say Red, evaluating CurrentValue[EvaluationNotebook[], {AutoStyleOptions, "UndefinedSymbolStyle"}] = {FontColor -> RGBColor[1., 0., 0.]} anywhere in the notebook. Before ...


3

You can add Specularity to the ColorFunction. Here is a Manipulate you can play with to figure out what settings you prefer: Manipulate[ Plot3D[Exp[-x^2 - y^2], {x, -3, 3}, {y, -3, 3}, PlotPoints -> 50, PlotRange -> All, PlotRangePadding -> None, ColorFunction -> (Directive[Specularity[s, 20], Glow@ColorData["DarkRainbow"][#3]] ...


3

A possible alternative to DensityPlot is to render an Image: (* kguler's example function *) f[x_, y_] := {Sin[x] Sin[y], Sin[3 x] Cos[2 y], Cos[y/Pi] Sin[x + y]} Array[f, {100, 100}, {{-2 Pi, 2 Pi}, {-2 Pi, 2 Pi}}] // Transpose // Reverse // Rescale // Image // ImageResize[#, 300] & Here is a self-contained function that evaluates a function ...


3

You can use Colorize for this Colorize[RandomImage[1, {10, 10}], ColorFunction -> (Piecewise[ {{ColorData["AlpineColors"][#], 0 < # < .5}, {ColorData["SouthwestColors"][#], .5 < # < 1}}] &)]


2

One approach: ImageApply[ List @@ Piecewise[{ {ColorData["AlpineColors"][2 #], 0 < # < .5}, {ColorData["SouthwestColors"][2 # - 1 ], .5 < # < 1} }] &, Image[RandomReal[1, {10, 10}]]] or Image[Map[ List @@ Piecewise[{ {ColorData["AlpineColors"][2 #], 0 < # < .5}, ...


2

ClearAll[f] f[x_, y_] := {Sin[x] Sin[y], Sin[3 x] Cos[2 y], Cos[y/Pi] Sin[ x + y]} dp = DensityPlot[Plus @@ f[x, y], {x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi}, Frame -> False, ImageSize -> 300] dps = DensityPlot[f[x, y][[#]], {x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi}, Frame -> False, ImageSize -> 300, ColorFunction -> (Function[{c}, ...


2

You can also do this via the Format-> Option Inspector, Choosing your context (Selection, sheet or Global) and looking for UndefinedSymbolStyle in the lookup box.


1

Use ColorFunction. Plot[Sin[500 x], {x, 0, 1}, ColorFunction -> Function[{x, y}, Piecewise[ {{RGBColor[0, 0, 1 - 2 y], 0 <= y < .5}, {RGBColor[2 (y - .5), 0, 0], .5 <= y <= 1}} ] ] ] A bit ugly, but you get the idea. Here the line of the plot is colored based on the y coordinate. The ...


1

Using VectorAngle and Developer`PartitionMap: aclF[x_] := Module[{a = VectorAngle[{1, 0}, Subtract @@ x]/Pi}, {If[a >= .5, Blend[{White, Orange, Orange, Purple, Purple, White}, 2 (a - .5)], Blend[{White, Purple, Purple, Orange, Orange, White}, 2 a]], Line@x}]; Graphics[Developer`PartitionMap[aclF, #, 2, 1] & @@@ testD, Background ...



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