Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

# Tag Info

7

I think Piecewise is all what you need: f2[x_, y_, t_] = Piecewise[{{Re[f[x, y, t]], 0 <= t < 59}, {Re[g[x, y, t]], 59 <= t <= 60}}] DensityPlot3D[f2[x, y, t], {x, -60, 60}, {y, -60, 60}, {t, 0, 60}, ColorFunction -> "Rainbow", AxesLabel -> {"x", "y", "t"}] Note: as C. E. correctly notes in the comments, this solution works only for ...

5

Just using Show should do it: dp1 = DensityPlot3D[ Re[f[x, y, t]], {x, -60, 60}, {y, -60, 60}, {t, 0, 30}, ColorFunction -> "AlpineColors", AxesLabel -> {"x", "y", "t"} ]; dp2 = DensityPlot3D[ Re[g[x, y, t]], {x, -60, 60}, {y, -60, 60}, {t, 30, 60}, ColorFunction -> "SolarColors", AxesLabel -> {"x", "y", "t"} ]; ...

4

You can use a single plot if you separate the Piecewise conditions into separate ConditionalExpression objects. To do this, you can use an internal function to determine the intervals of validity for each piecewise condition, and then create a list of ConditionalExpression objects. The internal, undocumented (and hence subject to change) function to use is ...

4

Clear["Global*"] test[r_] := Piecewise[{{Exp[r], r < -1}, {1 - r^2, -1 < r < 1}, {Sin[Pi r], r > 1}}]; plotRng = {-3, 3}; Extract plot intervals from Piecewise and the specified pltRng intervals = {Cases[test[r][[1, All, -1]], _?NumericQ, 2], plotRng} // Flatten // Union // Partition[#, 2, 1] &; Plot each interval ...

4

By default Image stores as Real32: ImageType[Image[{{red}}, ColorSpace -> "RGB"]] "Real32" (I believe this change happened in V12.) We can force 64 bit storage: Flatten[ImageData /@ ColorSeparate[Image[{{red}}, "Real64", ColorSpace -> "RGB"], "XYZ"]] // FullForm List[0.436075,0.222504,0.0139322]

2

Very neat, but the proposed code seems to go wrong in Mathematica 12.0 because "Cases" gives a list of colours which is too long. Below an ad hoc solution which works here but I don't know how robust it is: With[{nDiv = 10, nCurv = 3}, data = Table[ N@Sin[u + h], {h, Subdivide[π/2, nCurv - 1]}, {u, Subdivide[2 π, nDiv]}]]; plt = ListLinePlot[...

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