Plot Main Title with Text and formula y = a + betaX + Epsilon

Asked

Viewed 60 times

4

This is the data:

a=structure(c(2.96898844129164, 2.7849952585919, 2.4022019576164, 
2.97749332978932, 3.23431466394159, 3.37620019711505, 3.3295390792587, 
3.11646532271242, 2.84000702738219, 2.74301542351398, 2.07832874180711, 
2.15740515770523, 2.23479473764716, 2.37954812716451, 2.400841714934, 
2.0362585624479, 1.98020214376336, 1.96260190889675, 2.00978032053222, 
2.13902411367605, 2.53282288009462, 2.68156980446908, 2.91349975190278, 
2.79038985891333, 2.58237473393304, 2.50437531869206, 2.36540221423358, 
2.41436900951858, 2.46980695967125, 2.3218465089375, 2.51608272014889, 
2.56378796612985, 2.52526317723542, 2.58981471337774, 2.667858099901, 
2.70711884658078, 2.81116124731678, 2.84464329125045, 2.69382662258745, 
2.71403091867451, 2.67459661934829, 2.57686805051019, 2.53144382648086, 
2.5508943420409, 2.58989965623218, 2.52811654056593, 2.49248072197035, 
2.49251459054756, 2.52163281623524, 2.48931198207324, 2.38329298581287, 
2.34488973982978, 2.37111836048915, 2.26083712513068, 2.63083091407866, 
2.4712532327635, 2.51888098101492, 2.64808880238366, 2.64880390174807, 
2.68188584941202, 3.05318903698103, 3.09649397112321, 3.07798271931667, 
3.02104205898526, 3.08920618414242, 3.09566256696936, 2.92119151933076, 
2.97041063945547, 2.94432699152226, 2.94453100213769, 2.92759638662407, 
2.94412320517424, 3.06150901580071, 3.05553593884844, 3.01164193557895, 
2.98094372166821, 2.87499436729901, 2.89506658071147, 2.93299184825238, 
3.01822580970032, 3.03683029705268, 3.09051407274692, 3.06876729619262, 
3.04794810339967, 3.08937473994075, 3.06849458449188, 2.93606965966488, 
2.84939755023248, 2.74272575028737, 2.78602576357752, 2.7965735380755, 
2.86180965060649, 2.81419959575302, 2.79580806444988, 2.64943286754583, 
2.7163705724876, 2.75010168064011, 2.8031227669369, 2.75010168064011, 
2.67009988367688, 2.54742403764709, 2.73531631683447, 2.80689140743826, 
2.94981480200264, 2.923781630462, 2.93680109312734, 2.92034855596502, 
2.96028417688277, 2.97961233167067, 2.88658877090342, 2.85438363325608, 
2.85484508560024, 3.04189755181097, 3.02337693537032, 3.10407067999714, 
3.08333844773385, 3.12777845364087, 3.23559504601931, 3.21921258474344, 
3.25145426488351, 3.26379134382483, 3.25699931293557, 3.25217740563777, 
3.24663621554887, 3.27021686670402, 3.25093463713917, 3.29460533474529, 
3.29101006148423, 3.25736393183155, 3.19174657652073, 3.11345991065945, 
3.25169677025985, 3.31418673074841, 3.21958059288894, 3.23618413003183, 
3.1857973423557, 3.15320624820857, 3.14598603100292, 3.11363344042101, 
3.13135287932193, 3.11933425536232, 3.13746225274366, 3.14709852111059, 
3.26492760863797, 3.26902794805552, 3.2420139603218, 3.2420139603218, 
3.2805716220932, 3.22011918326965, 3.23068359201619, 3.30421148966478, 
3.29711365290979, 3.21810527495433, 3.10309132177366, 2.90323701309211, 
2.9469086899231, 2.92691785161561, 2.90648305419028, 2.86557265718677, 
2.87939333177894, 2.85176141961868, 2.86557265718677, 2.87239473597113, 
2.85874914235701, 2.86557265718677, 2.85534231126648, 2.76239694837353, 
2.80397475230136, 2.81451016966394, 2.72818895860009, 2.73150903576665, 
2.68341384333508, 2.64232965339449, 2.61163247146194, 2.69301889741244, 
2.5844307158746, 2.59789228970044, 2.62152689935812, 2.51717810027348, 
2.56072377936132, 2.59754184522702, 2.59752015265119, 2.59082950401493, 
2.6443835051802, 2.58750558980116, 2.61758839632184, 2.66803512432582, 
2.64117995534333, 2.66133388419537, 2.65463182214587, 2.66133388419537, 
2.65140232103962, 2.66172925341534, 2.66854397956165, 2.63649421510849, 
2.63482467983453, 2.63819600975269, 2.59943999521069, 2.60113169845948, 
2.60115439007935, 2.61123412368363, 2.64833676996134, 2.62463971137613, 
2.63641906983312, 2.63980860854507, 2.62858667332584, 2.607750784643, 
2.62287436243623, 2.64972532348919, 2.66482466240405, 2.71015304239367, 
2.73188251178867, 2.72014077258936, 2.72349736258385, 2.72138052440619, 
2.70780673358658, 2.77218477743302, 2.7502978746818, 2.75867755934302, 
2.74523135341837, 2.7520331329152, 2.76871588841867, 2.7654300014482, 
2.77212675239382, 2.78771711786257, 2.77779645101367, 2.69001007723725, 
2.68729468878756, 2.6654839248127, 2.621568582879, 2.59961798933062, 
2.59963530650957, 2.60300885031481, 2.53208414511993, 2.55400116729614, 
2.52873090335834, 2.54557347161722, 2.56074065597535, 2.49398041084243, 
2.55233155258047, 2.56910431504811, 2.57747363881768, 2.54231942804808, 
2.53732623744802, 2.50071444912521, 2.49407623662981, 2.49404858226176, 
2.49404219494822, 2.50071444912521, 2.48904782796556, 2.47905249191912, 
2.49067603818519, 2.58763645514601, 2.59947430314414, 2.61643455482565, 
2.66595791916504, 2.68329893940516, 2.69885792826629, 2.70751173503857, 
2.70437286877202, 2.78989082848632, 2.76986096230882, 2.74776836456312, 
2.80867006115244, 2.7931488257442, 2.79318182757287, 2.80009889314632, 
2.78802269938076, 2.79666848209445, 2.79666848209445, 2.78458899567264, 
2.78982617135218, 2.78974980274644, 2.79693720643183, 2.84265215980904, 
2.84975018878242, 2.8498323568263, 2.81858835841052, 2.82040711266161, 
2.81519397372467, 2.81689132967429, 2.84172123667145, 2.81389353860549, 
2.83298007925222, 2.83650248052417, 2.85562652588256, 2.84160088404654, 
2.8730387129984, 2.88524504201456, 2.89740220060153, 2.90271002043108, 
2.91648386552298, 2.92853521271164, 2.91558686582959, 2.9185347463571, 
2.90767951007135, 2.89166339908521, 2.86702701055992, 2.83527126101624, 
2.82815134336316, 2.803632309296, 2.78448082616066, 2.76871009715664, 
2.75120687427729, 2.74428025111952, 2.71316274599375, 2.67706893478089, 
2.64957895324108, 2.63240286143957, 2.60673760758855, 2.58455702314583, 
2.57604617422413, 2.55906097339563, 2.54381165786108, 2.53029434795633, 
2.51006925692187, 2.50673009406942, 2.47988275521742, 2.48298857287985, 
2.51207424850359, 2.51423144750251, 2.53040944901221, 2.54281376710748, 
2.55089862909407, 2.5697677879693, 2.56922870562915, 2.57408032847753, 
2.5848583318455, 2.59240309801987, 2.62203010096736, 2.62041424670853, 
2.65241753526186, 2.6647428894865, 2.6965107941911, 2.63547357677706, 
2.69607916954707, 2.82112827194969, 2.82880512989125, 2.8770910236892, 
2.84476858180935, 2.87964714462737, 2.8828520130258, 2.8719651114919, 
2.86979770689088, 2.67886903278378, 2.8792748660381, 2.66257917595672, 
2.75527243464529, 2.68558204585639, 2.6540278561651, 2.59220031577481, 
2.5866205179369, 2.57031675536553, 2.57763379157434, 2.57540368192603, 
2.57369808104305, 2.58723744501541), .Dim = c(357L, 1L), .Dimnames = list(
    NULL, "Series 1"), .Tsp = c(1980.08333333333, 2009.75, 12
), class = "ts")

I’m having trouble including a two-line title in the R.

To include a title with two lines with you like this:

plot(a,ylim=c(-2,3.4),main="Curva da Vida dos Genes \n Fluxo Vida",ylab="Moments(t+k)")

But if on the second line I want to put the formula: $Y = \alpha + \betaX + \epsilon$ , how do I do?

Thank you

1 answer

4


Use the functions expression and atop within the argument main of plot:

plot(a, main=expression(atop("Curva da Vida dos Genes Fluxo Vida",
paste("Y = " , alpha, " + ", beta, "X", " + ", epsilon))))

inserir a descrição da imagem aqui

  • You could add an explanation of the functions expression() and atop()?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.