Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [plotting]

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

20
votes
4answers
4k views

Change the inner color of markers

I would like to have a marker with white as its inner color, to be able to make this kind of graph: If I use PlotMarkers -> Style["\[FilledSquare]", White], it ...
20
votes
3answers
1k views

How to make a pie chart using custom image

Can we make a pie chart using a custom picture? For example, consider this image of one cent coin: I would like to use this image and cut pieces out, depending on data, and also make a clickable pie ...
20
votes
4answers
7k views

ListPlot with plotmarkers determined by point

I am trying to build on a simple example here: td = Prime[Range[25]] dsk = Graphics[{Blue, Disk[]}] ListPlot[td, PlotMarkers -> {dsk, 0.7}] How can I make ...
20
votes
5answers
3k views

How to extract a contour line (or a region) from a ContourPlot?

Given a ContourPlot with a set of contours, say, this: is it possible to get the contours separating domains with the different colors in the form of lists? For ...
20
votes
4answers
509 views

Reproducing the XKCD “Consensus New Year” plot

This xkcd strip for December 31, 2018 had the following plot: How may I use CountryData with DateListPlot (or other related ...
20
votes
5answers
1k views

In a ListPlot of LinearModelFit, Fill to the regression line

In the help for LinearModelFit, the regression line can be added to the scatter plot like this: Show[ListPlot[data], Plot[lm[x], {x, 0, 5}]] Is it possible to ...
20
votes
3answers
13k views

How to express ticks in scientific form? [duplicate]

I want to express the ticks in scientific form. I tried two ways as following ...
20
votes
2answers
672 views

Ad hoc graphics primitives-like objects

Sphere is one of the three-dimensional graphics primitives available in Mathematica and can be easily used to created very useful images. For instance, in the ...
20
votes
2answers
2k views

RegionPlot is producing odd gaps, even for simple functions. Is there an option to prevent this?

When I use RegionPlot to plot the region between two functions, I get strange gaps in the resulting figure. Is there a way to prevent this from happening? For ...
20
votes
2answers
688 views

Coneheads instead of Arrowheads

I was reading a paper by Holten and van Wijk called "A User Study on Visualizing Directed Edges in Graphs". They show a number of graphical alternatives to using arrowheads: I find the final one (f), ...
20
votes
3answers
25k views

Plot data from txt file?

I have data in file.txt which can be expressed by 20000x11 matrix. I do not want to import all of these data. How can I plot graph of the column 1 & column 4?
20
votes
2answers
9k views

How to save plots in grayscale

As sophomoric as this question seems, how should I save plots in grayscale in Mathematica? I generally like eps images for their scalability and I use ghostscript or other third party perl scripts ...
20
votes
2answers
1k views

Can A Plot Be Overlayed With A Map?

Some brief, only slightly important background. I am doing a research project using the data from NASA's GRACE mission. I wrote a short Perl script to take two data files and find the change in ...
20
votes
3answers
2k views

Is it possible to position ticklabels on the negative y axis on its right side?

Is it possible to position ticklabels on negative $y$ axis on its right side? Ticklabels on positive $y$ axis should remain as usual:
20
votes
2answers
2k views

Interactively extract points from a plot (ListPlot or SmoothDensityHistogram)

Is there a way to dynamically define a polygon on a plot (I'm working with ListPlot and SmoothDensityHistogram) to select a ...
20
votes
1answer
601 views

Why Plot3D shows differently with almost the same data

I really can't understand this. I wrote two functions, one with Compile called funcom, one with librarylink to link a fortran ...
20
votes
2answers
8k views

How could I add arrows to the axis of a figure?

It is easy for me to add arrows to the axes of the a figure by taking advantage of AxesStyle -> Arrowheads[] when the differences between the horizontal and ...
20
votes
2answers
2k views

ListContourPlot interpolation fails if x and y axes have different scales

To summarize what is below: ListContourPlot doesn't work when the domain has different x and y scales (fails when x/y~10^4, which seems surprisingly small). Is it possible to call ListContourPlot on ...
20
votes
1answer
3k views

Thickness of logarithmic tick marks

Bug introduced in 8 or earlier and persisting through 12.0 I'm trying to plot a graph wit a logarithmic y-axis. Since I'm exporting the graph to pdf and later printing it, I want to manually set the ...
20
votes
1answer
8k views

Adding arrows in curves

Let's consider the following case ...
20
votes
2answers
4k views

Export to PDF - scaling grids of plots and text size

Sometimes I have occasion to make big grids of plots. As a toy example: ...
20
votes
1answer
412 views

Highlight Pie in PieChart

PieChart has the nice functionality of highlighting a single pie when you click on it. It is then sticking out a little. See the following example: ...
20
votes
1answer
6k views

Vertically aligning two separate plots

How do I vertically align plots so that the two plots are displayed in a way that lines up with respect to the axes? The code I have so far is: ...
20
votes
1answer
998 views

New behavior of PlotRange in Mathematica 10

In Mathematica 10, when I plot data that has small changes around some non-zero value, the plot chooses a PlotRange that "collapses" the data so that the variations ...
20
votes
1answer
1k views

Using Evaluate and Evaluated -> True in Plot

A few use cases: (1) This, as expected, returns (almost) immediately: f[x_?NumericQ] := Evaluate[(Pause[1]; x)] Plot[f[x], {x, 0, 1}] (2) This takes ...
20
votes
1answer
6k views

Is it possible to style multiple Plot or ListPlot curves using a color gradient?

I am using Mathematica 8. In Mathematica, there is a default PlotStyle coloring in Plot and ...
20
votes
1answer
248 views

Shaking parts in animations

I made the following animation, but the disks and the rectangle are shaking, breaking the smoothness of the motion. Here is a minimal example. If you look carefully you will see the disks are ...
20
votes
0answers
702 views

ListContourPlot and ListContourPlot3D use better interpolation for arrays of values than for lists of tuples (i.e. {{x,y,z,f[x,y,z]}..}

From reading the documentation, it seems that ListContourPlot3D should work equally well on an array versus a list of tuples, ?ListContourPlot3D ...
19
votes
5answers
4k views

Plotting an epicycloid

I am fairly new to Mathematica, and I cannot figure out how to plot an epicycloid. I have plotted some neat looking things in my attempts, but I still can't make one. I am not looking to make an ...
19
votes
4answers
7k views

Creating overlapping histogram plots

I am plotting two histograms on the same graph: g1 = Histogram[bc, ChartStyle -> {Red}] g2 = Histogram[bcx] Show[g1, g2, PlotRange -> {{0.1, 0.6}, All}] ...
19
votes
5answers
2k views

MatrixPlot with Tooltips

MatrixPlot is very nice to have a first look of data, I would like to have a MatrixPlot with tooltips for each value. I tried ...
19
votes
3answers
2k views

Get x and z coordinate from an image and make a parametric surface of revolution

In this blog entry, this step is mentioned: I grabbed an image of a Peugeot wine glass from the web and used the Get Coordinates function to digitize its outline, which I fed to Interpolation to ...
19
votes
4answers
812 views

How can I influence the spaces between labels on a BarChart

I want to chart data using a BarChart, the labels on the x-axis are numbers. Unfortunately they are so close to each other it really looks strange and more like one ...
19
votes
5answers
2k views

Proper way to Plot a single function in two different styles?

I've got this code ...
19
votes
3answers
990 views

Custom functions by delegating options in a specific way and using core functions

I'd like to create a custom function that does essentially the same as a core function of mathematica but uses different default settings. Example: I want a Plot function that uses Mathematica's core ...
19
votes
3answers
4k views

Extracting the coordinate of a particular point of interest from a ListPlot

Is there a way to obtain the coordinate of a point of interest in a ListPlot? As an example, I have a list containing many sets of 2D coordinates and the plot ...
19
votes
3answers
7k views

How do I use Map for a function with two arguments?

I'm a newbie who tries to be a good boy, and use Map instead of writing out a list of functions. I have a table I want to Map ...
19
votes
5answers
915 views

Add a rug representation to plot

This question came to me when I read How convert list of numbers to list of points on x-axis? @Mr.W suggested Interlacing a single number into a long list for the question. @Artes provides a very ...
19
votes
2answers
2k views

Modify existing color scheme

I am using the "TemperatureMap" color scheme for image processing. How can I set the lowest color value to Black? Generally ...
19
votes
6answers
4k views

Drawing minor gridlines

What's the best (most elegant, shortest, easiest to read) way to add minor grid lines to a plot? Here is an example: ...
19
votes
3answers
4k views

How to get grid lines at all (log) tick marks in Version 10?

Bug introduced in 10.0.0 and fixed in 10.1.0 Update: It seems that only versions 10.0.0, 10.0.1, and 10.0.2 are affected by this problem. For 10.0.0 there is no general solution known to me due to ...
19
votes
2answers
990 views

How can I generate a legend for a BubbleChart?

Is there a way to make a nice disk radius legend (with linear or log scale) for a BubbleChart? Something like the following example should be built in:
19
votes
2answers
23k views

Formatting legend text font

I am using this code to plot a graph, and I am trying to make the font of the legend bigger. ...
19
votes
3answers
663 views

Dataset seems unable to handle ListDensityPlot and ListContourPlot

If I create a Dataset: ...
19
votes
3answers
12k views

Plotting vectors originating from the origin in 3D

I have an array of data with 3D elements. Ex: x = {{1,2,3}, {3,4,5}, {5,6,7}}. I want to show this data in 3 dimensions, such that each point in the space is shown ...
19
votes
1answer
10k views

Plot electric potential and field

I am trying to plot the electric potential of a dielectric cylinder along with its field. The potential is a piecewise function: ...
19
votes
2answers
5k views

Arrows on axes in Plot3D

I use the following code to draw Arrows on Axes in 2D graphics: ...
19
votes
3answers
3k views

FrameTicks setting for “tick marks on all sides, but labels only on right and top”

Short version: Is there a value for the FrameTicks option that retains the default tick marks on all sides, and puts tick labels only on the right and top sides? I ...
19
votes
3answers
1k views

Centering date labels over the year in a DateListPlot

The canonical formatting for date labels in a DateListPlot is for the year or other date label to be centered over the tick at the start of the relevant period. <...
19
votes
3answers
2k views

Using Inset[..] to overlay a Graphics3D with its raster version

Preamble First let me explain the why. You can skip this and go directly to the question if want to answer it right away. We had more than one discussion about how to produce nice looking 3d plots ...