# Draw 2-dimensional barplots

### Description

This function is used by `draw.barplot2D`

to add a 2-dimensional barplot at a specific location to an existing plot. It can be used directly but in general it is advisable to use `draw.barplot2D`

instead.

### Usage

1 2 |

### Arguments

`z` |
vector, containing positive numbers (NAs are discarded), to be used as the area of the rectangles |

`colour` |
a vector (same length as |

`x, y` |
the location of the centre of the pie on the x and y-scale of the existing plot. |

`width, height` |
the width and height of the 2D barplot (user coordinate units). |

`add` |
logical, should the 2D barplot be added to an existing plot> Defaults to TRUE |

`col.frame` |
the colour of the frame of the 2D barplot |

`lwd.frame` |
the line width of the frame of the 2D barplot |

`threshold` |
the maximum acceptable aspect ratio of the rectangles |

`...` |
arguments to be passed to |

### Details

The algorithm that determines the location of each rectangle within the 2D-barplot is as follows: 1) Start with a rectangle representing the highest value of `z`

. 2) Try to put the first rectangle on the left. 3) If it too elongated, try to put two rectangles, on top of each other, on the left. 4) When you have placed those rectangles, proceed with the remaining rectangles.

More precisely, we choose the number of rectables to stack so as to minimize the following penalty: penalty for the first rectangle in the stack + penalty for the last where the penalty of a rectangle is: `ratio - 1.1`

. where `ratio`

is the ratio of the longer side by the smaller.

### Author(s)

Adapted by Hans Gerritsen

### References

This function was adapted from code pulbished on http://zoonek2.free.fr/UNIX/48_R/03.html (accessed 1 Jun 2012).

### See Also

`draw.barplot2D`

### Examples

1 2 3 |