Hello! I have two question that rose from trying to tacle the same problem in two differnet ways. What I want to do is to plot axes (only values or labels, no tick marks) in such a way that 'cex' can be very small, text can be perpendicular to the axis (as in axis(las=2) ) and the text is stil at the right position. Let me demonstrate with a small example: plot(0:100/100,0:100/100,axes=FALSE) axis(side=3,at=0:100/100,labels=0:100,las=2,cex.axis=0.1) The text on the axis should be at the same points as tick marks, but it is shifted right. I tried to bypas the problem by using function 'text', which puts the text at the correct positions, however, it has another problem. I would like to rotate the text, but if I use 'str=90' (to rotate the text for 90 degrees), I get a warning massage: Warning message: parameter "str" couldn't be set in high-level plot() function This suprises me, since if I read the help correctly ('?par'), then this should not happen. So if anyone can either hepl me to rotate the text in 'text' or to correctly plot the text in 'axis', I would be very grateful. Ales
On Wed, 2004-10-27 at 08:34, Ale?? ??iberna wrote:> Hello! > > I have two question that rose from trying to tacle the same problem in two > differnet ways. > > What I want to do is to plot axes (only values or labels, no tick marks) in > such a way that 'cex' can be very small, text can be perpendicular to the > axis (as in axis(las=2) ) and the text is stil at the right position. > > Let me demonstrate with a small example: > plot(0:100/100,0:100/100,axes=FALSE) > axis(side=3,at=0:100/100,labels=0:100,las=2,cex.axis=0.1) > > The text on the axis should be at the same points as tick marks, but it is > shifted right. > I tried to bypas the problem by using function 'text', which puts the text > at the correct positions, however, it has another problem. I would like to > rotate the text, but if I use 'str=90' (to rotate the text for 90 degrees), > I get a warning massage: > Warning message: > parameter "str" couldn't be set in high-level plot() function > > This suprises me, since if I read the help correctly ('?par'), then this > should not happen. > > So if anyone can either hepl me to rotate the text in 'text' or to correctly > plot the text in 'axis', I would be very grateful. > > AlesI am not able to replicate the right-shift of the text labels. It may be a visual screen artifact of the small font size you are using. If you increase the cex.axis to 0.25 (for example), it becomes clear that the labels are in the proper position. I put up a PDF containing the plot at: www.MedAnalytics.com/Rplots.pdf I used the following code: pdf() plot(0:100/100, 0:100/100, axes = FALSE) axis(side = 3, at = 0:100/100, labels = 0:100, las = 2, cex.axis = 0.1) axis(side = 1, at = 0:100/100, labels = 0:100, las = 2, cex.axis = 0.25) dev.off() I'll leave that up for a bit for review. I presume that you have the Acrobat Reader under Windows? Relative to the use of text() for rotating axis labels, see: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f HTH, Marc Schwartz
Have you tried the adj parameter in par as in axis(side=3,at=0:100/100,labels=0:100,las=2,cex.axis=0.1, adj = 0.5) ? Ales Ziberna <ales.ziberna at guest.arnes.si> Sent by: r-help-bounces at stat.math.ethz.ch 10/27/2004 09:34 AM To: "R-help" <r-help at stat.math.ethz.ch> cc: Subject: [R] ploting axes and rotating strings Hello! I have two question that rose from trying to tacle the same problem in two differnet ways. What I want to do is to plot axes (only values or labels, no tick marks) in such a way that 'cex' can be very small, text can be perpendicular to the axis (as in axis(las=2) ) and the text is stil at the right position. Let me demonstrate with a small example: plot(0:100/100,0:100/100,axes=FALSE) axis(side=3,at=0:100/100,labels=0:100,las=2,cex.axis=0.1) The text on the axis should be at the same points as tick marks, but it is shifted right. I tried to bypas the problem by using function 'text', which puts the text at the correct positions, however, it has another problem. I would like to rotate the text, but if I use 'str=90' (to rotate the text for 90 degrees), I get a warning massage: Warning message: parameter "str" couldn't be set in high-level plot() function This suprises me, since if I read the help correctly ('?par'), then this should not happen. So if anyone can either hepl me to rotate the text in 'text' or to correctly plot the text in 'axis', I would be very grateful. Ales ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Hi Ales, Think you might have made a typo, the parameter in par is "srt" not "str", hope that helps. Regards, Ian Smith mangosolutions Tel +44 118 902 6620 Fax +44 118 902 6401 -----Original Message----- From: r-help-bounces@stat.math.ethz.ch [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Ale¹ ®iberna Sent: 27 October 2004 14:35 To: R-help Subject: [R] ploting axes and rotating strings Hello! I have two question that rose from trying to tacle the same problem in two differnet ways. What I want to do is to plot axes (only values or labels, no tick marks) in such a way that 'cex' can be very small, text can be perpendicular to the axis (as in axis(las=2) ) and the text is stil at the right position. Let me demonstrate with a small example: plot(0:100/100,0:100/100,axes=FALSE) axis(side=3,at=0:100/100,labels=0:100,las=2,cex.axis=0.1) The text on the axis should be at the same points as tick marks, but it is shifted right. I tried to bypas the problem by using function 'text', which puts the text at the correct positions, however, it has another problem. I would like to rotate the text, but if I use 'str=90' (to rotate the text for 90 degrees), I get a warning massage: Warning message: parameter "str" couldn't be set in high-level plot() function This suprises me, since if I read the help correctly ('?par'), then this should not happen. So if anyone can either hepl me to rotate the text in 'text' or to correctly plot the text in 'axis', I would be very grateful. Ales ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]]