# Tag Info

## Hot answers tagged plotting

21

If I'm not mistaken, a complement is defined as the set of elements in one set that are not contained in a given other set. In your case, you have specified the 'other' set (the union of S1, S2 and S3), but not the 'one' set. As you phrased it, I guess that set must be $\mathbb R^3$. So, the complement is the difference between an infinite space and a finite ...

15

A simple alternative is to use Plot3D with both RegionFunction and Filling. Plot3D[y, {x, 0, 1}, {y, 0, 1}, RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 1 && x >= 0 && y >= 0 && z >= 0], Filling -> 0, FillingStyle -> Opacity[.75], PlotStyle -> Opacity[.5], AxesLabel -> (Style[#, 14, Bold] ...

14

It definitely has something to do with the Interpolation function. Evaluating tempdata = Import["http://www.inrim.it/~magni/cm.dat.gz", "Table"]; cmfunc = Interpolation[tempdata] we get the warning Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will ...

13

You can use ConvexHullMesh to generate a geometric region to give as a plotting domain to RegionPlot. Using your data: data2 = Flatten[Table[{i, j, Sqrt[i^2 + j^2]}, {i, 1, 20}, {j, i/2, i, i/6}], 1]; supports = data2[[All, 1 ;; 2]]; RegionPlot[Sqrt[x^2 + y^2] < 10, {x, y} ∈ ConvexHullMesh[supports]] More in detail, here is the relationship between ...

13

Accumulate@Array[b, {3}] (* {b[1], b[1] + b[2], b[1] + b[2] + b[3]} *) therefore: {a, b} = Transpose[list]; Transpose[{a, Accumulate[b]}] Also this will do the job: Rest@FoldList[{#2[[1]], #1[[2]] + #2[[2]]} &, {0, 0}, list] or even easier list[[All,2]]=Accumulate@list[[All,2]]; list

12

In v10 instead of GraphicsMeshInPolygonQ, you would use the more versatile RegionMember. Rewriting your code to use it: inPol = RegionMember[Polygon@pol, #] & RegionPlot[(Sqrt[x^2 + y^2] < 10) && inPol[{x, y}], {x, 0, 20}, {y, 0, 10}]

12

There are built-in magnifying glasses. However, spontaneously I don't know how to invoke one directly for a Plot. Therefore I'm going to demonstrate one way that converts the Plot Graphics object into an Image: Image@Plot[Sin[x], {x, 0, 4}] FrontEndExecute[FrontEndSelect2DTool["GetRectangleImageSelection"]] The image ribbon itself is ...

10

In versions from 8 to 10.3 the option Mesh->Full gets rid of the unwanted markers: ListLinePlot[{{12., 13., 6., 16., 15., 12., 7., 15., 15., 17.}, {9., 9., 9., 9., 9., 9., 9., 9., 9., 9.}}, Filling -> {1 -> {2}}, Frame -> True, FrameTicks -> {{Automatic, None}, {Automatic, None}}, GridLines -> {Range@10, Automatic}, PlotMarkers ...

10

FoldList[{0, 1} # + #2 &, list]

9

One can use the following simple approach. For each radius $r$ one can decompose the density $\rho(r,\theta)$ to waves $e^{im\theta}$. If $m$ is equal to the number of arms we obtain the phase of the density wave, i.e. the spiral function $\varphi(r)$. Then we can use this phase to separate all stars to arms with a certain (I hope, acceptable) accuracy. ...

9

Here's one where we treat the abdomen differently. First, look at this as a 2D parametric curve: r[t_] := E^Sin[t] - 24/10 Cos[4 t] + Sin[t/12] x[t_] := r[t] Cos[t] y[t_] := r[t] Sin[t] We can locate the abdomen by carefully partitioning the roots of x[t]. vals = First[Cases[Plot[Evaluate[x[t, 0]], {t, 0, 20π}], Line[l_] :> l, ∞]]; xroots = t /. ...

8

The short answer to your question is that what you are attempting is insane, so it should be no surprise the result is insane. That said, let us explore the problem in a way that may enlighten you as to what is going on. For this it is useful to look at the numeric behavior of (1 + 1/x)^x for large x. f[x_] := (1 + 1/x)^x Table[N[f[x]], {x, 1.*10^Range[6, ...

8

As pointed out by J. M.♦, Simon Woods's approach in #48486 could be used. sharpregplot[ region_, {x_, x0_, x1_}, {y_, y0_, y1_}, {z_, z0_, z1_}, opts : OptionsPattern[] ] := Module[ {reg, preds}, reg = LogicalExpand[region && x0 <= x <= x1 && y0 <= y <= y1 && z0 <= z <= z1]; preds = Union@Cases[reg, ...

8

H[s_] := (s + 1)/(s^2 + 5 s + 6) x[t_] := 3 Exp[-5 t] UnitStep[t] X[s_] := LaplaceTransform[x[t], t, s] Y[s_] := X[s]*H[s] Clear[y] y[t_] := InverseLaplaceTransform[Y[s], s, t] ?y Since y is defined with SetDelayed and Plot has the attribute HoldAll, you need to Evaluate it within the Plot Attributes[Plot] (* {HoldAll, Protected, ReadProtected} *) ...

8

There are two problems. One is that in your DSolve call, you should solve for the functions {a, b, ...} instead of the expressions {a[t], b[t],...}. (In my experience, it's almost always better this way.) The other is that to get the proper list structure for BarChart, you should use First@DSolve[..] to remove an unnecessary {}. dsol = First@ ...

8

Perhaps this is good enough: ListPointPlot3D[ Transpose[{a^2 + b^2, a c + b d, d^2 + c^2} /. Thread[{a, b, c, d} -> Transpose@Tuples[Range[-10., 10., 1.], 4]]]] On the other hand, if we set $A=(a,b)$, $C=(c,d)$, $\alpha = ||A||$, $\gamma= ||C||$, then x = A\cdot A = \alpha^2,\ y = A \cdot C = \alpha\gamma\cos\theta, z = C \cdot C = ...

8

Method 1: unconstrained regions You can easily do it with regions: ℛ = ParametricRegion[{a^2 + b^2, a c + b d, d^2 + c^2}, {a, b, c, d}]; RegionPlot3D[ℛ, Axes -> True] or ineq = RegionMember[ℛ, {x, y, z}] (* (x | y | z) ∈ Reals && ((y == 0 && x >= 0 && z >= 0) || (z > 0 && -y^2 + x z >= 0)) *) ...

8

The idea is simple: we take the graph made by TreePlot and we change (the coordinates of) the points for the graph nodes into more regularly spaced points. The solution below attempts to be somewhat robust. The arguments and options taken by TreePlot can be used. There is a check for can the symmetric layout of the binary tree be done in a such a way ...

8

This is an interactive zoom that you can use in CDF or notebook. It plots a small x-range around the MousePosition as it moves around the main plot and Insets that smaller plot into the main plot. f[x_] := Sin[x] + 0.05 Cos[10 x] Plot[f[x], {x, 0, π}, Epilog -> { Dynamic[ With[{xpos = First@MousePosition[{"Graphics", Plot}, {π/2, 0}]}, ...

7

ListPlot[{pts, pts[[{1, 2, 6, 15}]]}, Joined -> {False, True}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full]

7

I saw this problem recently on the Wolfram Community website and answered it there. I'll copy my answer here (http://community.wolfram.com/groups/-/m/t/603973) I'm not sure if there's a simple way to prevent the issue. I would do this by basically reconstructing the ListVectorPlot Function from VectorPlot. To make it easy, I'll just make an Interpolation of ...

7

Using your data plot1 = ListLinePlot[data, PlotStyle -> {Thick, Black}]; f = Function[t, a*t^n] /. FindFit[data, a*t^n, {a, n}, t, MaxIterations -> 1000] plot2 = Plot[f[t], {t, 2, 60}, PlotStyle -> Red]; and then Show[ plot1, plot2, ImageSize -> 400 ] The same technique used here can be applied to this problem: ...

7

Insetting a magnified part of the original Plot A) by adding a new Plot of the specified range xPos = Pi/6; range = 0.2; f = Sin; xyMinMax = {{xPos - range, xPos + range}, {f[xPos] - range*GoldenRatio^-1, f[xPos] + range*GoldenRatio^-1}}; Plot[f[x], {x, 0, 5}, Epilog -> {Transparent, EdgeForm[Thick], Rectangle[Sequence @@ Transpose[xyMinMax]], ...

6

How about you make a ListDensityPlot as usual in the original polar coordinates and then transform the vertices to Cartesian coordinates. data = Flatten[ Table[{r, θ, Sin[3 r] Cos[3 θ]}, {r, 0, 2 π, 2 π/100}, {θ, 0, 2 π, 2 π/100}], 1]; plot = ListDensityPlot[data] transformGraphicsComplex[f_, g_] := GraphicsComplex[f /@ First[g], Sequence @@ ...

6

Here is my take on the problem that takes the classic approach of leveraging Mathematica's plotting routines to find the roots, refine the roots using FindRoot, and then feeding these roots to the function f. Here's how it goes. Define num = 10; f[k_, p_] := Sqrt[1 + 4 Cos[k/2]^2 + 4 Cos[k/2] Cos[p]] rootFunction[k_, p_, n_] := Sin[p n] + 2 Cos[k/2] Sin[p ...

6

Here's one approach that uses MeshFunctions to highlight the parts of the bounding surfaces that belong to the region. So many different approaches are possible.... opts = Options[ParametricPlot3D]; SetOptions[ParametricPlot3D, {Mesh -> {{0}, 15, 15}, MeshStyle -> Opacity[0.], (* ignored -- bug? *) MeshShading -> {{{Automatic, ...

6

The behavior of Plot3D is due to the discontinuity processing associated to Round. (Note the pattern here has many of the same holes, but not exactly the same pattern.) The discontinuities occur whenever the argument to Round is a half-integer. Given the complexity of the argument to Round in this example, perhaps not all discontinuities are detected. ...

6

Here's one way. Note NDSolve would have returned an ElementMeshInterpolation, so some of these steps should be unnecessary in your use-case. Needs["NDSolveFEM"]; cp = CountryData["China", "Polygon"]; mesh = DiscretizeGraphics@RegionPlot@cp; emesh = ToElementMesh@mesh; cm = RegionCentroid[mesh]; values = EuclideanDistance[cm, #] & /@ ...

6

Why not simply data = Table[RandomInteger[{1, 20}], {20}]; Define the partition par = {{1, 8}, {9, 13}, {14, 16}, {17, 20}}; Plot BarChart[ Take[data, #] & /@ par, ChartLabels -> {{"1st", "2d", "3rd", "4th"}, CharacterRange["a", "t"]}] Update bar = BarChart[ data, ChartLabels -> CharacterRange["a", "t"]]; lip = ListPlot[ ...

6

A solution using Epilog: ListLinePlot[ t = Table[Fibonacci[n + 1]/Fibonacci[n], {n, 20}], PlotRange -> {{0, 22}, {0, 2.5}}, Ticks -> {{1, 2, 3, 4, 5, 10, 15, 20}, {GoldenRatio}}, AxesStyle -> Directive[Arrowheads[0.03]], PlotStyle -> Directive[Black], TicksStyle -> Directive[Red, 15], Epilog -> {PointSize[0.013], ...

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