Questions tagged [plotting]

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

Plotting relates to the construction and customization of plots, diagrams, charts and other visualizations through the use of specialized construction functions such as Plot, ListPlot, Plot3D, etc. (plot family) and Histogram, BarChart, PieChart, etc. (chart family). Plotting includes both data and function visualization.

Questions solely about construction of graphics (including 3D) through the direct use of primitives, directives, and functions should use .

Questions about creating visualizations using a mixture of visualization functions and additional elements may use both and .

Useful links:

Frequently asked questions:

15867 questions
83
votes
8 answers

How to add a vertical line to a plot?

In the plot below I would like to add two vertical lines at $x = \frac{\pi}{15} \pm \frac{1}{20}$. How can I do that? f[x_] := (x^2 z)/((x^2 - y^2)^2 + 4 q^2 x^2) /. {y -> π/15, z -> 1, q -> π/600} Plot[{f[x], f[π/15],f[π/15]/Sqrt[2]}, {x, π/15 -…
sjdh
  • 7,757
  • 5
  • 37
  • 47
78
votes
4 answers

Plotting implicitly-defined space curves

It is known that space curves can either be defined parametrically, $$\begin{align*}x&=f(t)\\y&=g(t)\\z&=h(t)\end{align*}$$ or as the intersection of two surfaces, $$\begin{align*}F(x,y,z)&=0\\G(x,y,z)&=0\end{align*}$$ Curves represented…
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
57
votes
4 answers

Generating a broken or snipped axis in ListPlot

I have two data sets, data1 and data2. For example: data1 = {{1, 1.1}, {2, 1.5}, {3, 0.9}, {4, 2.3}, {5, 1.1}}; data2 = {{1, 1001.1}, {2, 1001.5}, {3, 1000.9}, {4, 1002.3}, {5, 1001.1}}; ListPlot[data1, PlotRange -> All, Joined -> True, Mesh ->…
Andrew
  • 10,569
  • 5
  • 51
  • 104
55
votes
5 answers

Vary the thickness of a plotted function

I know, that I can change the color of a function with the help of PlotStyle: Plot[Sin[x], {x, 0, 3 Pi}, PlotStyle -> {Green, Thickness[0.01]}] I also know, that I can vary the color in relation to the function value: Plot[Sin[x], {x, 0, 3 Pi},…
abrhv
  • 653
  • 6
  • 6
49
votes
3 answers

Why are my plots displaying behind the axes?

I need to create graphs with light gray axes and black lines. All of my plots display behind the axes. How can I make the plots display over the axes? Plot[2 x - 2, {x, -10, 10}, PlotRange -> {{-10, 10}, {-10, 10}}, PlotStyle ->…
lvames
  • 431
  • 4
  • 4
46
votes
4 answers

How can I make an X-Y scatter plot with histograms next to the X-Y axes?

I just saw a nice plot there: How could I implement that in Mathematica — by which I mean the plot structure, not so much the styling.
Mike Honeychurch
  • 37,541
  • 3
  • 85
  • 158
41
votes
2 answers

Specific initial sample points for 3D plots

PlotPoints lets you determine how many sample points you want in each direction, but sometimes I want specific ones. For Plot you can give an argument like PlotPoints->{None, pts} to use pts as the initial points: Show[ Plot[Sin[x], {x, -3 Pi, 3…
ssch
  • 16,590
  • 2
  • 53
  • 88
35
votes
4 answers

How to insert a plot into another plot

I would like to know whether there is a way to insert a plot into another plot. I would like to do some plot from a function an then, inside this plot, in the right down corner add a smaller plot of the same function covering a smaller region. I…
pablo
  • 723
  • 1
  • 9
  • 17
33
votes
3 answers

I'd like to display field lines for a point charge in 3 dimensions

I'd like to display field lines for a point charge in 3 dimensions. Not a force field (short arrows) but continuous field lines that start on the charge.
Rainforest Frog
  • 1,027
  • 1
  • 10
  • 14
32
votes
5 answers

How do I make framed plots the same size?

Suppose that I have two plots, plot1 and plot2. The plots have different ranges and different axes. Here is a fictitious example that makes no scientific sense, but demonstrates my issue with the size of framed plots: imgSize = 475; plot1 =…
Andrew
  • 10,569
  • 5
  • 51
  • 104
32
votes
5 answers

How to plot the contour of f[x,y]==0 if always f[x,y]>=0

I've been stuck at this problem for weeks and I've asked several related questions here: ContourPlot shows only part of the contours [duplicate] How to plot the contour of the radius part of a complex function a lot of help has been kindly given but…
xslittlegrass
  • 27,549
  • 9
  • 97
  • 186
30
votes
2 answers

Make a scatter plot from two lists

I have two lists of values xx = {0.1, 0.3, 0.35, 0.57, 0.88, 1.0} yy = {1.2, 3.5, 4.5, 7.8, 9.0, 12.2} I want to make a scatter plot (list plot) with xx as x axis and yy as y axis. The help document on ListPlot tells me I have to use ListPlot[{{x1,…
JACKY88
  • 575
  • 2
  • 6
  • 10
29
votes
2 answers

What is the fundamental difference between ArrayPlot and MatrixPlot?

Suppose I have a matrix called data. It seems that I can plot data using either ArrayPlot or MatrixPlot: data = {{1, 0, 1}, {0, 0, 1}}; imgSize = 200; Grid[{{ ArrayPlot[data, ImageSize -> imgSize], MatrixPlot[data, ImageSize -> imgSize] …
Andrew
  • 10,569
  • 5
  • 51
  • 104
29
votes
4 answers

Place a small gap between axes and plot?

See for example this picture produced with R: You can see there is a small white space between the x-axis and the y-axis, so that the axes do not cross. How can I do this with Mathematica, for a ListPlot or a Histogram?
a06e
  • 11,327
  • 4
  • 48
  • 108
28
votes
3 answers

How to create a heatmap from list of coordinates?

I have a list of coordinates in form {{x1,y1},{x2,y2},...} Is there a way in mma to builds density plots based on position ( ListDensityPlot calculates density based on value in {x,y,value})? I want to create something similar to heatmap.py.
FDSg
  • 1,805
  • 1
  • 17
  • 17
1
2 3
99 100