## Plotting many lines as a heatmap

I have a large number (~1000) of files from a data logger that I am trying to process.

If I wanted to plot the trend from a single one of these log files I could do it using

plot(timevalues,…

## Adding an arrow below the x axis in R plots

I am trying to add arrows marking specific x coordinates below the x axis in an R plot. My x axis is at y=0 and when I try to use negative y-coordinates in arrows, so the arrows will be perpendicular …

## Matplotlib autoscale

I need to get a plot that fits the data automatically using matplotlib. This is the code I was given:

import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
….
lines = …

## Feeding data frame columns to xyplot panel functions

I am using xyplot on a data frame and want to feed a panel function with data that is not the (x,y, …) arguments, but some additional column of the data frame (say k in the example below):

library(…

## changing the spacing between vertices in iGraph in R

Suppose I want to make a plot with the following data:

pairs <- c(1, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 2, 11, 4, 14, 4, 15, 6, 13, 6, 19, 6, 28, 6, 36, 7, 16, 7, 23, ...

## How to plot two histograms together in R?

I am using R and I have two data frames: carrots and cucumbers. Each data frame has a single numeric column which lists the length of all measured carrots (total: 100k carrots) and cucumbers (total: …

## Shading a kernel density plot between two points.

I frequently use kernel density plots to illustrate distributions. These are easy and fast to create in R like so:

set.seed(1)
draws <- rnorm(100)^2 dens <- density(draws) plot(dens) #or in one ...

## R – How to draw an empty plot?

Every once in a while I need to make an empty plot. This is the best could I come up with.

plot(0,xaxt=’n’,yaxt=’n’,bty=’n’,pch=”,ylab=”,xlab=”)
Any simpler solutions?

p.s 1: completely empty, …

## How to print R graphics to multiple pages of a PDF and multiple PDFs?

I know that

pdf(“myOut.pdf”)
will print to a PDF in R. What if I want to
Make a loop that prints subsequent graphs on new pages of a PDF file (appending to the end)?
Make a loop that prints …

## R inconsistency: why add=T sometimes works and sometimes not in the plot() function?

Why is R inconsistent with the add parameter in the plot() function?
It sometimes works and sometimes doesn’t!
In this example, it takes the parameter add=TRUE with no problem:

plot(0:10, 0:10*3)