Hot answers tagged

8

Just use Graphics directly instead of having ListLinePlot construct the Graphics object for you: data = Table[{x, Sin[x], Cos[x]}, {x, Range[-3.14, 3.14, 0.2]}]; Graphics[ {Line[data[[All, ;;2]], VertexColors -> data[[All,3]]]}, Axes->True, AspectRatio->1/GoldenRatio ]


7

Your expression obtains a large range of values and it blows up near the origin, therefore you need to do some clipping. The representation should depend on the features you want to emphasize. If you want to show what happens near the boundary, you can cut out a chunk from the interior: region = RegionDifference[Cube[2 \[Pi]], Cube[6]]; DensityPlot3D[gxx, {...


3

To answer your question of why the default isn't black, it looks like it's to emphasize what's being plotted instead of the frame. From here it says "Axes and frames have been lightened slightly to shift emphasis to the actual data." In addition to the comment Hans made about FrameStyle -> Black, I might also recommend using a Directive to ...


3

Hue uses the HSB color space which is a cylindrical transformation of the RGB color space. Like you say, this means that Hue[0] and Hue[1] are both red, which is why you get the same colors in the center and outer ring. You'll want to change your ColorFunction to go from about Hue[0.7] for blue in the outer ring to Hue[0] in the inner ring. You can do Table[...


2

There are many pre-defined color gradients ColorData["Gradients"] (* {"AlpineColors", "Aquamarine", "ArmyColors", "AtlanticColors", \ "AuroraColors", "AvocadoColors", "BeachColors", "BlueGreenYellow", \ "BrassTones", "BrightBands", "...


2

You can use ColorQuantize with a list of preferred colours: Remove["Global`*"] img = ImageAdjust@Import["https://i.stack.imgur.com/q9Q5A.png"]; cols = {Red, Yellow, Green, Blue}; cq = RemoveAlphaChannel@ ColorQuantize[img, Append[cols, Black], Dithering -> False]; planes = With[{imd = Round@ImageData@cq}, Table[Image[Map[Boole[# ==...


2

SeedRandom[1] data = RandomReal[1, {5, 5}]; An alternative hack is to temporarily re-define Darker (which is used to style the joined lines) as the desired line color (say, Red): Block[{Darker = (Red &)}, BarChart[data, ChartLayout -> "Stacked", Joined -> True, BarSpacing -> 0.5]] To have different colors for each line, post-...


1

SeedRandom[1] data = RandomReal[1, {5, 5}]; bc = BarChart[data, ChartLayout -> "Stacked", Joined -> True, BarSpacing -> 0.5] Two post-processing hacks: replaceAll1 = ReplaceAll[Directive[p_, a_, c_] :> Directive[p, a, Red]]; replaceAll2 = ReplaceAll[Line[x_] /; Length[x] > 2 :> {Red, Line @ x}]; replaceAll1 @ bc replaceAll2 @ ...


1

Do you want this: Plot[Sin[x], {x, 0, 2 \[Pi]}, Ticks -> {Automatic, {-1, -0.5, {0.5, Style["0.5", Red, 12]}, 1}}] ??


1

You can use PlotStyle to color each set: ComplexListPlot[ eigsol, PlotStyle -> ColorData["Rainbow"]/@Subdivide[Length[eigsol]-1] ]


1

g = 2.2; grid = Union @@ ImageData[myImage]; gGrid = grid^g; dists[cols_] := Sqrt[Total[Power[# - ConstantArray[gGrid, 4], 2], {3}]] &[ MapThread[Outer[Times, ##] &, {cols.Transpose[gGrid]/Total[cols^2, {2}], cols}]]; Above, dists computes the (gamma uncorrected RGB) distance from each pixel color in the image to each of the colors in its ...


1

The ColorQuantize approach is nice but it doesn't given you any control over how to decide which pixel becomes what color. Here's a different approach using ColorDistance which is of comparable speed to the ColorQuantize approach and somewhere around 5x faster than the approach given by @flinty. img = Import["https://i.stack.imgur.com/q9Q5A.png"]; ...


1

This technique comparing the pixel hues in HSB to a list of known hues seems to produce much better masks than my ColorQuantize approach: img = Import["https://i.stack.imgur.com/q9Q5A.png"] // ImageAdjust; himg = ColorConvert[img, "HSB"]; cols = ColorConvert[{Red, Yellow, Green, Blue}, "HSB"]; diffHue[c1_, c2_] := .5 - Abs[Abs[...


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