Tag Info

Hot answers tagged

8

Using Frame->False instead of Axes->False for your first approach seems to work well.


7

Both, DensityPlot and Graphics, with primitives like Circle and Disk, produce Graphics output. I think it is alright implementing your custom graphics. Here's my take, following your second idea, with a simple control over how the opacity fades. smooth[a_, R_: 1, n_: 100, hue_: Purple] := Graphics@Table[{ Blend[{Append[0]@hue, Append[1]@hue}, ...


5

Perhaps Lighting -> {{"Ambient", White}? Show[ PolyhedronData["Icosahedron"] /. Polygon[p_] :> MapIndexed[{Hue[Mod[3*First[#2], 20]/20], Polygon[#1]} &, p], Lighting -> {{"Ambient", White}} ]


5

Let's find out: classicDensityPlot = Trace[ DensityPlot[x y, {x, y} ∈ Disk[], PlotTheme -> "Classic"], _Blend & ] // Flatten // First // ReleaseHold ArrayPlot[Compile[{}, With[{r = Range[0, 3, 1/40]}, Sin[r #] & /@ r]][], ColorFunction -> classicDensityPlot, DataReversed -> True, Frame -> None]


5

CORRECTED for scaling. f1[x_] = x^2; f2[x_] = Sin[x]; Show[ Plot[f1[x], {x, -1, 1}, ColorFunction -> Function[{x, y}, ColorData["DarkRainbow"][f1'[x]]]], Plot[f2[x], {x, -1, 1}, ColorFunction -> Function[{x, y}, ColorData["DarkRainbow"][f2'[x]]]], PlotRange -> All] However, since the the documentation states that the x values fed to ...


5

Let us plot something interesting: img = Rasterize@DensityPlot[Cos[ArcTan[y, x] + x^2 + y^2], {x, -2, 2}, {y, -2, 2}, ColorFunction -> "Rainbow", Frame -> None, PlotPoints -> 100] Correspondence function f = Nearest@Table[List @@ Blend["Rainbow", x] -> List @@ cfun@x, {x, 0, 1, 0.003}]; Now we can convert colors (use First@f@# & ...


4

You can do ListContourPlot[Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], ColorFunction -> (Piecewise[{{ColorData["AlpineColors"][#], # >= .5}, {ColorData["SouthwestColors"][#], # < .5}}] &)] Update: Rescaling the range of the function ColorData[_scheme_]using the form ColorData[{_scheme_, {min, ...


4

Here's another way to make a random necklace that uses much less code: necklace[n_] := Graphics[{Circle[{0, 0}, 10], {RandomColor[], Rectangle[# - 1/2]} & /@ (10 {Cos@#, Sin@#} & /@ (2 π Range[n]/n))}] necklace[40] Here's a rainbow-necklace generator: necklace2[n_] := Graphics[{Circle[{0, 0}, 10], MapIndexed[{Hue[First@#2/n], ...


4

Another way: circim = Graphics[{White, Disk[]}, Background -> Black]; ImageMultiply[LinearGradientImage[{Blue, Yellow, Red}], circim] Or ImageMultiply[RadialGradientImage[{Blue, Yellow, Red}], circim] One can compose such a figure with transparency as: ImageCompose[EiffelTower, {mybullseye, .5}] where the .5 is the transparency ...


3

Using @MichaelE2's example, a combination of Glow and Lighting->None produces a similar picture: Show[PolyhedronData["Icosahedron"] /. Polygon[p_] :> MapIndexed[{Glow[Hue[Mod[3*First[#2], 20]/20]], Polygon[#1]} &, p], Lighting -> None] Alternatively: A surface can be specified as having an absolute color col by giving the ...


3

This is what I get in Mathematica 10.0.2: In[1]:= img= Import["http://i.stack.imgur.com/natsI.png"]; bin=Binarize[img,0.18]; AbsoluteTiming[pos=PixelValuePositions[bin,1];] AbsoluteTiming[resultImage=ReplacePixelValue[bin,pos->Red];] Out[3]= {0.004004,Null} Out[4]= {2.661534,Null} The performance of ReplacePixelValue and ...


3

You can do this: necklace[n_, colors_: {Red}] := Block[{minCenter, maxCenter, circ, center, squares, out, colorslist}, (circ := Circle[{0, 0}, 10]; center := Table[{10*Cos[k*2*Pi/n], 10*Sin[k*2*Pi/n]}, {k, 1, n}]; minCenter := center - 0.5; maxCenter := center + 0.5; colorslist = Flatten[Nest[Append[colors, #] &, colors, ...


2

Post-processing Lines to add VertexColors that depend on the value of the derivative: funcs = {x^2, Sin[x]}; plt = Plot[funcs, {x, -1, 1}, PlotStyle -> Thick, ImageSize -> 400]; plt2 = Block[{j = 1, k}, Normal[plt] /. Line[z_] :> (k = j++; Line[z, VertexColors -> (ColorData["Rainbow"] /@ ((D[funcs[[k]], x] /. x -> #) ...


2

The easiest way is to evaluate this: SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{ Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData[All], FontColor -> GrayLevel[1], Background -> GrayLevel[0]]}, Visible -> False, StyleDefinitions -> "PrivateStylesheetFormatting.nb"] ] However as you ...


2

Suspect this is a duplicate. Not sure if it is the most straightforward but, e.g.: PlotStyle -> Transpose[{ColorData[3, "ColorList"][[;; 7]], {Thick, Dashed, Dashed, Dashed, Dashed, Dashed, Dashed}}] or, in the same vain: PlotStyle -> Thread[Directive[ ColorData[3, "ColorList"][[;; 7]], {Thick, Dashed, Dashed, Dashed, Dashed, ...


1

Perhaps something like: lst = {{1}, {0}, {1, 1}, {0}, {1, 0, 1}, {0}, {1, 1, 1, 1}, {0}, {1, 0, 0, 0, 1}}; t = Riffle[1 + Boole /@ PrimeQ /@ Range[2, 1 + Ceiling[Length[lst]/2]], 0, If[OddQ @ Length@ lst, 2, {2, -1, 2}]]; lst2 = t lst; Row[ArrayPlot[#, ColorRules -> {2->Red, 1->Black}, ImageSize -> 200]& /@ {lst, lst2}, ...



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