Tag Info

New answers tagged

9

Do you see an error message in the Messages window? When this happens (the result of an evaluation is more or less the expression you entered), it's usually because it can't be evaluated, e.g. because image2 is not actually an image. If I Import the image from your post, ColorReplace accepts it as an argument, but since the blue you're trying to replace ...


2

When you evaluate a ContourPlot3D expression, it will become a Graphics3D expression containing a collection of graphics primitives like Point, Line, and (more complicated) GraphicsComplex. In your case the expression looks something like this: Graphics3D[ GraphicsComplex[ ... ], <options> ] And your color Orange is in the GraphicsComplex, in ...


1

I think this is what you're asking: Show[ ContourPlot[ Sin[x + y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]} , RegionFunction -> (#1 + #2 < \[Pi] &) ] , ContourPlot[ Sin[x + y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]} , RegionFunction -> (#1 + #2 >= \[Pi] &) , ColorFunction -> GrayLevel ] ] Where I've used RegionFunction to give ...


5

As can be seen from the images presented, the interpolation being done under the hood by VertexColors depends on a prior triangulation of the polygon, thus resulting in visible triangular bands. The approaches presented thus far have all needed to perform a preliminary triangulation; I shall now present a method that avoids this preprocessing step. One ...


4

I propose using the lower-level System`PlotThemeDump`resolvePlotTheme to find the information you need. This reveals the color scheme number itself rather than resolving to a list of Directives. You must give the plot function name as a String. The key you are looking for is "DefaultColor: Themes`ThemeRules; (* preload PlotThemes subsystem *) ...


1

You can also set EdgeStyle to do this (using Graph): Graph[SomeGraph, EdgeStyle -> Thread[EdgeList[ SomeGraph] -> (Directive[Opacity[0.5], ColorData[{"TemperatureMap", "Reverse"}][#]] & /@ Rescale[PropertyValue[SomeGraph, EdgeWeight]])], GraphStyle -> "ThickEdge", VertexCoordinates -> TheCoordinates]


3

wam = WeightedAdjacencyMatrix@SomeGraph; erf = ({ColorData[{"TemperatureMap", "Reverse"}][Rescale[wam[[Sequence @@ #2]], {Min@wam, Max@wam}]], Line[#1]} &); PlotOfSomeGraph = GraphPlot[ SomeGraph, VertexCoordinateRules -> ...


2

As Arnoud Buzing has mentioned, when manually entering an RGBColor, in the code completion we find a user interface for finding the color components. This user interface is the same as that turns up when we click on a displayed RGBColor expression. I was wondering if this new interface could be used with Dynamic as well. Kuba showed that when we replace one ...


7

Mathematica 10.2 introduced the function ColorBalance, which can be used to correct the white balance of an image. 1) Example Photos Original Photos 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 Balance that ...


4

Ok, I read it again and again and I think I know what you are after. Here's quick fix/adjustment to make this thing a valid controller: SetAttributes[customColorSetter, HoldFirst] customColorSetter[var_] := ( If[! MatchQ[var, _RGBColor], var = Black]; Delete[ FrontEndResource["RGBColorValueSelector"][[1, 1]], {{1, 1}} ] /. ...


5

You'll get a much crisper output if you use Mesh functionality instead: Plot3D[x^2 + y^2, {x, 0, 1}, {y, 0, 2}, MeshFunctions -> {#/#2 &}, Mesh -> {{1}}, MeshShading -> {Red, Blue} ] Or with additional grid lines: Plot3D[x^2 + y^2, {x, 0, 1}, {y, 0, 2}, MeshFunctions -> {#/#2 &, # &, #2 &}, Mesh -> {{1}, 12, ...


4

And immediately after submitting, I find the answer here: Using ColorFunctionScaling->False Plot3D[Evaluate[x^2+y^2],{x,0,1},{y,0,2},ColorFunction->colorFun,ColorFunctionScaling->False] Gives the correct coloring. Sorry to bother you all, and thanks for listening! Decided to keep the question and answer it myself for other who might do the same ...


3

I've decided to follow through on my suggestion in a comment to Kenny's answer to use Morton ordering (a.k.a. Z-ordering) of the colors in RGB space. Here's a short routine to generate the n-th iterate of a d-dimensional Z-curve: Morton[d_Integer, n_Integer] := Array[FromDigits[BitGet[#1, d Range[n - 1, 0, -1] + #2], 2] &, {2^(n d), d}, {0, ...


6

Just for fun, how does a 3D Hilbert curve sample the 3D colourspace of RGB? and can it be used to sort colours? HilbertCurve3D[n] generates a 3D Hilbert curve of order n. The code is by Michael Trott from page 93 of The Mathematica Guidebook for Programming. HilbertCurve3D[n_Integer?Positive] := Module[{axiom = "X", recursion = "X" -> {"t", "c", "X", ...


23

If you're looking for a way to sort the colors in such a way as to make them seem the least discontinuous, then one way to think of it is that each color is a point in a space endowed with a distance metric (either the CIELAB 1976 or the CIELAB2000 perceptual metrics), and you are trying to find a shortest tour that visits each point. We can do that with ...


3

This answer is effectively a generalization of the approach by halirutan and Pickett. Here, I present a function that when given a list of colors, a list of positions and colors, or a color gradient known to ColorData[], it yields a listable compiled function effectively equivalent to Blend[]: makeCompiledBlend[colors : (_String | _List), opts___] := ...



Top 50 recent answers are included