Questions tagged [plotting]

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

23
votes
5answers
2k views

Plot a partition of the sphere given vertices of polygons

I saw in this question that Mathematica can draw spherical triangles. I guess something similar can be done to plot a spherical polygon. I am interested in something similar: I have a set of points ...
23
votes
3answers
2k views

Plot 3D model of DNA in Mathematica

My friend asked me if we can plot a 3D model of DNA (deoxyribonucleic acid) in Mathematica. However, I am not really familiar with this and I don't know if Mathematica can do this. Could you answer ...
23
votes
2answers
913 views

Where can I get detailed information on how the Plot command works?

The command Plot[x^2, {x, -3, 3}, PlotStyle -> Arrowheads[{-.025, .025}]] /.Line -> Arrow produces this output. What I don't understand is what ...
23
votes
3answers
26k views

Placing x-axes label below rather than at end of axes

By default Mathematica places the x-axis labels at the end of the axes like Googling has suggested a way around this is to use Frame- for example ...
23
votes
2answers
43k views

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 ...
23
votes
4answers
6k views

Data interpolation and ListContourPlot

I am fairly new to Mathematica and I have two quick questions on using it for a Hydrology and Hydrogeology class. One is about data interpolation and interpolating without any data defined in an area. ...
23
votes
1answer
4k views

How to draw grid lines on top of a plot?

I want to use ArrayPlot instead of a DensityPlot because it seems to be faster (more here) I still want axes ticks to have real ...
23
votes
1answer
2k views

Is Mathematica `ContourPlot` function really so efficient?

I wanted to find the roots of the function $f(x,y)=\sin(3.2x)\sin(1.3y)-2.1 \sin(1.3x)\sin(3.2y)$. This is what the function looks like: ...
23
votes
2answers
558 views

Spacing out random walks so they don't overlap

From an external simulation program, I have lots of particle tracks which follow random walks, all of which start at or near the origin $(0,0)$. This means that when I plot the walks in Mathematica, ...
23
votes
1answer
689 views

Unwanted PlotMarkers appear at non-existent places

Bug introduced in 7.0 or earlier and persisting through 11.3 In this simple code ...
22
votes
5answers
2k views

Magnifying Glass on a Plot

Although there is a trick in TEX magnifying glass but I want to know is there any function to magnifying glass on a plot with Mathematica? For example for a function as ...
22
votes
2answers
4k views

How to plot a certain surface? What is its parametric equation?

The surface show below is very beautiful; however, I don't know its function either as an implicit function or in parametric form. Anyone have an idea about it and how to draw it with Mathematica?
22
votes
5answers
5k views

Plotting an implicit polar equation

Mathematica can use ContourPlot to draw implicit Cartesian equations, but doesn't seem to have a similar function to plot an implicit polar equation, for example $\...
22
votes
6answers
12k views

Plotting discontinuous functions without spurious vertical segments

Consider the plot of this discontinuous function: f[x_] := If[2 < x < 3, 0, x] Plot[f[x], {x, 0, 5}] I'd like to plot that without the vertical segments. ...
22
votes
4answers
7k views

How: 2D scatterplots with quantitative density-dependent coloring

Consider the following scatterplot of a 50K-point dataset: ...
22
votes
4answers
11k views

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 ...
22
votes
1answer
21k views

Mathematica code for Bifurcation Diagram

At the moment I am trying to construct a bifurcation diagram of the iterative function $f(x)=$ $ax-1.1975x^3$. I've scoured the internet for pre-made bifurcation diagrams and found many (mostly of the ...
22
votes
1answer
779 views

Import and Plot Git Commit History

What might be the easiest to import and plot all commit history for a github project? I'm looking for something similar to the following.
22
votes
1answer
893 views

How to write Morse code into Plot Dashing?

How can we define a dashing pattern in a plot such that it reads arbitrary text in Morse code? For instance Graphics[{DotDashed, Line[{{0, 0}, {5, 0}}]}] ...
22
votes
2answers
3k views

How do I map a Mollweide projection onto a sphere?

I have this Mollweide projection of the Earth circa 600 million years ago (http://jan.ucc.nau.edu/~rcb7/370moll.jpg).(1) I want to map this onto a sphere. My results have big black splotches in the ...
22
votes
2answers
431 views

Plotting a defined function gives different results from plotting the function directly

Consider the following piece of code: function[t_]:=Exp[-9 t^2]; LogLogPlot[{function[t],Exp[-9 t^2]},{t,.01,100}] I expect the two plots to exactly overlap each ...
22
votes
1answer
1k views

Fast DensityPlot

Is it possible to increase the performance of the DensityPlot? For example, let's try to plot the following "flower" ...
22
votes
1answer
270 views

Wrong labelling of contours with ListContourPlot

Bug introduced in 8 or earlier and persisting through 11.0.1 or later Consider this example: ...
21
votes
5answers
1k views

How to visualize the voting choices in the moderator elections?

I'm trying to use Mathematica to create some visual representations of the votes cast in the recent Mathematica-StackExchange moderator elections. (Not the vote-counting system itself, OpenSTV, but ...
21
votes
5answers
1k views

Transform sphere to an ellipse in $\mathbb{R}^2$

In Lay's Linear Algebra and Its Applications textbook, he defines the matrix $$A=\begin{bmatrix} 4 & 11 & 14\\8 & 7 & -2 \end{bmatrix}$$ and claims that the transformation $T(x)=A x$ ...
21
votes
4answers
9k views

Getting the interpolation function from a list plot

I have conducted a chemistry experiment and obtained a list of concentrations of a reactant against time. I plot a graph of this using Mathematica's ListPlot ...
21
votes
5answers
3k views

How do I plot a histogram with hatched shading?

I can plot an ordinary histogram with blue shading and black borders like this: T = RandomVariate[NormalDistribution[0, 1], 10000]; Histogram[T, 30] And I can ...
21
votes
4answers
4k views

How to plot a 3D surface with a simple black and white style?

Mathematica has great plotting capabilities. However, sometimes what is needed is a very basic black and white plot without textures, lighting, glow and other complex features. So, here is my question:...
21
votes
4answers
6k views

Visualization of Bivariate Distributions

I know it is perfectly possible to show the bivariate probability distributions in MMA. But my question is can we show each dimension of distribution in 2D dimension while we are showing the 3D plot? ...
21
votes
6answers
3k views

All curves in plot have the same style. Cannot be fixed with Evaluate[]

Usually, when I plot multiple curves in Mathematica Plot[{x,x^2,x^3},{x,0,1}] they are given different colors. However, if I try to construct a list inside the <...
21
votes
7answers
6k views

Ugly output when combining 2 plots with GraphicsRow

Here are the data that I want to plot: ...
21
votes
3answers
3k views

Removing unwanted appearance of underlying mesh

Let us first define two positive definite matrices: M1 = {{2, -6}, {4, 8}}; M2 = {{2, 3}, {4, 8}}; then set two points ...
21
votes
5answers
4k views

How to speed up the plot of NIntegrate?

Here is a toy example: f[t_] := NIntegrate[Sin[x], {x, 0, t}]; Plot[f[t], {t, 0, 10}] // Timing Even such a simple example will take 2.8 seconds on my computer. ...
21
votes
2answers
945 views

Plotting an Unreasonable Function

Without getting into too much detail, the following (very complicated) function recently appeared as a solution to a combinatorics problem I've been thinking about: $$P(n) = \frac{52!}{52^{52}} \cdot ...
21
votes
5answers
6k views

Spherical density plot of data set

I have a somewhat large number of 3-dimensional unit vectors ( ~ 100 000 unit vectors), and I am trying to visualize their distribution. First thing I tried was ...
21
votes
3answers
1k views

Creating DotPlots

I've been struggling to create a DotPlot like the one shown in Cleveland's The Elements of Graphing Data. Using the following dataset ...
21
votes
2answers
4k views

Basins of Attraction

How does one shade the basin(s) of attraction of a phase plot in Mathematica? I have been trying to do this using the system $$\begin{align*} \dot x &= y\\ \dot y &= -9\sin(x) - 0.20y \end{...
21
votes
4answers
1k views

Drawing the schematic diagram of algorithm

The B-Spline function used the alogrithm as shown below: I would like to draw it in Mathematica (Although this is my first time to use TreePlot) ...
21
votes
4answers
1k views

Shading under a curve with dots

I plotted the function $y=x^2$ using the Plot command Plot[x^2, {x,-5,5}] I need to shade the area under the curve using a ...
21
votes
4answers
15k views

How to change the axes' origin and direction?

I have manipulated an image and want to ListPlot it. However, the result is not to my liking because the conventions for drawing images and plots are different. ...
21
votes
3answers
14k views

Is there a way to make the tick marks larger?

In a Plot (actually, a Graphics) command, I'd like to make the actual tick marks larger than they are, but I can't find an ...
21
votes
4answers
1k views

LogPlot axes labels destroyed when working in high precision

Bug introduced in 7.0 or earlier and fixed in 11.0.0 (I'm using Mathematica 8.) I have a Taylor series: poly = Normal[Series[E^x, {x, 0, 10}]] I want to ...
21
votes
2answers
3k views

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 ...
21
votes
1answer
5k views

Collision of axes labels and ticks

Is there a way to prevent ugly collision of axes labels and axes number like in the following examples, without the need of adding white space: Plot1: ...
21
votes
1answer
936 views

Why would the color of graph change once the number of vertexes reach 1000?

I have created 3 graphs for vertexes number 998, 999 and 1000 as below:- ...
21
votes
1answer
1k views

How to get a plot generated by R returned in an output cell?

It seems we'll never have built in two axis plots and list plots in Mathematica but you can make them in R. ...
20
votes
8answers
3k views

How can I create a rectangular graphic with curved edges?

I want to make some button shaped graphics that would essentially be a rectangular shape with curved edges. In the example below I have used Polygon rather than <...
20
votes
4answers
9k views

How can I mark each of several plots with a parameter that identifies it?

I've got a two variable function that I'm plotting against one axis for a few different values of a parameter ...
20
votes
4answers
15k views

Plotting Fourier spectrum versus frequency of a signal

I have looked around here, and i am sure this has been answered, but i don't understand it. The thing is, I have taken a introductory signal processing course, and we had to use Mathematica, and i had ...
20
votes
4answers
6k views

Setting the default font for PlotLegends

I'm pleased that Mathematica 9 appears to have brought us prettier legends. If I always want the legend in ...