New answers tagged

6

In the absence of your data, I'll just use some data that I make up. One of these is an example from the help on ListContourPlot3D and one is a 3D-Gaussian, list1 = Table[{x, y, z, x^2 + y^2 - z^2}, {x, -1, 1, .05}, {y, -1, 1, .05}, {z, -1, 1, .05}]~Flatten~2; list2 = Table[{x, y, z, 2 Exp[-3^2 ((x - .3)^2 + (y - .3)^2 + (z - .3)^2)]}, {x, -1, ...


3

I had implemented my own color conversion functions previously so that I could convert to the Msh color space, a polar version of LAB, so I thought I'd give it a go. To do the color conversion, you have to know what reference white value is being used. The numeric values can be found here where they are referred to as reference illuminant tristimulus ...


3

EDIT: added use of PlotLegends package Use a single Plot with the option Filling Needs["PlotLegends`"]; EffPot[r_, Energy_, AngMom_] := -Energy/r + (AngMom^2 - 1)/(2 r^2) Manipulate[ Plot[{ EffPot[r, Energy, AngMom], (Energy^2 - 1)/2}, {r, 0, 10}, PlotStyle -> { {Thick, RGBColor[0.60, 0.20, 0.40]}, {Thick, RGBColor[0.20, 0.20, ...


3

In addition to the nice answer of Edmund, if you do not mind to highlight also the factor (such as Subscript[x,k] you might use a bit shorter approach. Let us first introduce two functions, any of them may be used for your purposes: colored[x_, term_] := If[MemberQ[x, term], Style[x, Red], x]; highlighted[x_, term_] :=If[MemberQ[x, term],Style[x, 14, ...


4

You can use Coefficient. p = Collect[TestExpr, {Subscript[x, k]}]; p /. {\[FormalT] : Coefficient[p, Subscript[x, k]] :> Style[\[FormalT], Blue]} // TraditionalForm Hope this helps.


1

I certainly think this is a bug, but you can get around it by using a custom ColorFunction, turning off ColorFunctionScaling, manually setting the range of the legend, and finally by manually setting the contour levels. This is the only way to ensure that you can compare multiple contour or density plots (I also use this method when I am trying to make an ...


2

You can build it from graphics primitives. Start by reading Graphics, Point, ColorData, Function, Apply, Legended, BarLegend. This is some example data pts = RandomReal[{-1, 1}, {20, 3}]; The range of my data ($f(x,y)$ values) is $[-1,1]$. We define it explicitly. min = -1; max = 1; Make the plot: g = Graphics[{ PointSize[Large], ...


1

In addition to the scaling issue, you need have your color function use the correct variables. To quote the documentation The arguments supplied to functions in MeshFunctions and RegionFunction are x, y, z, u, and v. Functions in ColorFunction and TextureCoordinateFunction are by default supplied with scaled versions of these arguments. This means ...


1

If you are going to use a custom color function you have to do the scaling of its values yourself. So you need to find the range of values of your color function, rescale its output value accordingly and tell ParametricPlot3D not to do scaling itself. min = NMinValue[{f[u, v], 0 <= u <= Pi && 0 <= v <= 2 Pi}, {u, v}]; max = ...


3

Following @andre... but don't forget to set the ViewPoint to reveal the overlap of the functions in question: gr00 = Plot3D[x^4, {x, 0, 1}, {y, 0, 1}, MeshFunctions -> {#1 + #2 &}, Mesh -> 40, MeshShading -> {None, {Opacity[0.5], Red}}]; gr01 = Plot3D[0, {x, 0, 1}, {y, 0, 1}, MeshFunctions -> {#1 - #2 &}, MeshShading -> ...


3

You could do this for example : gr00 = Plot3D[x^4, {x, 0, 1}, {y, 0, 1}, MeshFunctions -> {#1 + #2 &}, Mesh -> 30]; gr01 = Plot3D[0, {x, 0, 1}, {y, 0, 1}, MeshFunctions -> {#1 - #2 &}, MeshShading -> {None, Green}]; Show[gr00, gr01] There is a lattice in the zone where the curves are considered as "equals". I don't know ...


3

Okay, so take some form for your function func[l_, t_] := { x = 3 t Sin[l t]; y = 3 t Cos[l t]; z = l t + l; {x, y, z}} Then one way to get what you are looking for is like this, Show[ Table[ ParametricPlot3D[ func[l, t][[1]], {t, 0, 5}, PlotStyle -> Hue[l/10], PlotLegends -> {"l = " <> IntegerString[l]}], {l, 1, 10}], ...


3

You can do it without generating all these variables. Download data, notice the direct link, easier that way. data = Import["https://www.dropbox.com/sh/ll9hb3oxxreufsg/AAA6hJL-suwY6MSslRtuSE7Fa/mesh_and_domain.txt?dl=1", "Table"] Separate using GatherBy[data, Last] (GatherBy). Change colours using the index of MapIndexed,to RotateLeft the list {0,0,1} ...


4

With just a slight modification to your code, Show @@ {Table[ ListDensityPlot[dom[[idx]], Mesh -> All, InterpolationOrder -> 1, ColorFunction -> (color[[idx]] &)], {idx, domidx}], PlotRange -> {{0, 2}, {0, 1}}, AspectRatio -> 0.5} Or you can use a custum color function ListDensityPlot[data, ColorFunction -> (Which[#1 ...


0

Your problem was that you were rescaling numbers that run between 0 and 0.4 (the actual range of output for B over this range) as if they ran between 0 and 5. Range[0, 0.4, .1] Rescale[%, {0, 5}] (* {0., 0.1, 0.2, 0.3, 0.4} *) (* {0., 0.02, 0.04, 0.06, 0.08} *) If you want to manually set your own color function, then you should find the range of values ...


3

OK, this turns out to be version related. Based on the experience from this post: In v9.0.1 or earlier After some trial and error, I obtain: colorFunctionMatrixPlot = Trace[MatrixPlot@{{1}}, _[Blend[__]] &] // Flatten // First // ReleaseHold Quiet[Blend[{{0., RGBColor[0.260487, 0.136843, 0.891569]}, {0.166667, RGBColor[0.230198, ...


6

It is there, deep down, but I'm too lazy to dig... hexColor = StringCases[ ExportString[Style[1, #], "HTMLFragment"], "color:" ~~ color__ ~~ "\"" :> color ][[1]] & hexColor@Blue "#0000ff"


10

Seems like the function I was wanting was: hexifyColor[color_RGBColor] := StringJoin["#", IntegerString[Round[Level[color, 1]*255], 16, 2]]



Top 50 recent answers are included