Questions tagged [plot]

The graphical representation of a mathematical function or a set of data. There are different kinds of plots, such as line plots, bar plots, or scatter plots.

Wikipedia uses the following definition of plot:

A plot is a graphical technique for presenting a data set drawn by hand or produced by a mechanical or electronic plotter. It is a graph depicting the relationship between two or more variables used, for instance, in visualising scientific data.

Plots help greatly in visualizing the structure of your data, or the outcome of an analysis. Good plots yield insight into the data, which is often hard to gain from just looking at the numbers.

roughly has three separate systems which provide plotting facilities:

  • Base plot: these are the plot routines standardly available in R. The syntax works roughly equivalent to MATLAB. The first one creates a plot, then additional calls to, for example, points or lines adds additional graphical features to the plot.
  • lattice: which provides an implementation of Trellis graphics (S-PLUS) for R.
  • ggplot2: a loose implementation of the grammar of graphics for R.

Different programming platforms support a variety of plot options. Noteworthy are Python's - a 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms, Matlab's and Mathematica's plot provides the starting point for 2-D line plots, and so forth.

Another widely used library is ; which is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. For a brief introduction to the ideas behind the library, you can read the introductory notes. Here are a few examples to see what you can do with seaborn.

An additional plotting library is . Gnuplot offers easy plotting that can be done through the command line interface. It works for Mac, Windows, Linux, and other operating systems. Gnuplot is very powerful because of the range of options when it comes to types of plots (2d, 3d, histogram, etc.) and the output formats (PNG, EPS, SVG, etc.). More info can be seen here.


Related tags

37452 questions
9
votes
1 answer

100% area plot of a pandas DataFrame

In pandas' documentation you can find a discussion on area plots, and in particular stacking them. Is there an easy and straightforward way to get a 100% area stack plot like this one from this post?
Dror
  • 12,174
  • 21
  • 90
  • 160
9
votes
1 answer

How to plot multiple columns in R for the same X-Axis Value

I need to plot three values, to make three bars for each value of the X-Axis. My data is: In the X-Axis must be the column labeled as "m" and for each "m" value I need to plot the correspondent "x","y" and "z" value. I want to use ggplot2 and I…
Captain Nemo
  • 262
  • 1
  • 7
  • 22
9
votes
3 answers

How to annotate text along curved lines

I am trying to annotate text in plots so that they follow the curvature of the line. I have the following plot: And this is what I want to obtain, if I fix a particular y value for the annotation, for each curve it should place the annotation along…
Tom Kurushingal
  • 6,086
  • 20
  • 54
  • 86
9
votes
1 answer

Changing the length of axis lines in matplotlib

I am trying to change the displayed length of the axis of matplotlib plot. This is my current code: import matplotlib.pyplot as plt import numpy as np linewidth = 2 outward = 10 ticklength = 4 tickwidth = 1 fig, ax =…
Matt
  • 2,289
  • 6
  • 29
  • 45
9
votes
2 answers

Plotting correlation heatmaps with Seaborn FacetGrid

I am trying to create a single image with heatmaps representing the correlation of features of data points for each label separately. With seaborn I can create a heatmap for a single class like so grouped =…
fakedrake
  • 6,528
  • 8
  • 41
  • 64
9
votes
1 answer

How to add horizontal separator in R's heatmap.2

With the following codes: library(gplots) heatmap.2(as.matrix(mtcars),density.info="none",trace="none",Colv=FALSE,Rowv=FALSE,dendrogram="none",margin=c(10,10)) I can create the heatmap. But what I want to do is to add the horizontal separators of…
pdubois
  • 7,640
  • 21
  • 70
  • 99
9
votes
1 answer

How to plot, where each row in a matrix is a line inte plot in R

I have a data frame that I would like to plot. I want each row to be plotted as a line, but when I do it says that my margins are too large. I have tried to do a for loop, but I'm new to R so it doesn't work. Can somebody please help me? My frame is…
Mandy
  • 113
  • 1
  • 1
  • 3
9
votes
2 answers

Plotting PMF neatly in python

Is there a library that would help me to neatly plot a probability mass function of a sample in python, like this:
amaatouq
  • 2,297
  • 5
  • 29
  • 50
9
votes
4 answers

Plotting a line from a coordinate with and angle

I basically want to plot a line from a coordinate (x, y) with a given angle (calculating the tangent value). With a simple line of code like this pl.plot([x1, x2], [y1, y2], 'k-', lw=1) I can plot a line between two points but for this I need to…
H.Aziz Kayıhan
  • 315
  • 1
  • 4
  • 12
9
votes
2 answers

Matplotlib: Change linewidth on all subplots

I'm plotting a grid of subplots (6x2) with matplotlib (version 1.3.1) and Python 2.7. I set up my figure and plot things in the subplots like this: fig, axes = plt.subplots(ncols=6, nrows=2, sharex=True, sharey=True,…
thosphor
  • 2,493
  • 7
  • 26
  • 42
9
votes
1 answer

Remove matplotlib text plot border

How to remove matplotlib text border, while making the text be in the first plane, in front of the plotted line? import matplotlib.pyplot as plt x = [1, 2, 3] y = [1, 2, 3] plt.plot(x, y) plt.text(2.85, 2.9, 'label', bbox={'facecolor':'white',…
gcamargo
  • 3,683
  • 4
  • 22
  • 34
9
votes
1 answer

Fill area to match the lines of with various 'type' arguments in lattice

I know I can use panel.xyarea from latticeExtra to fill the area in the plot with any colour. Without defining a type argument in xyplot, such filling will follow the route of default type="p": library(lattice) library(latticeExtra) data <-…
Geek On Acid
  • 6,330
  • 4
  • 44
  • 64
9
votes
3 answers

Plot smooth curves of Pandas Series data

My data is: >>> ts = pd.TimeSeries(data,indexconv) >>> tsgroup = ts.resample('t',how='sum') >>> tsgroup 2014-11-08 10:30:00 3 2014-11-08 10:31:00 4 2014-11-08 10:32:00 7 [snip] 2014-11-08 10:54:00 5 2014-11-08 10:55:00 2 Freq: T,…
Alaa Ali
  • 896
  • 1
  • 12
  • 24
9
votes
3 answers

ggplot: aes vs aes_string, or how to programmatically specify column names?

Let's assume we have the following data frame data <- data.frame(time=1:10, y1=runif(10), y2=runif(10), y3=runif(10)) and we want to create a plot like this: p <- ggplot(data, aes(x=time)) p <- p + geom_line(aes(y=y1, colour="y1")) p <- p +…
bluenote10
  • 23,414
  • 14
  • 122
  • 178
9
votes
4 answers

Remove only axis lines without affecting ticks and tick labels

Is there a way to remove only the axis lines in the Matlab figure, without affecting ticks and tick labels. I know that box toggles the upper and right axes lines and ticks and that works perfectly for me. But my problem is that I want eliminate…
Denny Alappatt
  • 135
  • 1
  • 2
  • 5
1 2 3
99
100