Skip to content

Help for x axis

2 messages · Olivier, David L Carlson

#
Hi,
I want to customize x axis to scientific data. I do experiments with 
different triggers. As others publications, I want that there is one 
line for each trigger with the sign "-" or "+" to show if the trigger is 
used or no. You will find attached an exemple.
Please find below a data.frame you could use to explain me.
Thank you for your response,
Olivier



set.seed(3)
sampleData <- data.frame(id = 1:100,gender = sample(c("0", "1"), 100, 
replace = TRUE), smoke = sample (c("0","1"), 100, replace=TRUE), age = 
rnorm(100, 40, 10))
summary(sampleData)

-> I want to give results with histograms or box.plot (age according to 
sex and smoking status)
-> x axis may be like something like this :

Gender        -          -         +        +
Smoke         -          +        -         +

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex.png
Type: image/png
Size: 22715 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20141117/cd4d72e8/attachment.png>
#
This should get you started:
smoke gender      age
1     0      0 39.47231
2     1      0 40.09020
3     0      1 39.59814
4     1      1 42.04092
+ lwd=0, cex.axis=1.25, xpd=TRUE)
+ lwd=0, cex.axis=1.25, xpd=TRUE)

To adapt it you will need to read the manual pages for barplot() and axis() and the page on graphical parameters par(). In particular, you will have to allocate more space at the bottom of the plot if you want to add more lines.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Olivier
Sent: Monday, November 17, 2014 9:24 AM
To: r-help at r-project.org
Subject: [R] Help for x axis

Hi,
I want to customize x axis to scientific data. I do experiments with 
different triggers. As others publications, I want that there is one 
line for each trigger with the sign "-" or "+" to show if the trigger is 
used or no. You will find attached an exemple.
Please find below a data.frame you could use to explain me.
Thank you for your response,
Olivier



set.seed(3)
sampleData <- data.frame(id = 1:100,gender = sample(c("0", "1"), 100, 
replace = TRUE), smoke = sample (c("0","1"), 100, replace=TRUE), age = 
rnorm(100, 40, 10))
summary(sampleData)

-> I want to give results with histograms or box.plot (age according to 
sex and smoking status)
-> x axis may be like something like this :

Gender        -          -         +        +
Smoke         -          +        -         +