Change the X-axis scale

1
Hello, I'm trying to graph a tree trunk, where the y-axis is the height (meters) and the x-axis is the diameter (cm). Until then without problems, but I would like to change the scale of the x axis to give more realism and I can not do this, would anyone have any suggestions?     
asked by anonymous 15.09.2015 / 15:02

2 answers

4

If you are using the basic R commands to graph ( plot() ), you can change the x / y axis with the parameter xlim / ylim

x <- rnorm(100, 10, 2)
y <- rnorm(100, 100, 20)
plot(x, y)
plot(x, y, xlim = c(0, 120)) # Alterando somente o eixo X
plot(x, y, ylim = c(0, 120)) # Alterando somente o eixo Y
plot(x, y, xlim = c(0, 120), ylim = c(0, 120)) # Alterando os 2 eixos
    
15.09.2015 / 15:08
0

I followed this tutorial , which shows how to configure the axes in a well-didactic way.

But in summary, explaining with my words and the way I used them in my case (I'm a beginner in R), I did like this:

# axes=F -> retira os eixos do seu gráfico.
plot("seus dados", ..., axes=F)

# A função axis permite configurar os eixos, sendo "1"
# indicativo do eixo "abaixo" do gráfico (o eixo "x")
# e o parâmetro "at" indica que valores devem aparecer
# no eixo. Da mesma forma para o eixo vertical.
axis(1,at=c(x1,x2,x3,...,xn)

# "2" indica o eixo y (à esquerda do gráfico)
# e pelo "at" seus respectivos valores.
axis(2,at=c(y1,y2,y2,...,yn))
    
23.10.2018 / 01:31