resistor: Draw a resistor

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Draw a resistor

Usage

1
2
3
4
5
resistor(x0, y0, x1, y1,
          points=FALSE,
          length=0.08, width=length/(3 * 2 * sqrt(2)),  
          label, pos,
          col=par('col'), lwd=par('lwd'), cex=par('cex'))

Arguments

x0,y0

starting coordinate of element

x1,y1

ending coordinate of element

length

length of zig-zag

width

width of zig-zag

label

optional string placed near component (see pos)

pos

position of label: 0 for below a horizontal component, or to the left of a vertical one, and 1 for the opposite

points

booline indicating whether to draw dots at the ends of the wire

col

colour

lwd

line width

cex

size of points (ignored unless points is TRUE)

Details

The coordinate system has both x and y ranging from 0 to 1.

Value

Vector containing x0, y0, x1, y1.

Author(s)

Dan Kelley

See Also

The plot must first be set up with circuit.

Examples

1
2
3
4
5
6
library(circuit)
circuit()
resistor(0.1, 0.5, 0.4, 0.5, label="10k")
capacitor(0.4, 0.2, 0.4, 0.5, label='10uF')
wire(0.4, 0.5, 0.7, 0.5)
ground(0.4, 0.2)

dankelley/circuit documentation built on May 14, 2019, 4:09 p.m.