[R] (no subject)

Anne anne.piotet at urbanet.ch
Thu Jan 13 23:34:19 CET 2005


Hi Angela
I'm not sure what you want to do with these 2 plots:
1)   getting them on the same screen ( >par(mfrow=c(1,2))
2)   if you need them on separate files try the appropiate Hmisc functions
(for instance psslide(), whih are in the words of the author "Postscript and
Adobe PDF Setup for 35mm Slides and Other Formats")


for legend try:
legend(locator(1),legend=leg.text,lty=1, col=leg.col)

Anne

Ciao! Vorrei essere nelle vacanze...



----- Original Message ----- 
From: "Angela Re" <angelare at to.infn.it>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, January 13, 2005 4:07 PM
Subject: [R] (no subject)


> Good morning,
> I wrote a little code in R which has to show two graphs  but  I can get
> only one. How can I  adress  the graphs in two files?
>
> Second, I'd like, always in the same code, to add a legend  to a graph.
> Better,  I'd like to  put in  such a legend a  new item whose color
> could remind the colour ol the columns it  refers to in the plot. I wrote:
>
> leg.txt<-c("control people", "radiated ill people", "radiated healthy
> people",
> "pesticide exposed people")
>
> leg.col<-c("lightblue", "gray", "lightcyan","lavender")
>
> grA<-barplot(seqA, type = "h", col = c(colors),legend.text =
> c(leg.txt),main = " Number of breaks occured on cluster A bands on
> patients' sample", xlab = "patient ID", ylab = "breaks number")
> but I don't know how to assign the right colors to legend's items.
>
> Thanks  of helping me, Angela
>
>
>
>


----------------------------------------------------------------------------
----


> #inserisci in inp1/2/3/4 il numero di rotture per ciascun soggetto delle 4
> #classi per le bande dei cluster A e B.
>
>
>
>
> #CLUSTER A
>
> inp1A<-scan("ROTTURE_PER_SOGGETTO_CONTROLLO_CLUSTER_A.dat")
>
> inp2A<-scan("ROTTURE_PER_SOGGETTO_RAD_MALATI_CLUSTER_A.dat")
>
> inp3A<-scan("ROTTURE_PER_SOGGETTO_RAD_NO_MALATI_CLUSTER_A.dat")
>
> inp4A<-scan("ROTTURE_PER_SOGGETTO_PEST_CLUSTER_A.dat")
>
> TOT_ROTTURE_CLUSTER_A<-2153
>
> seqA<-rep(0, times = 60)
>
> k<-0
>
> for( i in 1:length(inp1A) ) {
>
> k<-k+1
>
> seqA[k]<-(inp1A[i]/(2*TOT_ROTTURE_CLUSTER_A))
>
> }
> perc_1A<-100*sum(inp1A)/TOT_ROTTURE_CLUSTER_A
>
>
>
>
> for( i in 1:length(inp2A) ) {
>
> k<-k+1
>
> seqA[k]<-inp2A[i]/TOT_ROTTURE_CLUSTER_A
>
> }
> perc_2A<-100*sum(inp2A)/TOT_ROTTURE_CLUSTER_A
>
>
>
>
>
> for( i in 1:length(inp3A) ) {
>
> k<-k+1
>
> seqA[k]<-inp3A[i]/TOT_ROTTURE_CLUSTER_A
>
> }
> perc_3A<-100*sum(inp3A)/TOT_ROTTURE_CLUSTER_A
>
>
>
>
>
> for( i in 1:length(inp4A) ) {
>
> k<-k+1
>
> seqA[k]<-(inp4A[i]/(2*TOT_ROTTURE_CLUSTER_A))
>
> }
> perc_4A<-100*sum(inp4A)/TOT_ROTTURE_CLUSTER_A
>
>
> #oltre a disegnare quantifichiamo un po'
> media_inp1A<-mean(inp1A)
> media_inp2A<-mean(inp2A)
> media_inp3A<-mean(inp3A)
> media_inp4A<-mean(inp4A)
>
> media_fra_inp1A<-mean(inp1A/TOT_ROTTURE_CLUSTER_A)
> media_fra_inp2A<-mean(inp2A/TOT_ROTTURE_CLUSTER_A)
> media_fra_inp3A<-mean(inp3A/TOT_ROTTURE_CLUSTER_A)
> media_fra_inp4A<-mean(inp4A/TOT_ROTTURE_CLUSTER_A)
>
>
>
>
>
>
>
>
> #CLUSTER B
>
> inp1B<-scan("ROTTURE_PER_SOGGETTO_CONTROLLO_CLUSTER_B.dat")
>
> inp2B<-scan("ROTTURE_PER_SOGGETTO_RAD_MALATI_CLUSTER_B.dat")
>
> inp3B<-scan("ROTTURE_PER_SOGGETTO_RAD_NO_MALATI_CLUSTER_B.dat")
>
> inp4B<-scan("ROTTURE_PER_SOGGETTO_PEST_CLUSTER_B.dat")
>
> TOT_ROTTURE_CLUSTER_B<-3553
>
> seqB<-rep(0, times = 60)
>
> z<-0
>
> for( i in 1:length(inp1B) ) {
>
> z<-z+1
>
> seqB[z]<-(inp1B[i]/(2*TOT_ROTTURE_CLUSTER_B))
>
> }
> perc_1B<-100*sum(inp1B)/TOT_ROTTURE_CLUSTER_B
>
>
>
>
>
> for( i in 1:length(inp2B) ) {
>
> z<-z+1
>
> seqB[z]<-inp2B[i]/TOT_ROTTURE_CLUSTER_B
>
> }
> perc_2B<-100*sum(inp2B)/TOT_ROTTURE_CLUSTER_B
>
>
>
>
>
> for( i in 1:length(inp3B) ) {
>
> z<-z+1
>
> seqB[z]<-inp3B[i]/TOT_ROTTURE_CLUSTER_B
>
> }
> perc_3B<-100*sum(inp3B)/TOT_ROTTURE_CLUSTER_B
>
>
>
>
>
> for( i in 1:length(inp4B) ) {
>
> z<-z+1
>
> seqB[z]<-(inp4B[i]/(2*TOT_ROTTURE_CLUSTER_B))
>
> }
> perc_4B<-100*sum(inp4B)/TOT_ROTTURE_CLUSTER_B
>
>
> #oltre a disegnare quantifichiamo un po'
> media_inp1B<-mean(inp1B)
> media_inp2B<-mean(inp2B)
> media_inp3B<-mean(inp3B)
> media_inp4B<-mean(inp4B)
>
> media_fra_inp1B<-mean(inp1B/TOT_ROTTURE_CLUSTER_B)
> media_fra_inp2B<-mean(inp2B/TOT_ROTTURE_CLUSTER_B)
> media_fra_inp3B<-mean(inp3B/TOT_ROTTURE_CLUSTER_B)
> media_fra_inp4B<-mean(inp4B/TOT_ROTTURE_CLUSTER_B)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> #costruisco col
> colors<-NULL
>
> q<-0
>
> for( i in 1:length(inp1B) ) {
>
> q<-q+1
>
> colors[q]<-"lightblue"
>
> }
>
>
>
>
>
>
> for( i in 1:length(inp2B) ) {
>
> q<-q+1
>
> colors[q]<-"gray"
>
> }
>
>
>
>
>
>
> for( i in 1:length(inp3B) ) {
>
> q<-q+1
>
> colors[q]<-"lightcyan"
>
> }
>
>
>
>
>
>
> for( i in 1:length(inp4B) ) {
>
> q<-q+1
>
> colors[q]<-"lavender"
>
> }
>
>
> #costruisco legenda
>
>
> leg.txt<-c("control people", "radiated ill people", "radiated healthy
people",
> "pesticide exposed people")
> leg.col<-c("lightblue", "gray", "lightcyan","lavender")
>
>
>
> #grafico del numero di rotture dei soggetti del campione ( preventivamente
ordinati per classi )in riferimento alle bande del cluster A o B
> #grA<-barplot(seqA, type = "h", col = c(colors),legend.text =
c(leg.txt),main = " Number of breaks occured on cluster A bands on patients'
sample", xlab = "patient ID", ylab = "breaks number")
> #grB<-barplot(seqB, type = "h",col = c(colors),legend.text
=c(leg.txt),main = " Number of breaks occured on cluster B bands on
patients' sample", xlab = "patient ID", ylab = "breaks number")
>
> #grafico la frazione del numero di rotture totale del cluster per soggetto
> grA<-barplot(seqA, type = "h", col = c(colors),legend.text =
c(leg.txt),main = "Number of breaks occured on cluster A bands on patients's
ample", xlab ="patient ID", ylab = "breaks number/cluster breaks number")
> #grB<-barplot(seqB, type = "h",col = c(colors),legend.text
=c(leg.txt),main = " Number of breaks occured on cluster B bands
onpatients'sample", xlab = "patient ID", ylab = "breaks number/cluster
breaks number")
>
>


----------------------------------------------------------------------------
----


> 79
> 18
> 32
> 35
> 62
> 60
> 32
> 39
> 38
> 34
> 30
>


----------------------------------------------------------------------------
----


> ______________________________________________
> 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




More information about the R-help mailing list