Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 16

Questions on creating visualizations from functions or data using high-level constructors such as Plot, ListPlot, Histogram, etc.

1 vote

Indefinite Integral long time plotting

Have you tried defining your functions like this: ClearAll[f]; f[t_, z_] = Total@Table[ Exp[-((n^2)*(Pi^2)*t)/(100^2)]*Cos[0.8*n*Pi]* Cos[(n*Pi/2) - (n*Pi*z/100)], {n, 1, 100}]; Pw1[t_?N …
acl's user avatar
  • 19.9k
6 votes

How to plot imaginary part of a function

I am probably misunderstanding you but, to see branch cuts and the like, you can do this sort of thing: GraphicsGrid[ {{Plot3D[Im[(x + I*y)^(1/3)], {x, -5, 5}, {y, -5, 5}], Plot3D[Re[(x + I*y)^(1 …
acl's user avatar
  • 19.9k
5 votes

How do I plot a function over a subset of the displayed interval?

Piecewise would work but displays a spurious line at 0 vertical coordinate: f[x_] := Sin[x]; Plot[Piecewise[{{f[x], x < 2 Pi}}], {x, 0, 4 Pi}] (note the horizontal line for $x>2\pi$). One can av …
acl's user avatar
  • 19.9k
5 votes
Accepted

How to add a grid on Plot, ListLinePlot and ListPlot?

GridLines? eg ListLinePlot[Table[Sin[x], {x, 0, 10, .1}], GridLines -> Automatic] and similarly for Plot[Sin[x], {x, -5, 5}, GridLines -> Automatic] ListPlot[Table[Sin[x], {x, 0, 10, .1}], GridL …
acl's user avatar
  • 19.9k
2 votes
Accepted

Plot a 3D graph while changing the range of the parameter

Your syntax is wrong, as you probably know. Maybe you want something like this: ContourPlot3D[ Evaluate@Table[ (Cos[Pi/4] + x*Cos[0] Sin[Pi/4] + y*Sin[0] Sin[Pi/4])^2 == (1 + x^2 + y^2) …
acl's user avatar
  • 19.9k
2 votes

How to revolve a surface about a line other than the $x,y,z$ axes?

Not sure what you are expecting. ClearAll@f; f[x_] := x; RevolutionPlot3D[f[x], {x, 0, 4}, RevolutionAxis -> {6, 0, 0}, AxesLabel -> {"x", "y", "z"}] does revolve it around an axis which, as spec …
acl's user avatar
  • 19.9k
13 votes

Plotting an implicit polar equation

Does this ContourPlot[ Evaluate@With[ {r = Sqrt[x^2 + y^2], θ = ArcTan[x, y]}, θ^2 - Cos[r] == 0 ], {x, 0.1, 4 Pi}, {y, 0, 4 Pi} ] work? Plot:
acl's user avatar
  • 19.9k
18 votes
Accepted

How do I plot Thomae's function in Mathematica?

I'd suggest producing a list of rational numbers and then plot the function there, like so: maxq = 100; fracs = Table[p/q, {q, 2, maxq}, {p, 2, q}] // Flatten // DeleteDuplicates; pq = {#, 1/Denomina …
acl's user avatar
  • 19.9k
1 vote

Sharp ListDensityPlot

InterpolationOrder? data = Table[ With[{r = RandomReal[{0, 5}], t = RandomReal[{0, 2 Pi}]}, {r Cos[t], r Sin[t], Sin[r^2]/r^2}], {10^4}]; ListDensityPlot[data, Mesh \[Rule] None, Int …
acl's user avatar
  • 19.9k
7 votes

How do I plot x[t] vs. x'[t] (where x[t] and x'[t] are solutions to NDSolve)?

For instance, solving this sol = First@NDSolve[ {x''[t] == Sin[x[t]], x[0] == 1, x'[0] \[Equal] 0}, x, {t, 0, 10}] and then ParametricPlot[{x[t], x'[t]} /. sol, {t, 0, 10}] Of cou …
acl's user avatar
  • 19.9k
6 votes

How to assign different colors to list plotted in ParametricPlot?

ParametricPlot[ Evaluate@Table[{r*Cos[Theta], r*Sin[Theta]}, {r, 1, 5}], {Theta, 0, 2 Pi}] Why? Try Trace[] on both your version and the one with Evaluate. You see that, without Evaluate, you …
acl's user avatar
  • 19.9k
2 votes

An elegant way to plot a numeric function that returns a list, and have each element in a di...

This is horrendous, but: f[x_?NumericQ] := {x, x^2, Sin@x, Cos@x, ArcTan[x]} length = Length@f[0]; Show@Table[ Plot[f[x][[i]], {x, -1, 1}, PlotStyle -> {ColorData["SunsetColors"][i/length]}], …
acl's user avatar
  • 19.9k
5 votes
Accepted

Density plot for data with a wide dynamic range

ColorFunction takes an actual function as input. Thus, eg, Manipulate[ DensityPlot[ Abs[Exp[-Sqrt[x^2 + y^2]/5] BesselJ[0, Sqrt[x^2 + y^2]]], {x, -20, 20}, {y, -20, 20}, ColorFunction -> Fu …
acl's user avatar
  • 19.9k
30 votes
Accepted

How does Plot work?

If the problem is that a symbolic argument is passed, you can avoid it thus: ClearAll[sin]; sin[x_?NumericQ] := Module[{}, Print[x]; Sin[x] ] which simply defines sin so that it only matches …
acl's user avatar
  • 19.9k
1 vote

Plotting with NDSolve`StateData`

Something like this? L = -10; state = First[ NDSolve`ProcessEquations[{D[u[t, x], t] == + D[u[t, x], x, x] - Sin[u[t, x]], u[0, x] == Exp[-(x^2)], u[t, -L] == u[t, L]}, u, t, {x, …
acl's user avatar
  • 19.9k

15 30 50 per page