# [R] Plot in log scale

John Kane jrkrideau at yahoo.ca
Sun Aug 5 22:04:27 CEST 2007

```What appears to be happening is that you are plotting
all the data sets but all the lines () are being
plotted outside the original plotting frame.  If you
just plot out\$a with axes=TRUE you will see what the y
coordinates are.  You need to explicitly set the ylim
values.

There is a mockup of what I think you want to do.
------------------------------------------------------

a <- 5:7
b <- c(.005,.009,.01)
c <- c(.05,.08,.12 )
out <- data.frame(a,b,c); out

plot_colors <- c("blue","red","forestgreen","yellow")

plot(out\$a, log="y", type="l", col=plot_colors[1],
ylim=c(.0001, 8),
xlab="tittle_x_axe", ylab="title_y_axe", cex.lab=0.8,
lwd=2, xaxt='n')
axis(1, at=1:3)
lines(out\$b, type="l", pch=1, lty=1,
col=plot_colors[2])
lines(out\$c, type="l", pch=2, lty=2,
col=plot_colors[3])

-----------------------------------------------------

--- akki <akkilesha at gmail.com> wrote:

> Hi,
> Forgive me, because I am new in R.
> I need a graph, where:
> - y axe has log scale
> - graph would have 4 set values: set first (out\$a)
> has values over 5.5, set
> second (out\$b) and third (out\$c) has values over
> 0.005 and the last set
> (out\$d) has values over 0.0005 of y axe. For this
> reason, I need have log
> scale on y axe.
> I've look for web, but I can't do the graph that I
> need.
>
> I try to do something as:
>
> sep="\t")
> plot_colors <-
> c("blue","red","forestgreen","yellow")
> plot(out\$a, log="y", type="l", col=plot_colors[1],
> axes=FALSE, ann=T,
> xlab="tittle_x_axe", ylab="title_y_axe",
> cex.lab=0.8, lwd=2)
> axis(1, at=1:200)
> lines(out\$b, type="l", pch=1, lty=1,
> col=plot_colors[2])
> lines(out\$c, type="l", pch=2, lty=2,
> col=plot_colors[3])
> lines(out\$d, type="l", pch=3, lty=3,
> col=plot_colors[4])
>
> But, I have to only plotted  the first  set  of
> values (out\$a). How can I
> draw all my values?
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help