Skip to content

Barplot axes on MacOS 9.01, R 1.2.3

2 messages · Peter Paul Sint

#
I am not able to restrict axes to a given extension if I want to add text to a plot outside the area of the xlim(or ylim) area.
I tried to use par(usr) or par(xaxp) both seem not to work. (I am fairly new to R and did not use a non-Mac version before - possibly I misunderstand those par or some other function/approach makes this easy).
Does anybody have an idea how to get rid of surplus axes.

I hope this example is easily reproducable (Wanted: to get rid of negative axis in this case):

ws<- c(0,0,5,7,18,31)
labF2<- c("Industrie","Finanzdienst","Transport,Telekom","Tourismus","Gewerbe,andere Dienstleistung" "Handel" )
F2.3 F2.5 F2.6 F2.2 F2.1 F2.4 
   0    0    5    7   18   31
[1] "Industrie"                     "Finanzdienst"                 
[3] "Transport,Telekom"             "Tourismus"                    
[5] "Gewerbe,andere Dienstleistung" "Handel"
barplot(ws,  main="Wirtschaftssektor, Fachgruppe",horiz=T,names.arg=NULL,xlim=c(-68,40),xaxp=c(0,40,4)  )
text(-63,seq(0.6,length=6,by=1.2),labF2,adj=0)

wsc<- as.character(ws)
barplot(ws,  main="Wirtschaftssektor, Fachgruppe",horiz=T,names.arg=NULL,xlim=c(-68,40),xaxp=c(0,40,4)  )
text(-63,seq(0.6,length=6,by=1.2),labF2,adj=0)
text(ws-nchar(wsc)-3,seq(0.6,length=6,by=1.2),wsc,adj=0)


(right hand justification needs Hershey fonts which print not so clean numbers inside the bars)
9 days later
#
Answer to my previous question on negative axis deletion
Plot barplot without axes.
Add restricted axis afterwards.

ws<- c(0,0,5,7,18,31)
labF2<- c("Industrie","Finanzdienst","Transport,Telekom","Tourismus","Gewerbe,andere Dienstleistung","Handel" )
barplot(ws,  main="Wirtschaftssektor, Fachgruppe",horiz=T,names.arg=NULL,xlim=c(-68,40),xaxp=c(0,40,4) ,axes=F )
text(-63,seq(0.6,length=6,by=1.2),labF2,adj=0)
axis(1,c(0,20,40,60))

I am still interested in a way to do it whith the plot/barplot command.

Does anybody have an idea how to plot AND save a series of graphs (not the commands to plot them)  unattended (for a slightly changed data set/data frame)?
At 5:59 Uhr +0200 06.06.2001, Peter Paul Sint wrote: