Tag Info

Hot answers tagged

10

You're running into two issues. We'll start with the one that is causing the messages. By default Plot avoids symbolic evaluation of your function, and uses numeric evaluation instead. For example, it may evaluate at t=1.23: D[D[z[1.23],1.23],1.23] and then D complains that 1.23 isn't a valid variable and returns D[D[{1, 1.5129, 1.8608669999999998}, ...


8

Show[Plot[1/(x^2), {x, 0, 4}, PlotStyle -> Blue, AspectRatio -> 1], Plot[1, {x, 0, 1}, FillingStyle -> Purple, Filling -> Bottom, PlotStyle -> Blue], Plot[1/(x^2), {x, 1, 4}, PlotStyle -> Blue, Filling -> Axis, FillingStyle -> Red, PlotRange -> {Full, {0, 1}}]]


7

One Plot can do too: Plot[{If[x < 1, 1/(x^2)], If[x > 1, 1/(x^2)]}, {x, 0, 4}, AspectRatio -> 1, Filling -> {2 -> {Axis, Red}}, Epilog -> {Purple, Rectangle[]}]


6

Another variation, using ConditionalExpression: Plot[{ ConditionalExpression[x^-2, x <= 1], ConditionalExpression[x^-2, x > 1], ConditionalExpression[1, x <= 1]} , {x, 0, 4}, PlotStyle -> Blue, Filling -> {2 -> {Axis, Red}, 3 -> {Axis, Purple}}]


6

One easy way is to replace the style of the specific nodes in the final tree. Let's make a function for it: colorize[tree_, nodes_List] := With[{patt = Alternatives @@ nodes}, tree /. Framed[p : patt, style_, r2___] :> Framed[p, style /. c_RGBColor :> Darker[c], r2] ] Now you can do t = Plotting[S, u, d, 4]; colorize[t, {S, d^2 S*u^2, d^3 ...


6

One option would be to restrict the function from funky regions with a Condition liks this f[x_, y_] /; Abs[x - y] > 5 := (Sin[x] - Sin[y])/(x - y); Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10}] Out: One can easily see that Plot3D will also sample points in the region which is "forbidden", the points are just not drawn due to the RegionFunction. ...


5

Here is a very simple, step-by-step way to go about solving your problem. z[t_] := {1, t^2, t^3} Norm[z[t]] Sqrt[1 + Abs[t]^4 + Abs[t]^6] Those absolute values are going to give us trouble, so lets get rid of them. You want to plot over the range 0 to 5, so we can assume t ≥ 0. nz[t_] = Simplify[Norm[z[t]], Assumptions -> t >= 0] Sqrt[1 + ...


4

Like noted in the comments the problem is that Manipulate[ListLinePlot[{OutputResponse[discLowPass[T, τ], dataNoise]}], {{T, .1}, .005, 25}, {{τ, .005}, .001, .025}] doesn't work while the following works: Manipulate[ListLinePlot[OutputResponse[discLowPass[T, τ], dataNoise]], {{T, .1}, .005, 25}, {{τ, .005}, .001, .025}] ...


4

What you see is Moiré pattern Closely related topic with 2D case: Using high RasterSize changes contour pattern Worth to add that the patterns does not seem to have a translation symmetry because the projection is not parallel. You can compare it with distant ViewPoint case: ListPointPlot3D[ Table[{n, s, (Prime[n]^s/(Prime[n]^s - 1))}, {n, 1, 2000}, {s, ...


3

Double the width: f[{{xmin_, xmax_}, {ymin_, ymax_}, {zmin_, zmax_}}, ___] := Cuboid[{xmin, ymin, zmin}, 2 {xmax, ymax, zmax} - {xmin, ymin, zmin}]; Histogram3D[N@{Data1, Data2, Data3, Data4, Data5}, 10, Boxed -> False, FaceGrids -> {Bottom, Front, Left}, ChartStyle -> "Pastel", ChartElementFunction -> f, Ticks -> {Automatic, None, ...


3

Significant manual cleaning was required for block of data in post. The data: data = {{{"ID", "Day", 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22.}, {"H. sapiens", 1., 145.7, 153.2, 164.6, 161.1, 170.8, 191.7, 179.2, 178.5, 198.5, 169.9, 135.8, 182.8, 205.3, 210.3, 197.3, 238.4, ...


3

You could set up a dynamic VertexRenderingFunction that allows you to change the colors of your vertices with a click. colorClickVRF[colors_List] := Function[{pos, name}, Module[{i, len}, i = 1; len = Length[colors]; DynamicModule[{ backColor = Lighter[First[colors]], frameColor = Darker[First[colors]]}, ...


3

I don't think this is entirely unexpected since PlotLegends is meant to depict what the colours mean. You switch off the colours and the plot legend disappears. The canonical way to leave the "example" in place is to use an epilog: p = ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, ContourShading -> None, Epilog -> Text["example", ...


3

If I understand you correctly you want to show the label "0.2" at the $z$-value 5. The option Ticks allows you to do this. Here is an example: Plot3D[ 5 Sin[x y], { x, 0, π}, { y, 0, π}, Ticks -> { Automatic, Automatic, {-5, -3, 0, {5, "0.2"}}}]


3

It looks to me like you've got some inconsistency in your VertexNormals. This can certainly happen with numerically generated functions though, as others have rightly pointed out, it's hard to say for sure without some more specific info. Here's a simple way to force this sort of thing to happen. (* A list of vertices to feed to Polygon *) pts = ...


2

Short Answer Clear[Derivative] first. Long Answer OK, it's surprising that there seems to be no regular answer to this common problem for beginners, let me elaborate my comment into an answer. If you restart your Mathematica and run your code again then you'll find your problem no longer exists anymore! Then, why? Because Mathematica is unstable? Of ...


2

Let me give a workaround myself after some attempts. It is only a workaround thus other answers are appreciated! ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, PlotLegends -> Placed["example", {0.8, 0.1}], ColorFunction -> (White &)] This works. In other words, here the contour shading is not turned off, but instead colored as ...


2

Here's some sample data along the lines of what I think you're using: {data1, data2, data3, data4, data5} = Table[{#, i} & /@ RandomVariate[NormalDistribution[i, i], 100], {i, 5}]; Now when we generate a 3D histogram with 10 bins, we get gaps: Histogram3D[{data1, data2, data3, data4, data5}, 10] The reason for this is that your bin ...


1

reorgdata = GatherBy[data[[1]], #[[2]] &][[2 ;;, All, 3 ;;]]; variances = Thread[Variance /@ reorgdata]; means = Thread[Mean /@ reorgdata]; Row[{ListPlot[means, PlotLabel -> "means", ImageSize -> 300], ListPlot[variances, PlotLabel -> "variances", ImageSize -> 300]}]


1

The plots you are producing by adding PlotLegends all have Head of Legended. So the closest to what you already have would be to do the following: Legended[ ContourPlot[ Cos[x]+Cos[y],{x,0,4 Pi},{y,0,4 Pi}, ContourShading->None ], Placed["example",{0.8,0.1}] ] This produces an output that is of the same type as your plot with contour shading ...


1

Another workaround is to create the plot as normal and then delete all the Polygon expressions: ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, PlotLegends -> Placed["example", {0.8, 0.1}]] // DeleteCases[#, _Polygon, -1] &


1

There seem to be at least two issues here: You are not resetting ExtractionCon = {} inside the outer Do loop, therefore Divided1 grows longer than Partition1 With (1) corrected you will get a different error (repeated): Set::setraw: Cannot assign to raw object 3. >> because the x* Symbols now have values, and they evaluate before the assignment is ...


1

I can't make heads or tails of above, but perhaps this will get you started. Read the documentation - it's your best source of information. First, let's get some solution from NDSolve : sol = NDSolve[{u''[t] + u[t] == 0, u[0] == 0, u'[0] == 1}, u, {t, 0, \[Pi]}] (* {{u->InterpolatingFunction[{{0.,3.14159}},<>]}} *) So, NDSolve has given us a ...



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