[R] About scales in graphics
Peter Ehlers
ehlers at ucalgary.ca
Mon Feb 8 14:11:10 CET 2010
Silvano wrote:
> Hi,
>
> I'm building two graphics just changing the scale to show the graphic
> illusion.
>
> The first graph would be 'correct'.
>
> atend = c(410,430,450,408,408,405)
> names(atend) = c('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho')
> barplot(atend, las=1, xlab='Meses', ylab='Número de atendimentos',
> col='LightYellow', yaxt='n', space=0.6)
> axis(2, at=seq(0,450, by=50), las=1)
> abline(h=0, col='black', lwd=1)
>
> How should I do to get the second graph in the range 400 and Y in the
> columns with values below 400 do not appear on the chart?
>
If I understand correctly, you should be able to just subtract 400
from atend and adjust the axis() command:
barplot(atend-400, las=1, xlab='Meses', ylab='Número de atendimentos',
col='LightYellow', yaxt='n', space=0.6)
axis(2, at=seq(0,50, by=10), lab=seq(400,450, by=10), las=1)
-Peter Ehlers
> atend = c(410,430,450,408,408,405)
> names(atend) = c('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho')
> barplot(atend, las=1, xlab='Meses', ylab='Número de atendimentos',
> col='LightYellow',ylim=c(400,450), yaxt='n', space=0.6)
> axis(2, at=seq(400,450, by=10), las=1)
> abline(h=400, col='black', lwd=1)
>
> Thanks,
>
> --------------------------------------
> Silvano Cesar da Costa
> Departamento de Estatística
> Universidade Estadual de Londrina
> Fone: 3371-4346
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Peter Ehlers
University of Calgary
More information about the R-help
mailing list