Tag Info

Hot answers tagged

12

I don't think you can control the interpolation used by Texture. One option might be to embed the image as a Raster primitive instead. Show[ParametricPlot[{20 + 1.4 x - 40 y, x}, {x, 0, 200}, {y, 0, 1}, BoundaryStyle -> Directive[Purple, Thick], PlotRange -> {{0, 201}, {0, 144}}, Prolog -> {Raster @ Reverse @ ImageData @ a}]] Zoomed ...


9

If you want a different 3D visualization, maybe try field lines. Usually, one should be suspicious of field line plots for time-dependent electromagnetic waves (because causality casts doubts on the meaning of plotting a spatially extended field line for a globally fixed time), but there have been recent high-profile papers that show such plots. Purely as ...


7

I can explain what is happening with RootLocusPlot, and it will also be useful for you to show the result you obtained by hand and why the result of RLPlot does not seem right compared to that. (My explanation is based on the plot shown in the question.) The charactersistic equation of the system is -k (-(5/2)+s) (-2+s)+(-4+s) (-1+s)==0. At k==0 the ...


7

The expression that is plotted in the legend are the provided pure functions (with some scoped internal variable names). PlotLegends is somewhat confused so we have to provide explicit entries for the Legend. Since the desired result is somewhat unclear here a few suggestions: v[x_, k_] := k*x^-k; g[x_, k_] := (x^-k)*Sin[x^k]/(1 + x^k); f[x_, k_] := x^k/(1 ...


6

Here's a quick 5 minute reproduction of the diagram (I've left the labeling of individual points out): With[{ε = 0.05, L = 1, thick = AbsoluteThickness[1]}, Graphics[{ thick, Circle[{0, 0}, ε, {π/2, 3 π/2}], Arrowheads[{{0.05, 0.99}}], Arrow[{{0, -ε}, {L, -ε}, {L, -L}, {-L, -L}, {-L, L}, {L, L}, {L, ε}, {0, ε}}], ...


6

Graphics[{Circle[{0, 0}, 1, Pi/2 {1, 3}], Arrow[{{10, 1}, {0, 1}}], Line[{{0, 1}, {10, 1}, {10, 10}, {-10, 10}, {-10, -10}, {10, -10}, {10, -1}, {0, -1}}]}, Axes -> True, Ticks -> None]


6

You are asking: Is there a simple option to add additional grid lines to the automatic ones? Thank you! Well, I couldn't think of one, but out of curiosity I tried another approach (different to the Epilog I'd also rather choose). It seems to work pretty ok, so I figured I might share. As the other answer is much more versatile, I didn't spend too ...


5

The comment is right, but here is a thought. If you'd like a cube you should use Cuboid and leave the 3D box for the role it plays - to put things in a better 3D perspective (if needed). Then you precisely control all coordinates. You could try something like Graphics3D[{ {Red, Opacity[.7], Polygon[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]}, {Opacity[.2], ...


5

Not sure why J.M.'s comment doesn't meet your requirements: DateListPlot[ RandomReal[1, 20], {2000}, Joined -> True, PlotRange -> All, GridLines -> {Automatic, None}, Epilog -> {Directive[Thick, Magenta], Line[ {Scaled[{0, -1}, {{2010, 1, 15}, 0}], Scaled[{0, 1}, {{2010, 1, 15}, 0}] }]}] This incorporates Scaled, ...


5

What you are plotting is: v /. {x_, y_} :> {x, y, 0}, u} If you look at this, it is a collection of points in 3D followed by a collection of points in 2D. You need o have purely a list of 3D points in order for ListPointPlot3D to work. For example, {v /. {x_, y_} :> {x, y, 0}, u /. {x_, y_} :> {x, y, 1}} will work fine, putting v on one plane ...


4

As Murray noted, you must have made an error calculating the attraction point: 1/2 (1 - Sqrt[1 + 12 μ]) /. μ -> 0.2 -0.4219544457 Trying a point close to this with your code (Please, please, never provide code again as a bitmap. Typing this is no fun.) cobweb::usage = "cobweb[f,x0,nmax,ndrop] produces a cobweb plot for the recursive ...


4

Using a combination of nearest resampling and a large size (e.g. 2000 pixels) should do the trick. a = ImageResize[Import["http://i.imgur.com/PiLKV6S.png"], {2000}, Resampling -> "Nearest"]; Show[ParametricPlot[{20 + 1.4 x - 40 y, x}, {x, 0, 200}, {y, 0, 1}, BoundaryStyle -> Directive[Purple, Thick], PlotRange -> {{0, 201}, {0, 144}}, Prolog ...


4

Use ListPlot3D. data = {{104.0152`, 31.3715`, -1.8614`}, {103.9882`, 31.3934`, -4.7228`}, {103.9611`, 31.4154`, -6.5841`}, {103.9341`, 31.4373`, -8.4455`}, {103.907`, 31.4592`, -9.3069`}, {103.9591`, 31.3203`, -1.8614`}, {103.9318`, 31.342`, -4.7228`}, {103.9045`, 31.3637`, -6.5841`}, {103.8772`, 31.3854`, -8.4455`}, {103.8498`, ...


4

Another way, copying once more from @J.M.'s answer here: How can I fill under a function in a plot just to right of a specified vertical line? Using @b.gatessucks definition of f: f[r_, k_] = (HarmonicNumber[k] - HarmonicNumber[k - r]) (HarmonicNumber[k] - HarmonicNumber[-1 + r]) we can do: With[{ff = f[r, 10]}, ...


3

One way : f[r_, k_] = (HarmonicNumber[k] - HarmonicNumber[k - r]) (HarmonicNumber[k] - HarmonicNumber[-1 + r]) sol1 = r /. FindRoot[f[r, 10] == 0.4, {r, 2}]; sol2 = r /. FindRoot[f[r, 10] == 0.4, {r, 9}]; m = FindMaximum[f[r, 10], {r, sol1, sol2}][[1]]; Show[Plot[f[r, 10], {r, 0, 11}], Plot[f[r, 10], {r, 0, sol1}, Filling -> Bottom], ...


3

You could draw an invisible second function (a block) and have the filling occur between the two: f[r_, k_] = (HarmonicNumber[k]-HarmonicNumber[k-r])(HarmonicNumber[k]-HarmonicNumber[-1 + r]); max = NMaxValue[{f[r, 10], 0 < r < 11}, r] min = NMinValue[{f[r, 10], 0 <= r <= 11}, r] Plot[ { f[r, 10], Rescale[ Boole[f[r, 10] > 0.4], ...


3

Here's one way to get a contour plot showing all the regions without going to very large numbers of plot points. The PDF of the SmoothKernelDistribution is just an InterpolatingFunction, so we can examine the underlying data and extract the grid positions at which the function value exceeds the contour value. Those grid positions can then be fed into the ...


3

To force a numerical integration over the discrete Boole[] seems unsuitable to this problem. Why not sample the distribution back to a non-continuous representation and approximate the integral there? You can get fancier with the integration approximation if you need to. data2 = Table[ Evaluate@PDF[\[ScriptCapitalD], {x, y}], {x, 0, 1024}, {y, 0, 1024}]; ...


3

As noted by xslittlegrass you can get coincident vertices by instructing Graphics3D not to use padding of the plot range, by using PlotRangePadding -> 0. AspectRatio controls the two dimensional image aspect ratio rather the proportions of the three dimensional rendering which is what I expect you intended; for that use BoxRatios. Specifying Boxed -> ...


3

As an alternative, you can also use Image3D to visualize 3-variable functions: valueInterval = Through[{MinValue, MaxValue}[ {x^2 + y^3 + z^4, And @@ Thread[-1 <= {x, y, z} <= 1]}, {x, y, z}]]; Outer[ Function[{z, y, x}, If[x > 0 && y > 0 && z > 0, 0, 4 Mod[Rescale[x^2 + y^3 + z^4, valueInterval], 1/5] ]], ...


2

Manipulate[ ContourPlot[x^2 + y^3 + z^4, {x, -1, 1}, {y, -1, 1}, ColorFunction -> "DarkRainbow"] ,{z, -1, 1}] EDIT: A few values in 3D plot: Plot3D[Evaluate@Table[x^2 + y^3 + z^4, {z, {0, 0.8, 1}}], {x, -1, 1}, {y, -1, 1}, PlotStyle -> {Red, Green, Blue}] But I'd rather put a few contour plots next to each other. In general take a look ...


2

Thanks to george2079 I was able to get what I needed: Data = {{-1, 0}, {1, 0}, {0, 0}, {1, 1}, {1, -1}, {1, 1/Sqrt[3]}, {1, -1/Sqrt[3]}, {0, 2/Sqrt[3]}, {0, -2/Sqrt[3]}, {0, Sqrt[2]}, {0, -Sqrt[2]}} Show[Plot[{0 x, -x, x, -Sqrt[2 - x^2], Sqrt[2 - x^2]}, {x, -3, 3}, PlotStyle -> {Purple}], Plot[0 x, {x, -3, 3}, PlotStyle -> {Blue}], ...


2

Assuming data can be simulated like this: data1 = Table[200 Exp[-x^2 - y^2], {x, -2, 2, 0.1}, {y, -2, 2, 0.1}]; data2 = Table[ 1000 Exp[-x^2 - y^2], {x, -2, 2, 0.1}, {y, -2, 2, 0.1}]; where data1 is the set with a maximum of 200 and data2 is the set with a maximum of 1000, you need the ColorFunctionScaling and ColorFunction parameters in your ...


2

When you specify a ColorFunction it uses an absolute scale if you tell it explicitly to not scale it: ColorFunctionScaling->False. f[x_] = 1 - (x - 1)^2; colfunc = Function[{x, y}, Hue[y]]; g1 = Plot[f[x], {x, 0, 2}, ColorFunction -> colfunc, ColorFunctionScaling -> False]; g2 = Plot[f[x]/2, {x, 0, 2}, ColorFunction -> ...


2

You can get a function for your data using interpolation. First reformat Szabolcs variable data into data2' and create a functionf` data2 = Table[{data[[i, {1, 2}]], data[[i, 3]]}, {i, 1, Length[data]}]; f = Interpolation[data2, InterpolationOrder -> 1] You can plot the function {minx, maxx} = {Min[data[[All, 1]]], Max[data[[All, 1]]]}; {miny, ...


1

For version 7: Warning: for simplicity r is not localized in either method; Formal Symbols advised in practice. hf[K_] := With[{H = HarmonicNumber}, (H[K] - H[K - r]) (H[K] - H[r - 1])] Plot[ {If[hf[10] < 0.4, hf[10]], If[hf[10] >= 0.4, hf[10]]}, {r, 0, 11}, Filling -> {1 -> Bottom}, PlotStyle -> Black ] Or: Plot[ {If[hf[10] < ...


1

Maybe you can consider a solution like this instead? newPoint[{col_, Point[pt_]}] := Block[{nc, tr}, {nc, tr} = (* use RandomChoice to pick an affine transformation and its corresponding color *) RandomChoice[{{Red, AffineTransform[{{{0.5, 0}, {0, 0.5}}, {0, 0}}]}, {Green, AffineTransform[{{{0.5, 0}, {0, 0.5}}, {1/2, 0}}]}, ...


1

Using CompoundExpression (a.k.a ";"), you can include expressions within Manipulate: Manipulate[ ex99 = a x + b; Plot[ex99, {x, 0, 1}], {a, 0, 1}, {b, 0, 1} ] The semicolon ";" is postfix notation for the CompoundExpression command, which has amongst other things the effect of evaluating the command in the kernel without producing ...


1

You can play with the method of integration. The default, "GlobalAdaptive", is not very good in this case. You should also consider how much precision is desired. For instance, the example distribution is based on a distribution of 3000 points and the resulting PDF is interpolated on 64 by 64 grid. I'll seek a precision of three digits. "MultiPeriodic" ...


1

I would convert first your data, so that you can handle them in an easier way. First I skip the information about the columns (the header) with data2 = data[[2 ;; -1]]; then I convert the times (year, month, date, etc.) with something like data3 = Transpose[{data2[[All, 1, 1]] + data2[[All, 1, 2]]/12 + data2[[All, 1, 3]]/(12*31), data2[[All, 2]], ...



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