[R] Change font size in Cluster analysis

Meesters, Aesku.Kipp Institute meesters at aesku-kipp.com
Thu Jun 27 13:47:45 CEST 2013


Gitte, in addition to Brian Ripley's answer: Will you be able to read all those labels anyway? And: Have you considered using heatmap.2 (gplots package)? It's a little denser than your approach and lets you in control of the clustering function (defaults are the same as in your example). You would gain the option to display only those labels which you want to show.
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] on behalf of Gitte Brinch Andersen [GITTEBA at HUM-GEN.AU.DK]
Sent: 27 June 2013 12:12
To: r-help at r-project.org
Subject: [R] Change font size in Cluster analysis

Hello

I have done a cluster analysis, and I would like to change the font size of my sample names. I have tried using cex, but this doesn't work/change anything. I have tried to specify it with cex.main, cex.lab, cex.axis and cex.sub, and can change all other names in the picture but my sample names.
I can't see what I am doing wrong.

I hope somebody can help me, and I apologize for this probably very simple question/mistake.

I have around 1000 rows and 50 columns, but have only included a few in my example.

Thank you in advance!

Kind regards

Gitte Andersen


#Read in data
data<-read.table("/Users/gban/Desktop/Heatmap/Heatmap with selected genes/Probes_for_heatmap_35_meth_diff_both_hypo_and_hypermeth_Gene&probenames.txt",sep="\t",dec=",",header=TRUE,row.names=1)

data
                                  OS_Tumor1_08_14985_2_3 OS_Tumor2_08_226869_1
CHST3_cg04268405_1                            0.95038060            0.76433753
DLX5_cg19962750_2                             0.93111825            0.75384523
ZIC4_cg12892506_3                             0.86033747            0.69614933
DLX5_cg05597836_4                             0.90698171            0.66414891



#Turn the data into a matrix, and transpose to get the columns to be clustered
Data_matrix<-as.matrix(t(data))

Data_matrix
                            CHST3_cg04268405_1 DLX5_cg19962750_2
OS_Tumor1_08_14985_2_3               0.9503806         0.9311183
OS_Tumor2_08_226869_1                0.7643375         0.7538452
OS_Tumor3_10_201917_2_3              0.7109182         0.7778035
OS_Tumor4_00_2395                    0.7772400         0.6769241
OS_Tumor5_02_2669                    0.9638739         0.9023436
OS_Tumor6_02_4738                    0.9028490         0.9586764
OS_Tumor7_02_4850                    0.8786524         0.8872261
OS_Tumor8_02_6935                    0.8434550         0.7180251
OS_Tumor9_03_1430                    0.7494400         0.9190213
OS_Tumor10_03_1701                   0.9148253         0.7692125
OS_Tumor11_03_220                    0.9270112         0.8607459
OS_Tumor12_03_2558                   0.9344832         0.5013390
OS_Tumor13_03_373                    0.9549153         0.9559071
OS_Tumor14_03_82                     0.9117558         0.3993953
OS_Tumor15_06_22319                  0.9580999         0.9645215
OS_Tumor16_07_16581                  0.6213243         0.9033265
OS_Tumor17_07_28523                  0.9064597         0.4421651
OS_Tumor18_07_3212                   0.6439032         0.4344106
OS_Tumor19_07_6990                   0.9350585         0.9238712
OS_Tumor20_07_6990sample2            0.9526839         0.9027684
OS_Tumor21_07_7724                   0.9338156         0.8335415
OS_Tumor22_08_10238                  0.9028336         0.8529122
OS_Tumor23_08_14985Sample2           0.9609952         0.9478541
OS_Tumor24_08_16592                  0.9168102         0.9138002
OS_Tumor25_08_21197                  0.9148711         0.9109843
OS_Tumor26_08_21197Sample2           0.9583610         0.8830407
OS_Tumor27_08_222863                 0.9478853         0.8395278
OS_Tumor28_08_225814                 0.9451414         0.9407933
OS_Tumor29_08_226869Sample2          0.9028336         0.8337000
OS_Tumor30_08_230660                 0.9599117         0.9363075
OS_Tumor31_08_4485                   0.8247909         0.8336728
OS_Tumor32_09_214654                 0.9531564         0.8957473
OS_Tumor33_09_214654Sample2          0.9552210         0.9034464
OS_Tumor34_10_200150                 0.9332627         0.8551589
OS_Tumor35_10_201917                 0.9397219         0.9470733
OS_Tumor36_10_201917Sample2          0.9607446         0.9523402
OS_Tumor37_10_202221                 0.9264254         0.9413189
OS_Tumor38_10_204294                 0.8388658         0.8956207
OS_Tumor39_10_204294Sample2          0.8071109         0.8474199
OS_Tumor40_10_205933                 0.8788835         0.4950936
OS_Tumor41_10_225662                 0.9334545         0.8910134
OS_Tumor42_10_229129                 0.5872184         0.8394597
OS_Tumor43_11_236261                 0.9015548         0.9293858
OS_Tumor44_12_211561                 0.6793692         0.1856015
Normalbone.3.                        0.1636323         0.1222070
Normalbone.UA.                       0.1934500         0.1303734
Normalbone.UA2.                      0.1737224         0.1604758
CRL_11372                            0.9779593         0.2533844
CRL_1427                             0.9598825         0.8862426
CRL_1543                             0.9283976         0.7198934
CRL_2098                             0.9325895         0.6360936
Ho_f.4610                            0.9370865         0.6279557
HTB_85                               0.9441092         0.1037401
HTB_96                               0.9511175         0.9160013
                            ZIC4_cg12892506_3 DLX5_cg05597836_4
OS_Tumor1_08_14985_2_3             0.86033747        0.90698171
OS_Tumor2_08_226869_1              0.69614933        0.66414891
OS_Tumor3_10_201917_2_3            0.58728927        0.65086446
OS_Tumor4_00_2395                  0.41747130        0.45464648
OS_Tumor5_02_2669                  0.74259213        0.88244165
OS_Tumor6_02_4738                  0.79690018        0.93691928
OS_Tumor7_02_4850                  0.05513471        0.91753824
OS_Tumor8_02_6935                  0.70742299        0.77802530
OS_Tumor9_03_1430                  0.84563086        0.87202952
OS_Tumor10_03_1701                 0.81318017        0.72446802
OS_Tumor11_03_220                  0.72489087        0.80580733
OS_Tumor12_03_2558                 0.06656780        0.14739011
OS_Tumor13_03_373                  0.94011867        0.95742989
OS_Tumor14_03_82                   0.52129769        0.54734874
OS_Tumor15_06_22319                0.93025191        0.94392535
OS_Tumor16_07_16581                0.67236887        0.88546907
OS_Tumor17_07_28523                0.25764851        0.45550666
OS_Tumor18_07_3212                 0.33624514        0.18623351
OS_Tumor19_07_6990                 0.82904776        0.88946081
OS_Tumor20_07_6990sample2          0.76836030        0.82519665
OS_Tumor21_07_7724                 0.90314315        0.71810973
OS_Tumor22_08_10238                0.83715782        0.86426252
OS_Tumor23_08_14985Sample2         0.82588214        0.90655043
OS_Tumor24_08_16592                0.77582828        0.83500490
OS_Tumor25_08_21197                0.90274785        0.96119490
OS_Tumor26_08_21197Sample2         0.87385578        0.83341529
OS_Tumor27_08_222863               0.72588195        0.59849569
OS_Tumor28_08_225814               0.87931232        0.89657489
OS_Tumor29_08_226869Sample2        0.86379063        0.88825605
OS_Tumor30_08_230660               0.92495563        0.95137547
OS_Tumor31_08_4485                 0.84465179        0.66948504
OS_Tumor32_09_214654               0.92036441        0.71915709
OS_Tumor33_09_214654Sample2        0.93955431        0.46490552
OS_Tumor34_10_200150               0.80337813        0.82519665
OS_Tumor35_10_201917               0.87734686        0.91265824
OS_Tumor36_10_201917Sample2        0.93627004        0.94319232
OS_Tumor37_10_202221               0.93107776        0.96075927
OS_Tumor38_10_204294               0.85892154        0.94595920
OS_Tumor39_10_204294Sample2        0.69839075        0.76396555
OS_Tumor40_10_205933               0.25850129        0.43418918
OS_Tumor41_10_225662               0.71442683        0.88154146
OS_Tumor42_10_229129               0.42328977        0.77763541
OS_Tumor43_11_236261               0.82946721        0.87242385
OS_Tumor44_12_211561               0.84785994        0.12366988
Normalbone.3.                      0.06840225        0.08229536
Normalbone.UA.                     0.07383344        0.12502117
Normalbone.UA2.                    0.07741817        0.09563505
CRL_11372                          0.05409689        0.13815797
CRL_1427                           0.91730069        0.92421230
CRL_1543                           0.77789918        0.94650563
CRL_2098                           0.91524115        0.50725942
Ho_f.4610                          0.05736418        0.51843963
HTB_85                             0.95464468        0.05260867
HTB_96                             0.88410529        0.92872206


#Calculate the distance
Data_dist<-dist(Data_matrix)

#Make the cluster
Data_clust<-hclust(Data_dist,method="ward")

#Save the plot as a pdf file
pdf(file="Cluster_Probes_From_genes_morethan_2_probes_and_morethan_30_methdiff.pdf")

#Plot the cluster
plot(Data_clust, cex=0.5)

dev.off() #Ends the pdf saving.

Gitte Brinch Andersen

Kandidat-Ph.d. studerende
Biomedicinsk Institut
Wilhelm Meyers Allé 4
Aarhus Universitet
DK-8000 Aarhus C

Mobil: +45 30433317
E-mail: gitteba at hum-gen.au.dk<mailto:gitteba at hum-gen.au.dk>



        [[alternative HTML version deleted]]




More information about the R-help mailing list