Related
I have a dataset with geometry through the sf package included with lat and lon information. I also have a heat map created as a result of the dataset
Overlay<-stat_density2d(aes(x = df$LONGITUDE, y = fd$LATITUDE, fill = ..density..), geom = 'tile', contour = F, alpha = .5)
Is there a way to join the heat map density color values into the point file?
st_join(Shots1B,Overlay)
gives me an error
Error in st_join.sf(Shots1B, Overlay) :
second argument should be of class sf: maybe revert the first two arguments?
Reproductive dataset to follow the process. Overlay is based on the result of this dataset here.
structure(list(LATITUDE = c(40.68358, 40.69754, 40.843464, 40.692547,
40.626457, 40.526894, 40.840775, 40.694035, 40.857365, 40.698807,
40.71402, 40.815, 40.55079, 40.655903, 40.890076, 40.650402,
40.79335, 40.72538, 40.75184, 40.649788, 40.686928, 40.712963,
40.801285, 40.633976, 40.670296, 40.66423, 40.817696, 40.668495,
40.841087, 40.70955, 40.733376, 40.700356, 40.83801, 40.66584,
40.761436, 40.74958, 40.73197, 40.76249, 40.668507, 40.638268,
40.696735, 40.870823, 40.574867, 40.866577, 40.775414, 40.84744,
40.542908, 40.78468, 40.632416, 40.714207, 40.727913, 40.854485,
40.698986, 40.841717, 40.861687, 40.691822, 40.856014, 40.83383,
40.68781, 40.642044, 40.69814, 40.64664, 40.680897, 40.760822,
40.74608, 40.626293, 40.767967, 40.673634, 40.579212, 40.57365,
40.73632, 40.619396, 40.820263, 40.601864, 40.810318, 40.666306,
40.708805, 40.826424, 40.63174, 40.727146, 40.67253, 40.702335,
40.587894, 40.67922, 40.65047, 40.836555, 40.870056, 40.579372,
40.805138, 40.85968, 40.605595, 40.819214, 40.827972, 40.66496,
40.719177, 40.748825, 40.733597, 40.54048, 40.738403, 40.68039,
40.817627, 40.751446, 40.76161, 40.689648, 40.596977, 40.63864,
40.565254, 40.655895, 40.68821, 40.71649, 40.876785, 40.86367,
40.835827, 40.793396, 40.84827, 40.656273, 40.693462, 40.66725,
40.844105, 40.651707, 40.680496, 40.834415, 40.7357, 40.771038,
40.69484, 40.785774, 40.733017, 40.709023, 40.692886, 40.620487,
40.618595, 40.803787, 40.82319, 40.680088, 40.827927, 40.66895,
40.879055, 40.67043, 40.875874, 40.675037, 40.767582, 40.734352,
40.63083, 40.63532, 40.714073, 40.702194, 40.764362, 40.69496,
40.79656, 40.805016, 40.66406, 40.7963, 40.66563, 40.680477,
40.737785, 40.778606, 40.75868, 40.856045, 40.880257, 40.60677,
40.695683, 40.667236, 40.8351, 40.633682, 40.698116, 40.84747,
40.8047, 40.762676, 40.7158, 40.75584, 40.772102, 40.681602,
40.62677, 40.707493, 40.8252, 40.854115, 40.768875, 40.629707,
40.72654, 40.634415, 40.66937, 40.89466, 40.669067, 40.681484,
40.82433, 40.856606, 40.65785, 40.62764, 40.58401, 40.71791,
40.780437, 40.73973, 40.7952, 40.694794, 40.614063, 40.633152,
40.612736, 40.70166, 40.80641, 40.762234, 40.863647, 40.576626,
40.60118, 40.64721, 40.681145, 40.57529, 40.786, 40.601128, 40.827923,
40.805824, 40.642776, 40.86674, 40.678375, 40.74209, 40.81228,
40.604195, 40.84383, 40.759163, 40.652927, 40.69097, 40.718864,
40.683174, 40.749744, 40.738316, 40.839382, 40.66806, 40.74715,
40.663776, 40.843903, 40.836296, 40.655285, 40.70166, 40.64606,
40.72119, 40.708363, 40.674004, 40.729176, 40.86832, 40.598515,
40.695004, 40.72773, 40.704563, 40.66807, 40.66944, 40.684082,
40.69349, 40.765266, 40.74613, 40.74708, 40.87482, 40.70399,
40.649788, 40.69507, 40.788673, 40.847897, 40.68896, 40.695377,
40.880657, 40.828114, 40.781265, 40.848736, 40.65989, 40.748436,
40.61033, 40.752556, 40.829697, 40.718826, 40.65241, 40.852673,
40.851555, 40.707928, 40.891876, 40.58947, 40.74668, 40.85814,
40.708626, 40.73464, 40.62855, 40.65563, 40.687046, 40.70326,
40.633114, 40.62046, 40.75964, 40.64254, 40.783146, 40.705452,
40.74425, 40.75348, 40.84307, 40.620914, 40.80889, 40.78847,
40.712776, 40.75868, 40.74661, 40.835705, 40.688404, 40.781715,
40.730644, 40.75218, 40.731422, 40.761234, 40.668976, 40.637276,
40.788685, 40.87356, 40.795006, 40.820095, 40.594334, 40.666306,
40.673008, 40.583626, 40.874474, 40.633995, 40.772327, 40.704937,
40.653873, 40.677917, 40.59857, 40.809563, 40.68836, 40.666737,
40.713173, 40.73006, 40.652317, 40.76122, 40.588722, 40.643456,
40.865532, 40.67612, 40.620663, 40.72166, 40.733723, 40.745686,
40.875294, 40.803555, 40.7605, 40.661995, 40.69045, 40.658672,
40.711227, 40.700485, 40.816555, 40.861862, 40.875793, 40.68657,
40.654705, 40.637054, 40.6191, 40.734566, 40.714912, 40.74734,
40.6963, 40.63598, 40.724358, 40.586277, 40.671932, 40.650703,
40.61378, 40.727375, 40.573204, 40.671604, 40.740276, 40.684,
40.704494, 40.845642, 40.82681, 40.681168, 40.662476, 40.64739,
40.687138, 40.865143, 40.866673, 40.72313, 40.674934, 40.708363,
40.739525, 40.637997, 40.750965, 40.671585, 40.694294, 40.810173,
40.694748, 40.687103, 40.861744, 40.741074, 40.67875, 40.666943,
40.6635, 40.827824, 40.575832, 40.730366, 40.640945, 40.784237,
40.76803, 40.669823, 40.659336, 40.616093, 40.763546), LONGITUDE = c(-73.97617,
-73.98312, -73.836, -73.990974, -73.918, -74.16728, -73.87246,
-73.72679, -73.84657, -73.91837, -73.74827, -73.89402, -74.20098,
-73.89817, -73.819855, -73.89422, -73.97275, -74.00011, -73.90358,
-73.9622, -73.920815, -73.93647, -73.95394, -74.02211, -73.997604,
-73.919106, -73.922615, -73.925606, -73.86447, -73.95887, -73.86665,
-73.95732, -73.87329, -73.75551, -73.76995, -73.86541, -73.78651,
-73.839584, -73.779625, -73.93187, -73.93481, -73.8721, -74.00069,
-73.8722, -73.91984, -73.89968, -74.15579, -73.80911, -73.94724,
-73.92817, -73.873245, -73.854645, -73.91671, -73.94435, -73.82435,
-73.92223, -73.91213, -73.921234, -73.9237, -73.98124, -73.89111,
-73.9246, -73.95118, -73.99832, -73.974945, -74.01572, -73.96822,
-73.89294, -73.976265, -74.11252, -73.85631, -73.969574, -73.92976,
-74.00232, -73.943634, -73.79171, -73.92577, -73.85868, -73.96793,
-73.954735, -73.798386, -73.89073, -73.95504, -73.90405, -73.917366,
-73.94306, -73.83222, -74.16948, -73.945244, -73.90427, -73.98404,
-73.84662, -73.88707, -73.82226, -73.79223, -73.96984, -73.91062,
-74.153404, -73.93864, -73.94956, -73.92366, -74.001434, -73.97076,
-73.9184, -73.97324, -74.02245, -74.1301, -73.898224, -73.96583,
-73.98484, -73.87446, -73.86741, -73.89068, -73.94043, -73.88312,
-73.90731, -73.965485, -73.88799, -73.923065, -73.93121, -73.821365,
-73.92854, -73.90377, -73.83413, -73.98391, -73.97052, -73.8852,
-73.757835, -73.832184, -74.029305, -73.99847, -73.953896, -73.889496,
-73.94398, -73.90094, -73.9339, -73.87439, -73.928185, -73.84989,
-73.930534, -73.9109, -74.00849, -73.90736, -73.95033, -73.95087,
-73.93587, -73.96162, -73.946236, -73.97226, -73.92109, -73.73846,
-73.93829, -73.73921, -73.7921, -73.93496, -73.98163, -73.87552,
-73.90079, -73.843864, -73.759575, -73.741875, -73.770004, -73.8825,
-73.89868, -73.977325, -73.89134, -73.91243, -73.954346, -73.824486,
-73.99238, -73.763954, -73.95855, -73.946884, -73.94153, -73.867714,
-73.89091, -73.94898, -73.90486, -73.71589, -74.08535, -73.89523,
-73.86137, -73.9878, -73.85049, -73.874374, -73.92841, -73.91648,
-73.89022, -73.98587, -73.95341, -73.94989, -73.70625, -73.94623,
-73.98246, -74.01393, -73.97762, -74.01172, -73.961464, -73.94227,
-73.98987, -73.8918, -73.98478, -73.99098, -74.01531, -73.7923,
-73.97655, -73.84574, -73.997086, -73.93483, -73.954636, -74.02003,
-73.92873, -73.9265, -73.984985, -73.90941, -73.97218, -73.886375,
-73.988396, -73.959335, -73.94833, -73.97483, -73.87389, -73.884315,
-73.98773, -73.84531, -73.90394, -73.985504, -73.889915, -73.927284,
-73.87369, -73.93658, -73.961464, -74.01648, -73.761185, -73.87203,
-73.81881, -73.87898, -73.83317, -73.766464, -73.9525, -73.90674,
-73.91066, -73.80789, -73.883995, -73.90864, -73.97917, -73.81517,
-73.83605, -73.98135, -73.877, -73.85589, -73.9622, -73.80114,
-73.97136, -73.92499, -73.93326, -73.94921, -73.877625, -73.93107,
-73.97599, -73.93234, -73.90536, -73.984566, -73.95932, -73.92972,
-73.91313, -73.98424, -73.9264, -73.919106, -73.952446, -73.784294,
-73.8616, -73.80105, -73.9745, -73.895744, -73.94513, -73.87421,
-73.952835, -73.92596, -73.792114, -73.86474, -73.94928, -74.07641,
-73.95817, -73.87652, -73.97833, -73.78149, -73.7334, -73.980896,
-73.848076, -73.9753, -73.95581, -73.968895, -73.90601, -73.87552,
-73.86473, -73.88875, -73.93803, -73.823845, -73.97329, -73.85201,
-73.94641, -73.96389, -73.90668, -73.93177, -73.94386, -73.81853,
-73.9485, -73.955086, -73.990944, -73.79171, -73.97851, -73.98407,
-73.90031, -73.98138, -73.94531, -73.94932, -74.008156, -73.93861,
-73.9689, -73.92923, -73.96444, -73.90224, -73.90076, -73.710754,
-73.92752, -73.93056, -73.960464, -73.972725, -73.86238, -73.936005,
-74.1524, -73.888664, -73.72516, -73.97213, -73.9088, -73.91184,
-73.95699, -73.91959, -73.959435, -73.90019, -73.72826, -73.93637,
-73.91755, -73.91282, -73.85465, -73.776146, -74.00731, -73.98643,
-74.159615, -73.72269, -73.94784, -73.88673, -73.97545, -73.915146,
-73.742516, -73.9862, -73.85165, -73.920586, -74.07225, -73.90313,
-74.09711, -73.86907, -73.92782, -73.95031, -73.81743, -73.90211,
-73.85361, -73.92941, -73.768326, -73.92314, -73.75136, -73.87204,
-73.90896, -73.90614, -73.80186, -73.92401, -73.92512, -74.02136,
-73.94027, -73.99843, -73.74868, -73.95117, -73.73427, -73.89251,
-73.911804, -73.7258, -73.794, -73.890144, -73.94276, -73.91934,
-74.12409, -73.91388, -73.94852, -73.947075, -73.87722, -73.90981,
-73.92726, -74.14523, -73.88209), COLLISION_ID = c(4407147L,
4136992L, 4395664L, 4397513L, 4403773L, 4405244L, 4405914L, 4407366L,
4407778L, 4407461L, 4407407L, 4407900L, 4407760L, 4407746L, 4408143L,
4407638L, 4407958L, 4407885L, 4407616L, 4408038L, 4408224L, 4407392L,
4407765L, 4407821L, 4407971L, 4408071L, 4407430L, 4408259L, 4407592L,
4407674L, 4407708L, 4408396L, 4407152L, 4407862L, 4407636L, 4407792L,
4407853L, 4408205L, 4407945L, 4408118L, 4408242L, 4407563L, 4408098L,
4407169L, 4407798L, 4407797L, 4407349L, 4407994L, 4408032L, 4407478L,
4407924L, 4408315L, 4407892L, 4408280L, 4408403L, 4407753L, 4408003L,
4407497L, 4408229L, 4407525L, 4407817L, 4407539L, 4408306L, 4407830L,
4407282L, 4407688L, 4407701L, 4407728L, 4408052L, 4407849L, 4407320L,
4407291L, 4408200L, 4407649L, 4407802L, 4407345L, 4408356L, 4407245L,
4408057L, 4408332L, 4407785L, 4407929L, 4407425L, 4408080L, 4408123L,
4408290L, 4408412L, 4407757L, 4407770L, 4407554L, 4407873L, 4407502L,
4408044L, 4408165L, 4407544L, 4407277L, 4407834L, 4407338L, 4407397L,
4408109L, 4407683L, 4407829L, 4407496L, 4407609L, 4407689L, 4407861L,
4407350L, 4407721L, 4407381L, 4407653L, 4407896L, 4407914L, 4407512L,
4408427L, 4407532L, 4408086L, 4407856L, 4407729L, 4407789L, 4408129L,
4407576L, 4408193L, 4407643L, 4407906L, 4407414L, 4407623L, 4407436L,
4407952L, 4407761L, 4408063L, 4407388L, 4407766L, 4407901L, 4408104L,
4407486L, 4408264L, 4407678L, 4407355L, 4408155L, 4408271L, 4408380L,
4407598L, 4407866L, 4407452L, 4407809L, 4407393L, 4407453L, 4408214L,
4407824L, 4407431L, 4407632L, 4407841L, 4407096L, 4407658L, 4407933L,
4407976L, 4407714L, 4407373L, 4407568L, 4407707L, 4407692L, 4407865L,
4407154L, 4407637L, 4407354L, 4407793L, 4407432L, 4407946L, 4407852L,
4408249L, 4407987L, 4408215L, 4408027L, 4407389L, 4407562L, 4407794L,
4407779L, 4407997L, 4407408L, 4408313L, 4407747L, 4408402L, 4407702L,
4407762L, 4407297L, 4407321L, 4408100L, 4407505L, 4408047L, 4407805L,
4407697L, 4407367L, 4407837L, 4407548L, 4407820L, 4408150L, 4407842L,
4407673L, 4407278L, 4407459L, 4407514L, 4408367L, 4407313L, 4407396L,
4407611L, 4408053L, 4407905L, 4407642L, 4407556L, 4407774L, 4407360L,
4408139L, 4408223L, 4408075L, 4407967L, 4407875L, 4407915L, 4408258L,
4408033L, 4408308L, 4407869L, 4407732L, 4407602L, 4407959L, 4408397L,
4408067L, 4408279L, 4407723L, 4408198L, 4407501L, 4408119L, 4408359L,
4407816L, 4407543L, 4407801L, 4407346L, 4407769L, 4408093L, 4407475L,
4408113L, 4407833L, 4407923L, 4407424L, 4407741L, 4407891L, 4407647L,
4407909L, 4407439L, 4407604L, 4407752L, 4407380L, 4408037L, 4408416L,
4407549L, 4408002L, 4408227L, 4408262L, 4407897L, 4408187L, 4407975L,
4408164L, 4408085L, 4408250L, 4408028L, 4407580L, 4408302L, 4407400L,
4408128L, 4408194L, 4408289L, 4407953L, 4408391L, 4408204L, 4407870L,
4407524L, 4408353L, 4407445L, 4408056L, 4407327L, 4407784L, 4407928L,
4407454L, 4407372L, 4407444L, 4407756L, 4407620L, 4407412L, 4407633L,
4407119L, 4407660L, 4408154L, 4407773L, 4407567L, 4407938L, 4407713L,
4408208L, 4408043L, 4408233L, 4407990L, 4408079L, 4408217L, 4408331L,
4407698L, 4407825L, 4408122L, 4407838L, 4407948L, 4407843L, 4407515L,
4407312L, 4407314L, 4407489L, 4407656L, 4407332L, 4407506L, 4408401L,
4407677L, 4407359L, 4408266L, 4407696L, 4407261L, 4407857L, 4407490L,
4407788L, 4408379L, 4408103L, 4408076L, 4408049L, 4407527L, 4407836L,
4408274L, 4407547L, 4407815L, 4408375L, 4407279L, 4407331L, 4407686L,
4408398L, 4408066L, 4408309L, 4408068L, 4407691L, 4407353L, 4407433L,
4407679L, 4407566L, 4408026L, 4407651L, 4407296L, 4407826L, 4407368L,
4407804L, 4407242L, 4407858L, 4407795L, 4407347L, 4408059L, 4407715L,
4408114L, 4408312L, 4407922L, 4407342L, 4407748L, 4407619L, 4408297L,
4407763L, 4408005L, 4407504L, 4408231L, 4407049L, 4408106L, 4407542L,
4407523L, 4407428L, 4408257L, 4407595L, 4407672L, 4407832L, 4407384L,
4408387L, 4407790L, 4407612L, 4407775L, 4407864L, 4407379L, 4407156L,
4407634L, 4408389L, 4407724L, 4407942L, 4408197L, 4407847L, 4407403L,
4408120L, 4407703L, 4407668L, 4407570L, 4408101L, 4407800L, 4407917L
)), row.names = c(NA, 400L), class = "data.frame")
I am trying to create a stratigraphic plot of geochemical element data which should be possible using package tidypaleo.
I want multiple plots of the different element data with Depth (cm) downcore set as the y axis. The data look as follows.
Image of data
I am using this code:
ggplot(wapITRAX, aes(x =BrTi , y = wapITRAX$Depth))+
labs(y = "Depth (cm)")+
geom_lineh()+
theme_classic()+
scale_y_reverse()
However, this only plots one element and I am trying to achieve a plot like this Image of plot
> dput(head(wapITRAX))
structure(list(Depth = 0:5, IncCoh = c(6.049230907, 5.975282432,
5.736199822, 5.658584418, 5.659008377, 5.597103404), BrTi =
c(50.50197628,
22.09236453, 23.48370927, 18.62638581, 14.36924414, 17.48777896
), AlIncCOh = c(16.69633736, 8.200449193, 23.70907643, 20.32310407,
28.62692352, 26.44224866), BrCl = c(8.04090623, 4.306048968,
3.417836951, 3.156895904, 2.787628518, 2.059316731), FeTi =
c(332.715415,
235.9371921, 372.726817, 390.7871397, 396.986099, 495.2624867
), CaTi = c(4.071146245, 3.27955665, 4.395989975, 3.677383592,
3.028670721, 4.523910733), ZrRb = structure(c(363L, 447L, 407L,
395L, 450L, 410L), .Label = c("#DIV/0!", "0.447638604",
"0.478169284",
"0.54554134", "0.548501778", "0.561420163", "0.579454254",
"0.579498861",
"0.580801291", "0.589758019", "0.590194076", "0.590277778",
"0.591357754",
"0.592870544", "0.593851133", "0.598519653", "0.599931082",
"0.600979737",
"0.601426307", "0.611710677", "0.617065868", "0.618499405",
"0.621310093",
"0.627720871", "0.63775246", "0.64005168", "0.643958869",
"0.644371941",
"0.645605974", "0.645661658", "0.646672915", "0.647348952",
"0.651578947",
"0.652401176", "0.656186383", "0.657906264", "0.658835905",
"0.662074554",
"0.662361624", "0.669589393", "0.67103429", "0.671371769",
"0.674335863",
"0.674781688", "0.676097561", "0.676639083", "0.677849462",
"0.680497925",
"0.680610514", "0.680725971", "0.683906537", "0.68855859",
"0.689067202",
"0.692353115", "0.692732291", "0.695411392", "0.696067091",
"0.696794872",
"0.699376436", "0.701762744", "0.702015197", "0.702432938",
"0.70361991",
"0.705235754", "0.705426357", "0.708084164", "0.708258528",
"0.708925221",
"0.715226656", "0.715263314", "0.717828827", "0.718975706",
"0.719799305",
"0.720363636", "0.72476489", "0.725426857", "0.725461098",
"0.726030739",
"0.7267645", "0.726998188", "0.727170554", "0.727533265",
"0.730362368",
"0.731182796", "0.735042735", "0.735849057", "0.736184046",
"0.737214792",
"0.738692342", "0.742223591", "0.742639327", "0.742714724",
"0.744126167",
"0.745790081", "0.746207701", "0.746606335", "0.747041077",
"0.749019608",
"0.751204307", "0.751326495", "0.752443737", "0.752994012",
"0.753398969",
"0.754587869", "0.755151515", "0.755466053", "0.756316411",
"0.757107679",
"0.759175941", "0.76070965", "0.761635833", "0.763760166",
"0.763861189",
"0.764076577", "0.765001936", "0.765509391", "0.765795207",
"0.76598579",
"0.767080745", "0.767225748", "0.767262192", "0.770291777",
"0.771194699",
"0.772540984", "0.774533358", "0.77486376", "0.777252364",
"0.778319123",
"0.778445883", "0.779076739", "0.779310345", "0.782186577",
"0.78238342",
"0.782541093", "0.785497178", "0.787594824", "0.788230584",
"0.788916736",
"0.789033068", "0.789052737", "0.789177605", "0.789596048",
"0.790439133",
"0.791078234", "0.792993631", "0.794899978", "0.795265235",
"0.795432921",
"0.798130469", "0.79861957", "0.798894446", "0.799410029",
"0.799679487",
"0.800096223", "0.800119868", "0.800280899", "0.800947004",
"0.80293448",
"0.804118993", "0.804120112", "0.805092452", "0.806161301",
"0.81631016",
"0.816337149", "0.81638756", "0.81827622", "0.818899466",
"0.81993865",
"0.821925431", "0.825329202", "0.825608077", "0.826135414",
"0.826325411",
"0.827108292", "0.829798658", "0.832460733", "0.832814584",
"0.833845295",
"0.833908046", "0.833980583", "0.83741705", "0.837604457",
"0.838292367",
"0.838860231", "0.839741935", "0.846485664", "0.846740374",
"0.84679304
1",
"0.84734599", "0.850027518", "0.850077882", "0.854863613",
"0.85565883",
"0.85591192", "0.857095047", "0.858967536", "0.85897779",
"0.859192457",
"0.859239235", "0.860408412", "0.860505166", "0.8609918",
"0.862821134",
"0.867779204", "0.872207328", "0.872918493", "0.873888706",
"0.874140666",
"0.877452229", "0.879856851", "0.88003663", "0.880155093",
"0.881013197",
"0.882190156", "0.882319978", "0.883029342", "0.883316008",
"0.884908053",
"0.885431692", "0.885849846", "0.889082969", "0.89763062",
"0.898384089",
"0.898527865", "0.9", "0.900719424", "0.904636261", "0.904913848",
"0.905223479", "0.908485273", "0.911212059", "0.916470588",
"0.917162698",
"0.917470525", "0.917952884", "0.918054256", "0.918781726",
"0.922268448",
"0.925987182", "0.926287744", "0.933958724", "0.939701616",
"0.940987438",
"0.941196465", "0.943041526", "0.946832078", "0.947419907",
"0.948080043",
"0.949085366", "0.950099404", "0.950502912", "0.950704225",
"0.953596288",
"0.954868709", "0.95505992", "0.955361596", "0.956422018",
"0.95671509",
"0.959064327", "0.96165309", "0.964232489", "0.965528048",
"0.965874467",
"0.968717195", "0.970270821", "0.971573209", "0.973415133",
"0.974608081",
"0.974986972", "0.978223496", "0.97935022", "0.980142566",
"0.981730052",
"0.982819606", "0.987483236", "0.989587207", "0.991002571",
"0.991932655",
"0.995306859", "0.997555012", "1.001706485", "1.002357873",
"1.005146199",
"1.010493827", "1.011544012", "1.013038906", "1.013469577",
"1.015357613",
"1.01541976", "1.015544041", "1.015937059", "1.016162826",
"1.019393939",
"1.019529957", "1.019994873", "1.028932491", "1.029518072",
"1.030101225",
"1.032310705", "1.03344968", "1.036769138", "1.037322515",
"1.041150092",
"1.041459782", "1.041961577", "1.042347697", "1.047411444",
"1.048390581",
"1.057811121", "1.060218978", "1.065395654", "1.06921167",
"1.071509648",
"1.073730469", "1.076014602", "1.077266637", "1.079983072",
"1.083003953",
"1.086196504", "1.086445657", "1.0867266", "1.0905", "1.092152628",
"1.094730942", "1.095692666", "1.1074142", "1.109534807",
"1.111154446",
"1.111188325", "1.113985094", "1.114045618", "1.128810226",
"1.129375525",
"1.132705479", "1.154833837", "1.155201819", "1.158940397",
"1.161348047",
"1.162953533", "1.175788329", "1.178036097", "1.179280397",
"1.18116463",
"1.198506534", "1.203134068", "1.207592892", "1.208610568",
"1.212525667",
"1.212841855", "1.214403157", "1.216756112", "1.228462377",
"1.23305986",
"1.241758242", "1.258212878", "1.265571914", "1.265707797",
"1.272666444",
"1.279325988", "1.289559543", "1.291191103", "1.296541003",
"1.305111821",
"1.315201411", "1.342263532", "1.344827586", "1.347944377",
"1.352831595",
"1.377717391", "1.37771934", "1.385440181", "1.403358682",
"1.411889597",
"1.412269549", "1.412544902", "1.433843384", "1.444088526",
"1.473706353",
"1.50172117", "1.508521601", "1.53030303", "1.532658694",
"1.537642783",
"1.54340949", "1.558746736", "1.595342983", "1.596774194",
"1.596969697",
"1.630653266", "1.702558635", "1.70468948", "1.718568102",
"1.740819711",
"1.760157274", "1.775510204", "1.804859813", "1.814081408",
"1.816513761",
"1.849050827", "1.870188679", "1.880195599", "1.887061404",
"1.91858679",
"1.929152149", "1.944140197", "1.946996466", "1.986547085",
"2.007683864",
"2.070983811", "2.099778271", "2.156359393", "2.159613059",
"2.163963964", "2.25951087", "2.261603376", "2.329896907",
"2.402555911", "2.414500684",
"2.444075305", "2.450268817", "2.484520124", "2.51119403",
"2.515064562",
"2.526086957", "2.554", "2.609715243", "2.61965812", "2.643854749",
"2.704166667", "2.883275261", "3.013186813", "3.02739726",
"3.206896552",
"3.320930233", "3.411627907", "3.688931298", "3.709677419",
"3.748267898",
"3.878865979", "3.936440678", "3.994230769", "33.15909091",
"4.095854922",
"4.29330254", "4.390957447", "4.514634146", "4.6367713",
"4.847665848",
"5.284023669", "5.387755102", "6.171339564", "6.183908046",
"6.36121673",
"6.847826087", "7.003496503", "7.193220339", "8.160550459",
"8.751879699"
), class = "factor"), MnFe = c(0.012176723, 0.010329834,
0.009460859,
0.004488071, 0.0033725, 0.003435313), MnIncCoh = c(169.4430276,
331.1977339, 490.5686845, 279.5752228, 272.3091921, 286.0408118
), CuRb = c(0.392971246, 1.484304933, 0.735426009, 0.491651206,
1.142857143, 0.4345898)), row.names = c(NA, 6L), class =
"data.frame")
Using your posted data. This should approximate the desired design.
First step, Transform the data from a wide format to a long format using the pivot_longer function from tidyr.
Then plot the data using "depth" as the independent variable and the parameters' values as the dependent variables.
Then use facet_wrap() to separate the plots. coord_flip() will make the independent variable (Depth) appear on the y-axis.
#fixed 1 column of data.
originaldata$ZrRb <- as.numeric(as.character(originaldata$ZrRb))
library(tidyr)
#Make wide
wapITRAX<-pivot_longer(originaldata, -1, names_to="parameter", values_to = "value")
library(ggplot2)
ggplot(wapITRAX, aes(x = Depth , y = value))+
labs(x = "Depth (cm)")+
geom_line() +
theme_classic() +
coord_flip() +
scale_x_reverse() +
facet_wrap(vars(parameter), nrow=1, scales = "free_x")
It is my data:
> dput(data)
structure(list(foldchange = c(-0.17853057272962, 3.60013440830337,
0.648944710423407, 1.38528656859267, 2.38882890772698, 1.91371568283765,
1.77591931363495, -1.51447851175922, 3.1416903855924, 1.51711016957237,
3.14707703341916, -1.44751697381751, 1.23658565660726, -0.512829478520189,
1.68928069854351, 2.07214007434345, 1.24799276690488, 6.25149659558487,
6.35918877435554, 5.86088034655694, 6.38890659730165, 5.05510489389194,
4.62060389613534, 3.75508710774868, 4.18575763169519, 5.31627264153051,
5.87091236649665, 6.71464565321037, 5.24000610137973, 4.25821377851955,
7.32277714374523, 3.1963295806222, 7.26249808789293, 4.44427454088613,
6.21495395454133, 8.74469985969472, 7.49982946564144, 4.45020943795387,
5.66199031471621, 5.29959827685333, 8.65819317196484, 5.86664903755707,
4.5740575604176, 8.24504501687473, 5.7916074097308, 4.18199181353134,
6.73956641707995, 4.60357435173805, 5.9205153184753, 3.65014593638562,
3.25607795403669, 5.56919529940933, 5.76811109641351, 6.10600807588152,
5.69234974521511, 5.5102283323841, 4.71232921328194, 6.55727667796477,
6.19995053763513, 4.64209842048131, 2.29238227264409, 6.79465189260383,
7.51968952300944, 7.81695579226993, 6.29926703626301, 4.64687557749141,
-2.44220257171186, 5.33199370895397, 5.18820654974805, 5.03498241997507,
6.29395095024283, 6.27602377186869, 6.78363927671209, 2.93759015053983,
6.65061604346668, 5.671080311536, 8.45199131823131, 5.79230415012306,
6.3270025568739, 7.0934690916107, 3.53800869528685, 3.08683779646569,
6.82111375813946, 3.02729078403818, 5.36024214796805, 4.04778690916444,
5.74765756930797, 4.10788604670319, 6.39978058654016, 5.7746717387066,
2.9247167920294, 7.54315906042106, 4.2742172444481, 6.61121261965006,
3.77012175922873, 4.94407566887151, 7.93185716981795, 7.05304621480995,
5.59261760605766, 5.42381827536197, 4.22645498896606, 5.15806113482742,
4.15403623593809, 6.40153592433128, 7.38902001442131, 2.72654942454391,
3.28741231093207, 3.79334363176751, 5.86527050546341, 5.10320299162235,
3.99883612485974, 6.45475273104195, 4.85567883821983, 6.55055641729645,
5.03746875764267, 7.27660375171087, 3.30817125205364, 5.23766518187252,
7.6588755830143, 3.53552741086444, 5.66455197986778, 8.40623211540503,
3.93151438658523, 4.26875667827774, 4.38704995079332, 6.75232207417316,
3.76563594385214, 6.08008097541859, 2.40905905886796, 5.50981339395085,
5.78780269825563, 0.2322416329745, 5.69410860233132, 4.94656296117567,
4.20594226169741, 4.50293112094816, 6.07430576125864, 3.67684848946483,
5.825851099141, 5.22439201628482, 7.72829018644622, 5.24910611944979,
4.01783420322782, 6.3888069709767, 5.26066649741256, 4.81678726754752,
6.5683773907454, 4.86957242886115, 6.76705114368644, 4.45769029291236,
7.77607596853254, 6.85213457577069, 1.40150885676552, 5.43409652313493,
3.21738153172066, 6.23015085020594, 5.50091556711613, 3.99948543388746,
5.85816098688073, 4.33775608630599, 5.91715214825299, 5.45674826103132,
7.66790792082782, 6.63325838131012, 3.89631178894691, 2.38526575667126,
1.58661549426288, 4.76626341270591, 6.73426272316295, 5.54006035262931,
4.07996836453406, 7.12087390022358, 6.96007461543701, 5.68202490906633,
6.58504044389069, 5.41036820315057, 6.61076809589319, 1.23772469006557,
4.1661166499875, 2.94059625298825, 8.38336956160413, 4.84906289871508,
4.93787691221829, 6.82379835301371, 5.82520798412864, 4.87582657907206,
5.36621724700676, 8.91922991774938, 3.49025109999629, 5.1232073414505,
4.27193651596412, 5.07417945071012, 3.61930149745523, 2.7469092502892,
6.67162003616042, 4.86698118654996, 7.53876919017093, 4.58878989189686,
5.78956520376246, 3.98567045767003, 8.14934433289609, 6.88879716040936,
7.00251456012974, 5.05095662412332, 6.39777439550296, 7.96268799093557,
4.82826575143863, 8.31032763539508, 4.74493707321909, 6.8929416113222,
6.84202549278968, 8.20121430968127, 2.91031632522241, 4.86190488550545,
5.5516465446887, 7.74996457744065, 2.25505738807845, 5.71069872298306,
1.97493599527532, 5.60445326341706, 6.39297603198736, 7.16298115056911,
4.52688105225386, 6.46061751569601, 4.78104064111529, 2.84526825975018,
6.5537923066898, 6.98258253798747, 5.0967396817644, 6.64593966293456,
4.8990397150507, 4.59878411928317, 5.55158425631398, 2.1065660739172,
2.40396884881286, 6.45421536580342, 5.98567305090568, 6.48593538806214,
7.41313242816247, 5.99024340460149, 5.63812101302136, -1.43793573368627
), all_pvalue = c(0.818887590433193, 0.00892139546812015, 0.434133425685163,
0.0536266013313456, 0.0450933986128537, 0.0367856407800243, 0.0941222253709068,
0.213526299326008, 0.00855327289085924, 0.0449444491492238, 0.00465098209958804,
0.0369667514121697, 0.0910501610463896, 0.378892060498093, 0.0595757077704777,
0.031626850730261, 0.0878934608628569, 0.0124722939899662, 0.0249040599008334,
0.0150448394759397, 0.0104024068916351, 0.0340577599419123, 0.0244947271472485,
0.122485247246688, 0.0211309039009709, 0.0201043058824927, 0.0152779076456381,
0.00938733157248341, 0.013807428170544, 0.01948348499862, 0.0119978631408916,
0.0997968486684091, 0.00504808432168479, 0.041226720485986, 0.0127407583225205,
0.00709338243276709, 0.00383605674079435, 0.0399854589187244,
0.0163222001450531, 0.00909800553027099, 4.81144191594885e-06,
0.0105231068132293, 0.0377428014886314, 0.00709059633291303,
0.00743882656849872, 0.0696633906261403, 0.00568508439144595,
0.0142206230933159, 0.0183625193075117, 0.0818974933908099, 0.0609423408539195,
0.00581572852382799, 0.00603085345605447, 0.00684099077236254,
0.0194814381299995, 0.0325641567545152, 0.0404062983698557, 0.00626431765905907,
0.00287654691487974, 0.0183318967557602, 0.202860908663261, 0.0033395497287839,
0.00804091896430431, 0.00524635934550195, 0.0100089274728679,
0.00470611875383887, 0.361169323059008, 3.90129727113067e-06,
0.0205225005371219, 0.0120500045076898, 0.00732055098038156,
0.0229916087025324, 0.00544774481324614, 0.108252753362848, 0.00911923198666818,
0.0122812312739145, 0.00343585528287351, 2.06257208918569e-05,
0.000904993210532763, 0.0015065294739414, 0.102118204143709,
0.118350948568527, 0.0136202759386966, 0.15251012082679, 0.0428316882385798,
0.0752744217284719, 0.00632986043900174, 0.0269567937932686,
0.00707537967267082, 0.0149356605279715, 0.163005190656644, 0.00929612911973378,
0.0196453775259569, 0.0133262667903121, 0.114115405959882, 0.0189109801950218,
0.00590387539250432, 0.00802692325541374, 0.0184346327727756,
0.00104714399950925, 0.0554774130259537, 0.0084910975380844,
0.0349856904843115, 0.0124547169142572, 8.60050865459788e-07,
0.1188515828269, 0.133720711339729, 0.0641704698591151, 0.0075124796175742,
3.94432669779951e-07, 0.0740343932996142, 0.00160775849728933,
6.61326355967731e-06, 0.0106610228625055, 0.00539717052083514,
0.00492255859958016, 0.122531121480312, 0.0159768620962635, 0.00365780586610517,
0.0135086464724098, 0.0256265865459836, 0.00391215568816396,
0.0271580638871089, 0.0512876942387616, 0.0135566028247977, 0.0169110062500104,
0.0848247460082605, 0.0158705161056627, 0.176345767878009, 0.0124719098589431,
0.0152388258990332, 0.866066700538701, 0.042979313425954, 0.0160125031962862,
0.0441592105265668, 0.0124108545467876, 1.80875437447348e-06,
0.0704671677844812, 0.0111351361909711, 1.62883074487165e-07,
0.000694779973318456, 0.0120079549431507, 0.0196183531679123,
0.0100186493225724, 0.0173294242221405, 0.0573614373022037, 1.30612522568528e-07,
0.023898721968545, 0.00665918028588502, 0.06907634259105, 0.00518730999717143,
0.0109717740506543, 0.394662670743417, 0.0165847750353483, 0.0593829446004973,
0.000113216713641592, 0.0222583368635018, 0.0694462386106761,
0.00437955933335859, 0.0631677226779205, 0.00649674049335009,
1.10699021652115e-07, 0.00543997929535101, 0.00292890932795308,
0.021574456097881, 0.17997075681454, 0.279770535484078, 0.050945514039484,
0.0102923410906512, 0.0103389721465925, 0.112227938286441, 0.00398090342551613,
0.0428676019413789, 0.00337313863923396, 0.0092822848687081,
0.00778850900332348, 0.00146877357609246, 0.448950342618974,
0.0801294647165026, 0.0797698230881222, 3.72112644308374e-05,
0.00728653989704988, 0.0320006421510141, 0.000420503611946363,
0.0207086037412542, 0.0448889114898146, 6.94555482668648e-07,
0.000135994029220134, 0.0982385638169219, 0.0130399195487442,
0.0297056523919866, 0.0208455457844783, 0.104595177359326, 0.100684824982166,
0.00110472016462074, 0.0664329210478157, 0.0140428240948167,
0.0468861767036331, 0.0102813794498838, 0.0693803856754811, 0.00566014993761021,
0.00275831473628789, 0.00234550137829788, 0.0116252548991317,
0.0143153463606759, 0.00995352784254985, 0.00238257560505637,
0.00182950280683248, 0.013195116994233, 0.000640921917352429,
0.000171523469251389, 0.0087256530793244, 0.0989386901919075,
0.0321103798387662, 0.0222773975090858, 0.007943310795799, 0.171053950985746,
0.012874269835152, 0.38817395138115, 0.00787508757030877, 0.0114487159712535,
0.0187831808209386, 0.0452479566115196, 0.00640720682677851,
0.0315482155790946, 0.125132833439637, 0.0115284490664364, 0.00538397509568388,
0.00517772137814985, 0.00176762574966497, 0.0273122011845722,
0.0191341545126795, 0.0235413416908084, 0.270326642321866, 0.179926862630332,
0.008734949388329, 0.0138918131322944, 0.00507817315892406, 0.000173786133243839,
0.00225184544628237, 0.0181059516295825, 0.541544494598043),
probename = c("Mark_1", "Mark_2", "Mark_3", "Mark_4", "Mark_5",
"Mark_6", "Mark_7", "Mark_8", "Mark_9", "Mark_10", "Mark_11",
"Mark_12", "Mark_13", "Mark_14", "Mark_15", "Mark_16", "Mark_17",
"Mark_18", "Mark_19", "Mark_20", "Mark_21", "Mark_22", "Mark_23",
"Mark_24", "Mark_25", "Mark_26", "Mark_27", "Mark_28", "Mark_29",
"Mark_30", "Mark_31", "Mark_32", "Mark_33", "Mark_34", "Mark_35",
"Mark_36", "Mark_37", "Mark_38", "Mark_39", "Mark_40", "Mark_41",
"Mark_42", "Mark_43", "Mark_44", "Mark_45", "Mark_46", "Mark_47",
"Mark_48", "Mark_49", "Mark_50", "Mark_51", "Mark_52", "Mark_53",
"Mark_54", "Mark_55", "Mark_56", "Mark_57", "Mark_58", "Mark_59",
"Mark_60", "Mark_61", "Mark_62", "Mark_63", "Mark_64", "Mark_65",
"Mark_66", "Mark_67", "Mark_68", "Mark_69", "Mark_70", "Mark_71",
"Mark_72", "Mark_73", "Mark_74", "Mark_75", "Mark_76", "Mark_77",
"Mark_78", "Mark_79", "Mark_80", "Mark_81", "Mark_82", "Mark_83",
"Mark_84", "Mark_85", "Mark_86", "Mark_87", "Mark_88", "Mark_89",
"Mark_90", "Mark_91", "Mark_92", "Mark_93", "Mark_94", "Mark_95",
"Mark_96", "Mark_97", "Mark_98", "Mark_99", "Mark_100", "Mark_101",
"Mark_102", "Mark_103", "Mark_104", "Mark_105", "Mark_106",
"Mark_107", "Mark_108", "Mark_109", "Mark_110", "Mark_111",
"Mark_112", "Mark_113", "Mark_114", "Mark_115", "Mark_116",
"Mark_117", "Mark_118", "Mark_119", "Mark_120", "Mark_121",
"Mark_122", "Mark_123", "Mark_124", "Mark_125", "Mark_126",
"Mark_127", "Mark_128", "Mark_129", "Mark_130", "Mark_131",
"Mark_132", "Mark_133", "Mark_134", "Mark_135", "Mark_136",
"Mark_137", "Mark_138", "Mark_139", "Mark_140", "Mark_141",
"Mark_142", "Mark_143", "Mark_144", "Mark_145", "Mark_146",
"Mark_147", "Mark_148", "Mark_149", "Mark_150", "Mark_151",
"Mark_152", "Mark_153", "Mark_154", "Mark_155", "Mark_156",
"Mark_157", "Mark_158", "Mark_159", "Mark_160", "Mark_161",
"Mark_162", "Mark_163", "Mark_164", "Mark_165", "Mark_166",
"Mark_167", "Mark_168", "Mark_169", "Mark_170", "Mark_171",
"Mark_172", "Mark_173", "Mark_174", "Mark_175", "Mark_176",
"Mark_177", "Mark_178", "Mark_179", "Mark_180", "Mark_181",
"Mark_182", "Mark_183", "Mark_184", "Mark_185", "Mark_186",
"Mark_187", "Mark_188", "Mark_189", "Mark_190", "Mark_191",
"Mark_192", "Mark_193", "Mark_194", "Mark_195", "Mark_196",
"Mark_197", "Mark_198", "Mark_199", "Mark_200", "Mark_201",
"Mark_202", "Mark_203", "Mark_204", "Mark_205", "Mark_206",
"Mark_207", "Mark_208", "Mark_209", "Mark_210", "Mark_211",
"Mark_212", "Mark_213", "Mark_214", "Mark_215", "Mark_216",
"Mark_217", "Mark_218", "Mark_219", "Mark_220", "Mark_221",
"Mark_222", "Mark_223", "Mark_224", "Mark_225", "Mark_226",
"Mark_227", "Mark_228", "Mark_229", "Mark_230", "Mark_231",
"Mark_232", "Mark_233", "Mark_234", "Mark_235", "Mark_236",
"Mark_237", "Mark_238", "Mark_239", "Mark_240", "Mark_241",
"Mark_242")), row.names = c("Mark_1", "Mark_2", "Mark_3",
"Mark_4", "Mark_5", "Mark_6", "Mark_7", "Mark_8", "Mark_9", "Mark_10",
"Mark_11", "Mark_12", "Mark_13", "Mark_14", "Mark_15", "Mark_16",
"Mark_17", "Mark_18", "Mark_19", "Mark_20", "Mark_21", "Mark_22",
"Mark_23", "Mark_24", "Mark_25", "Mark_26", "Mark_27", "Mark_28",
"Mark_29", "Mark_30", "Mark_31", "Mark_32", "Mark_33", "Mark_34",
"Mark_35", "Mark_36", "Mark_37", "Mark_38", "Mark_39", "Mark_40",
"Mark_41", "Mark_42", "Mark_43", "Mark_44", "Mark_45", "Mark_46",
"Mark_47", "Mark_48", "Mark_49", "Mark_50", "Mark_51", "Mark_52",
"Mark_53", "Mark_54", "Mark_55", "Mark_56", "Mark_57", "Mark_58",
"Mark_59", "Mark_60", "Mark_61", "Mark_62", "Mark_63", "Mark_64",
"Mark_65", "Mark_66", "Mark_67", "Mark_68", "Mark_69", "Mark_70",
"Mark_71", "Mark_72", "Mark_73", "Mark_74", "Mark_75", "Mark_76",
"Mark_77", "Mark_78", "Mark_79", "Mark_80", "Mark_81", "Mark_82",
"Mark_83", "Mark_84", "Mark_85", "Mark_86", "Mark_87", "Mark_88",
"Mark_89", "Mark_90", "Mark_91", "Mark_92", "Mark_93", "Mark_94",
"Mark_95", "Mark_96", "Mark_97", "Mark_98", "Mark_99", "Mark_100",
"Mark_101", "Mark_102", "Mark_103", "Mark_104", "Mark_105", "Mark_106",
"Mark_107", "Mark_108", "Mark_109", "Mark_110", "Mark_111", "Mark_112",
"Mark_113", "Mark_114", "Mark_115", "Mark_116", "Mark_117", "Mark_118",
"Mark_119", "Mark_120", "Mark_121", "Mark_122", "Mark_123", "Mark_124",
"Mark_125", "Mark_126", "Mark_127", "Mark_128", "Mark_129", "Mark_130",
"Mark_131", "Mark_132", "Mark_133", "Mark_134", "Mark_135", "Mark_136",
"Mark_137", "Mark_138", "Mark_139", "Mark_140", "Mark_141", "Mark_142",
"Mark_143", "Mark_144", "Mark_145", "Mark_146", "Mark_147", "Mark_148",
"Mark_149", "Mark_150", "Mark_151", "Mark_152", "Mark_153", "Mark_154",
"Mark_155", "Mark_156", "Mark_157", "Mark_158", "Mark_159", "Mark_160",
"Mark_161", "Mark_162", "Mark_163", "Mark_164", "Mark_165", "Mark_166",
"Mark_167", "Mark_168", "Mark_169", "Mark_170", "Mark_171", "Mark_172",
"Mark_173", "Mark_174", "Mark_175", "Mark_176", "Mark_177", "Mark_178",
"Mark_179", "Mark_180", "Mark_181", "Mark_182", "Mark_183", "Mark_184",
"Mark_185", "Mark_186", "Mark_187", "Mark_188", "Mark_189", "Mark_190",
"Mark_191", "Mark_192", "Mark_193", "Mark_194", "Mark_195", "Mark_196",
"Mark_197", "Mark_198", "Mark_199", "Mark_200", "Mark_201", "Mark_202",
"Mark_203", "Mark_204", "Mark_205", "Mark_206", "Mark_207", "Mark_208",
"Mark_209", "Mark_210", "Mark_211", "Mark_212", "Mark_213", "Mark_214",
"Mark_215", "Mark_216", "Mark_217", "Mark_218", "Mark_219", "Mark_220",
"Mark_221", "Mark_222", "Mark_223", "Mark_224", "Mark_225", "Mark_226",
"Mark_227", "Mark_228", "Mark_229", "Mark_230", "Mark_231", "Mark_232",
"Mark_233", "Mark_234", "Mark_235", "Mark_236", "Mark_237", "Mark_238",
"Mark_239", "Mark_240", "Mark_241", "Mark_242"), class = "data.frame")
I would like to create a nice graph (publication wise) to represent a data stored in this data frame. In general I would like to create a scatterplot or volcano plot with colors/shapes indicating what is important in my data.
I would like to achieve something like that:
Or:
As a filter cutoff we can start with: foldchange > 4 & all_pvalue < 0.05. I would like to also have a possibility to highlight (different color/shape and with a label) only couple of rows. Lets say as a starting point I would like to highlight Mark_23 and Mark_65.
Is it doable in R ? I have already tried something with volcano plot:
volcano = ggplot(data = data, aes(x = foldchange, y = -1*log10(all_pvalue)))
volcano + geom_point()
Can someone help me with going further ?
Here is an attempt to show what's possible
data$zones := interaction(abs(data$foldchange)>4,data$all_pvalue<0.05)
library(ggplot2)
library(ggrepel)
ggplot(data = data, aes(x = foldchange, y = -1*log10(all_pvalue),color = zones))+
geom_point()+
theme_light()+
geom_label_repel(aes(label=ifelse(probename %in% c("Mark_23","Mark_65"),as.character(probename),"")),
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50',show.legend = FALSE) +
geom_hline(yintercept = -1*log10(0.05),linetype = "dashed")+
geom_vline(xintercept = 4,linetype = "dashed")+
scale_color_manual(labels = c("bad", "also bad","good","not sure"), values = c("gray50","green","blue", "red"))+
labs(x = "fold change",
y = expression(log[10](p)),
color = "meaning")
there are many things here. geom_label_repel from library(ggrepel) allow to link your few points you want to show with a label. The easiest way of having the different colours is to create a variable that says in what zone you are. That is what I did with the zones variable, that you use in colour to have a changing color. You can manualy change it with the scale_color_manual function.
In the labs function I used the expression function that allows you to do superscripts. You can of course change the theme including, margins, axis, text size etc.
You can for example add theme(legend.position="top") to your plot to have the legend on top.
i am facing a problem in plot ols estimations in a scatterplot:
I have this data frame: With 9 columns and 99 rows:
structure(list(Y = c(-0.145442175, 0.291096141, 0.489923112,
-2.038363166, 1.180430664, 0.188114666, 0.850922634, 1.172142766,
-3.980837975, 0.285762444, 2.497040646, 0.658010994, -0.925171981,
0.37076995, -1.108211119, -0.409242669, -1.234583525, -0.385841816,
0.016744771, -0.584406288, 1.17224811, -0.746804388, -0.625028046,
0.257871468, -2.735845346, 2.619304857, -0.406825232, 0.323665151,
2.218951363, -0.821029648, -0.872854889, -2.663306158, -0.121976044,
0.881566376, -1.972706678, -3.855576256, 2.927421113, 1.314753531,
0.234296206, 0.828464757, -0.909318569, 0.616134903, -0.567630403,
0.624571064, -0.414112923, 0.642200314, -0.309421266, 0.195312598,
-0.519988256, 0, 0.081070175, 0.032446432, -0.534025032, -0.426783307,
-0.38495511, -0.207900219, -1.953789746, -0.616924355, -0.783222881,
-1.935420969, 0.638445535, 1.080925923, -1.598076681, 0.25063631,
-0.697183766, 0.188971653, -0.415267389, -4.154506044, 1.163226552,
0.036569698, -0.547147074, 1.11937374, 0.383311682, -0.875037781,
-0.372684863, 0.306816004, -1.250561544, -1.042237738, -1.757788446,
0.021079982, 1.844023775, 1.674645753, -0.428546132, -0.527705597,
0.542202572, -0.621479123, -0.050415867, -0.122332943, 0.468553764,
0.216998274, 3.088480781, 0.434099931, 2.114916704, -2.407018936,
-0.127060127, 0.546756422, 0.263207486, 0.63453915, 0.76832746
), X = c(0.009476137, -0.0236354, 0.0094081, 0.11715252, 0.032324021,
0.0461193, 0.050794971, 0.032372819, 0.202121874, 0.390821859,
-0.124492596, -0.127305193, -0.22233597, -0.081113713, 0.09952616,
0.22494711, 0.226621495, 0.411607624, 0.089200478, -0.013454832,
-0.013547165, -0.232366214, 0.03140992, -0.026798837, -0.084556341,
-0.091993172, -0.303730207, -0.236679148, -0.284235285, -0.355253166,
-0.179645537, -0.01381843, -0.022950244, -0.050065976, -0.032018504,
-0.087168055, -0.081865767, -0.253991077, -0.242882759, -0.150225053,
-0.16596575, -0.156887247, -0.071795146, -0.100408802, -0.067307731,
0.024006869, -0.019250912, -0.02399429, 0.038421097, 0.062320065,
0.07187025, 0.024019462, 0.038421097, 0.033539309, 0.014351457,
-0.009575137, 0.014343968, 0.028561284, 0.0404213, 0.026065697,
-0.004700435, -0.072739794, -0.042217496, -0.05889531, -0.130522139,
-0.136291869, -0.120099035, -0.091418565, -0.122040844, -0.124609029,
-0.096255449, -0.190338762, -0.11611752, -0.055598423, -0.065293448,
-0.038746326, -0.029090518, -0.067627348, -0.082097445, -0.215845836,
-0.389993696, -0.264371785, -0.126530291, -0.111840985, -0.094952196,
-0.136700196, -0.190968195, -0.156564122, -0.181077278, -0.15381292,
-0.122020692, -0.107867301, -0.068642333, -0.034348677, -0.073289926,
-0.063314884, -0.092537576, -0.165375956, -0.15042398), Null = c(-0.036795117836493,
0.0120555676565338, -0.0366906491623935, -0.22323992930528, -0.0728300398338213,
-0.0955073599141197, -0.103350601084975, -0.0729090354522075,
-0.400153521158964, -0.887015257107641, 0.1362666683468, 0.13919994231771,
0.221388292373518, 0.087380368104602, -0.189831042487278, -0.452154909992189,
-0.456044210600938, -0.948567833126862, -0.170785020294756, -0.00253939338337472,
-0.00240533038312774, 0.228145471304061, -0.0713518661553421,
0.0165138860659871, 0.0915102566139487, 0.100284493544177, 0.265652059802101,
0.230938443729295, 0.257246215885006, 0.281209408151878, 0.188533028671265,
-0.00201164134414489, 0.0110851592192505, 0.0481858583559124,
0.0237904823161768, 0.094614581053392, 0.0882862377341187, 0.241468070168396,
0.234837060900023, 0.162029971029324, 0.176601607696189, 0.168307425791361,
0.0759851164110966, 0.109970788582389, 0.0703849242291975, -0.059492586621119,
0.00581616568295407, 0.0125631925046972, -0.0827672867080164,
-0.123023227393077, -0.139691063870559, -0.0595125909296922,
-0.0827672867080164, -0.074799966578053, -0.044324863847201,
-0.00820062690976645, -0.0443132308515717, -0.0667648997869916,
-0.0860567642206439, -0.0627706942069095, -0.0153914247452083,
0.0771546773236518, 0.0377224646820258, 0.0596889425617937, 0.1425196179012,
0.148379247725525, 0.13162698340227, 0.0996137276510431, 0.133686233062275,
0.136388667637584, 0.105222539655097, 0.197385328960716, 0.127361748973716,
0.0554268640818151, 0.0678473149754353, 0.0330232883757411, 0.0197208677278167,
0.0707862239701058, 0.0885648870712001, 0.216820906265572, 0.286245951224793,
0.247258814186372, 0.138394666330137, 0.122716205945161, 0.103719679674083,
0.148789344619283, 0.197893429730301, 0.168006688568371, 0.189742414352596,
0.165430712615822, 0.133664933948451, 0.11833998959919, 0.0720581343490991,
0.0270069004188009, 0.077834296346802, 0.0653403280475977, 0.100918894574441,
0.176071877748707, 0.162219750035618), OLS_1 = c(-2.97674658085357,
-2.95792547866683, -2.97674412477729, -2.7937460366665, -2.96913739819288,
-2.95639989365184, -2.95069150171007, -2.96910314906723, -2.3856485268894,
-0.647452287114872, -2.68293610049662, -2.670570393744, -2.10297963546522,
-2.84137496711892, -2.84927190111917, -2.23638642750757, -2.22477621905134,
-0.385841816000001, -2.87715002139054, -2.96747293407547, -2.96740133507642,
-2.02609643038743, -2.9697648045679, -2.95427875550959, -2.8310157181346,
-2.80733412921436, -1.38551048535346, -1.99204069101103, -1.57679230211392,
-0.821029648, -2.39395151432173, -2.96718943992586, -2.95867282134313,
-2.9175506236826, -2.94755679517459, -2.82290206987746, -2.83914454134393,
-1.84931168689084, -1.94200482386918, -2.56030139156351, -2.4747687889082,
-2.52507434784403, -2.86749990988846, -2.77838660436577, -2.87908253396987,
-2.97385415360498, -2.96244666805069, -2.95752797222193, -2.96426392038595,
-2.93361303993881, -2.91621877029975, -2.97384869333029, -2.96426392038595,
-2.96826157356433, -2.97653443074828, -2.97023260580068, -2.97653534550966,
-2.9715473503959, -2.96240424133875, -2.97289412424858, -2.9730125951007,
-2.86497897723402, -2.93188917574701, -2.89904800305061, -2.6561144854951,
-2.62935195635151, -2.70174255054932, -2.80922741244202, -2.69350740105694,
-2.68242924921473, -2.79295820376613, -2.32657978700299, -2.718248099245,
-2.90625073580661, -2.88407071600265, -2.93759776247538, -2.95143559806685,
-2.87827902655775, -2.83845377816351, -2.15100018436527, -0.392139380784325,
-1.7590965971582, -2.67400272569948, -2.73540774982849, -2.79741598960129,
-2.62741730304073, -2.322499279269, -2.52681590220219, -2.38514457172383,
-2.541507865502, -2.6935934995898, -2.75082409521646, -2.87570553083222,
-2.94427256930162, -2.86349763526591, -2.88884317216564, -2.80553055841713,
-2.47811758528604, -2.55927025907886), OLS_2 = c(-2.83865555876367,
-2.82203271957637, -2.83865550287755, -2.66277932892391, -2.83073328950317,
-2.8182826854432, -2.81275284604234, -2.83069942358793, -2.27571536741022,
-0.632851535784811, -2.56646067709365, -2.55491098827374, -2.02364579120999,
-2.71420058960775, -2.71564453925406, -2.13442002502496, -2.12343285482248,
-0.385841816, -2.74223576659719, -2.83068449367348, -2.83062014186059,
-1.95158880862936, -2.83135434505306, -2.81870405841395, -2.70456098525177,
-2.68251016192609, -1.35080974869909, -1.91966655284606, -1.53026524143009,
-0.821029648, -2.29619548286091, -2.83042962848176, -2.82271365766308,
-2.78489427206998, -2.81254809712918, -2.69700817487578, -2.71212546804251,
-1.78585373408616, -1.87276085874404, -2.45184700668681, -2.37183555552258,
-2.41889982491589, -2.73848954857785, -2.65553364194069, -2.74924637290594,
-2.8354502300085, -2.82614423798244, -2.82167034953476, -2.82594242161564,
-2.7962902949221, -2.77959589724382, -2.83544467118397, -2.82594242161564,
-2.82986834510621, -2.83829410413293, -2.83315419155684, -2.83829521382395,
-2.83312719078141, -2.82412509152621, -2.83447802392599, -2.83561001727694,
-2.73614728712302, -2.79813447119318, -2.76776591170989, -2.54140667394362,
-2.5163996858597, -2.58402223424852, -2.68427373122372, -2.57633280462435,
-2.56598731123967, -2.66911582708562, -2.23311605677819, -2.59943103595799,
-2.7744383205277, -2.75387620457868, -2.80339428073398, -2.81610308322424,
-2.74850042856033, -2.71148276169435, -2.06864445166113, -0.418358709691658,
-1.7012556906544, -2.558117011201, -2.61544592452239, -2.67326984561107,
-2.5145916492569, -2.22929491666958, -2.42052887445801, -2.28795076147412,
-2.43427089501948, -2.57641320261571, -2.62982944259216, -2.74611100908034,
-2.80953310903525, -2.73477077084888, -2.75830410348864, -2.68083005992821,
-2.37496906485549, -2.4508827380889), OLS_3 = c(-2.58083646581942,
-2.5683178338716, -2.58084089114316, -2.41826149362172, -2.57232965672457,
-2.56041470241702, -2.55521822468909, -2.57229650627193, -2.0704676472292,
-0.605591599496051, -2.34899840070827, -2.33897223601076, -1.87552769159633,
-2.47676312148376, -2.46615920192222, -1.94404642215785, -1.9342224786085,
-0.385841816000001, -2.49034777076914, -2.57529735049815, -2.57524652934739,
-1.81248137667339, -2.57293885513887, -2.56558300171966, -2.46846711008925,
-2.44946096338359, -1.28602268062379, -1.78454238349805, -1.4433981562183,
-0.821029648, -2.11368273887782, -2.57509593622485, -2.56887479307252,
-2.53722183306237, -2.56048377359198, -2.46196139684977, -2.47497795642607,
-1.66737628649693, -1.7434807939705, -2.24936019247138, -2.17965685727221,
-2.22066956504207, -2.49762425675709, -2.42616435450559, -2.50683929408026,
-2.57704694280319, -2.57166448720316, -2.56802106429762, -2.56769302344379,
-2.53990559282486, -2.52451787208599, -2.57704119998386, -2.56769302344379,
-2.57148502596854, -2.58019625622877, -2.57722566059429, -2.58019772985789,
-2.57469359055957, -2.56595475982599, -2.57605200249485, -2.57907626550515,
-2.49561557851369, -2.54841138215235, -2.52265924802504, -2.32724456926626,
-2.30551521644622, -2.36423571438323, -2.45098235381054, -2.35756515622,
-2.3485875529132, -2.43789928063234, -2.05861713726078, -2.37759686441414,
-2.52834152993493, -2.51080007744427, -2.55283331443161, -2.56343418632904,
-2.50620082129485, -2.47442497328161, -1.91488441727801, -0.467310795744689,
-1.59326539683083, -2.34175573481226, -2.39147445613669, -2.44148615865099,
-2.30394357612981, -2.05528024243402, -2.22208856552246, -2.10648769733616,
-2.23405702128991, -2.35763491117015, -2.40392966200837, -2.50415507637054,
-2.55797145858227, -2.49443477420494, -2.51458468009137, -2.44801138045477,
-2.18238842077399, -2.24852076027753), OLS_4 = c(-2.4289478285331,
-2.41681903415288, -2.42895104301202, -2.27867081965274, -2.4213161496905,
-2.41038194422522, -2.40559515788832, -2.42128586809391, -1.95522949388955,
-0.590647453749078, -2.21077815389366, -2.20138321248198, -1.76758669368012,
-2.33060054299992, -2.32313500877883, -1.83755181381677, -1.82840597739465,
-0.385841816, -2.34557046847711, -2.42346978407977, -2.42342111188123,
-1.70861264386732, -2.42187239429871, -2.41422413566286, -2.32281181955877,
-2.30497392699143, -1.21632553238408, -1.68248005204524, -1.36346128591018,
-0.781669317752002, -1.99042352676657, -2.42327691796255, -2.41734804581689,
-2.38744248609079, -2.40939495374384, -2.31670510436427, -2.32892438647688,
-1.57289978140148, -1.64407512538075, -2.11744278294415, -2.05217911016675,
-2.09057710272701, -2.35019495754122, -2.28311871426765, -2.35885543710246,
-2.42560672084754, -2.42000135641999, -2.4165372393818, -2.41707097497419,
-2.39145946177805, -2.3772271125231, -2.42560153071694, -2.41707097497419,
-2.420544236609, -2.42841594588832, -2.4253216199613, -2.42841722040367,
-2.42347169955882, -2.41547562547196, -2.42470587973943, -2.4271143253132,
-2.34830761179908, -2.39799094116799, -2.37373288731684, -2.19039487337143,
-2.17003793409615, -2.22505776553193, -2.30640152341961, -2.21880622042115,
-2.21039315621698, -2.294126428977, -1.93888869626962, -2.23758086989921,
-2.37908034073483, -2.36257901260101, -2.4021644964107, -2.41218787827608,
-2.35825527028976, -2.3284051877118, -1.80440438182757, -0.451087514089169,
-1.50359480720157, -2.20399138892979, -2.25058992243427, -2.29749148286179,
-2.16856567860513, -1.93576601076367, -2.09190575790345, -1.98368936201681,
-2.10311255036163, -2.21887159162467, -2.26226743315126, -2.35633238493592,
-2.407018936, -2.34719820268328, -2.36613768370737, -2.30361375259329,
-2.05473632620086, -2.11665669129059), OLS_5 = c(-2.2911912568638,
-2.28123967681215, -2.29119683586224, -2.14805590207021, -2.28325670505768,
-2.27261386268403, -2.268006850245, -2.28322682471889, -1.84560662105751,
-0.576090713535621, -2.0945064647732, -2.0859234999636, -1.68828464788266,
-2.20368547406672, -2.18986194988925, -1.73587625378362, -1.72735189094969,
-0.385841816, -2.21101101562234, -2.28700200417098, -2.28696051646281,
-1.63411554699496, -2.28380625780731, -2.27896044246845, -2.19661244829441,
-2.18039652225164, -1.18146437845759, -1.6101070827248, -1.31682391434599,
-0.781364138557704, -1.89278224977018, -2.28683751979873, -2.28170279433502,
-2.25507742887343, -2.27469315563211, -2.19106352335337, -2.20216376634672,
-1.50940418054145, -1.57481865165838, -2.00915316980509, -1.94938461398854,
-1.98455653642811, -2.22145418758665, -2.1605019074557, -2.22929361026136,
-2.28754415075922, -2.28401553991566, -2.28099274980288, -2.2790962708342,
-2.25448944582185, -2.24095826297856, -2.28753886744317, -2.2790962708342,
-2.28249611688223, -2.29051254450738, -2.28856644852124, -2.29051401027405,
-2.28539476406181, -2.27754391464367, -2.28663199585719, -2.29003809100396,
-2.21974449731936, -2.26453458741267, -2.24273365564754, -2.0758820670505,
-2.05727208640147, -2.1075473897372, -2.18169509790509, -2.10183883759691,
-2.0941547862828, -2.17052540371127, -1.84552009498619, -2.11897925887711,
-2.2475539961602, -2.23266092019845, -2.26826235385205, -2.27716458812284,
-2.22875067319638, -2.20169236013157, -1.72209385129724, -0.476893951190187,
-1.44569200778405, -2.08830648613957, -2.13084935049209, -2.17358829667077,
-2.05592583172644, -1.84265559786228, -1.98577321824112, -1.88660772323127,
-1.99603456442263, -2.10189853669134, -2.14149931364702, -2.22701080101746,
-2.27258448425562, -2.21873931960315, -2.23587705524471, -2.17915915787995,
-1.95172754860073, -2.00843362344438), OLS_6 = c(-2.14615029819501,
-2.1274826763545, -2.14613692884822, -2.038363166, -2.14482079785526,
-2.13839956793073, -2.1352633011825, -2.14480554064275, -1.77137087834078,
-0.604458131512312, -1.92044345866761, -1.91142894340333, -1.5035051350835,
-2.03720410348948, -2.07364942604987, -1.67230210256299, -1.66457879312031,
-0.427523081653794, -2.09111249534671, -2.1358169999572, -2.13575175544593,
-1.44873737433719, -2.14509683128765, -2.12442374236989, -2.02946586195686,
-2.01185030632841, -0.994510606111227, -1.42450007218492, -1.12983335353955,
-0.596198212559954, -1.7115906309286, -2.13555900800151, -2.12811588444992,
-2.09509015766854, -2.11889016916752, -2.02341958358771, -2.03553614239934,
-1.32305159796573, -1.38891263096519, -1.83141440901763, -1.76969899713653,
-1.80596583024281, -2.05682837956465, -1.99043348930533, -2.06558998487816,
-2.14664801486533, -2.13135448546891, -2.1271468279034, -2.14250449627423,
-2.12545741758249, -2.11509475538252, -2.1466464083569, -2.14250449627423,
-2.14442504670383, -2.14684049810003, -2.13838680613343, -2.1468398441846,
-2.14583791450693, -2.14156460788614, -2.14633891192499, -2.14114136796206,
-2.05492693125432, -2.10632999229998, -2.08080895764288, -1.90090288083161,
-1.88144765246016, -1.93417313784094, -2.01325520240903, -1.9281579797124,
-1.92007377040746, -2.00120005643771, -1.66327168223962, -1.94624457366434,
-2.08634430885867, -2.06937728900294, -2.11086434271986, -2.12206882778948,
-2.06498074945642, -2.03501978622706, -1.5377512452434, -0.29431817292714,
-1.25902518147068, -1.91393009686737, -1.95881793980313, -2.00449939786682,
-1.88004274517372, -1.66034827254381, -1.80722288608151, -1.70526848086161,
-1.81783189921089, -1.92822084254891, -1.97013652098612, -2.0630309651189,
-2.1162243283256, -2.0538104595074, -2.07300962091288, -2.0105124912345,
-1.7721107506457, -1.83066883021211)), .Names = c("Y", "X", "Null",
"OLS_1", "OLS_2", "OLS_3", "OLS_4", "OLS_5", "OLS_6"), row.names = c(NA,
99L), class = "data.frame")
My scatter plot will consist of the first column (Y) and the second column (X).
The third column i will not use.
From the fourth column are the curves that are fitted values of OLS regressions.
How do I include them using the plot function?
i am doing this, but its not working
plot(data[,2],data[,1])
for(i in 4:9){
lines(data[,i])
}
What am i doing wrong?
Basically you want
data <- data[order(data$X), ] ## reordering so that `X` is increasing
plot(data$X, data$Y)
for (i in 4:9) {
lines(data$X, data[,i], col = i) ## remember to set `x-coordinates`
}
legend("topright", legend = names(data)[4:9], col = 4:9, lty = 1) ## add legend
We used the R library forecast to make predictions for the next 24 hours. We have the following:
fore_cast=forecast.tbats(model,h=24,level=90)
fore_cast
Point Forecast Lo 90 Hi 90
5.380952 6270.778 5389.089 7296.643
5.386905 5458.096 4557.375 6536.743
5.392857 5219.995 4248.967 6412.814
5.398810 5187.102 4126.390 6520.328
Now we have 2 problems:
We need 'time' (in hour e.g. 01,23,19 etc) instead of 'point'.
We wish to plot the trendline against time showing the actual observed
values against these predicted values. We have loaded actual observed
values from a CSV file.
We tried:
actual_data = read.csv('actualdata.csv')
plot(actual_data,fore_cast)
Doesn't work, and using plot(actual_data) just shows some points in a straight line instead of curved trendline.
EDIT:
Sample output of fore_cast from dput:
structure(list(model = structure(list(lambda = 0.000438881055939422,
alpha = 0.65694875480321, beta = -0.0983972877836753, damping.parameter = 0.800419363290521,
gamma.one.values = c(-0.00150031474145603, -0.00124696854910294
), gamma.two.values = c(0.0023600487982342, -0.002465549595849
), ar.coefficients = NULL, ma.coefficients = NULL, likelihood = 13202.294346586,
optim.return.code = 0L, variance = 0.00855092137349485, AIC = 13258.294346586,
parameters = structure(list(vect = c(0.000438881055939422,
0.65694875480321, 0.800419363290521, -0.0983972877836753,
-0.00150031474145603, -0.00124696854910294, 0.0023600487982342,
-0.002465549595849), control = structure(list(use.beta = TRUE,
use.box.cox = TRUE, use.damping = TRUE, length.gamma = 4L,
p = 0, q = 0), .Names = c("use.beta", "use.box.cox",
"use.damping", "length.gamma", "p", "q"))), .Names = c("vect",
"control")), seed.states = structure(c(7.44188559667267,
0.00357069100887873, -0.0664300680553579, 0.0229067500159256,
0.00460111570469819, -0.00772324725408007, -0.000610110386029883,
0.00568378752162509, -0.0084050648066819, -0.0324093004247092,
-0.000720936399990958, -0.00705790547321605, -0.00738992950838566,
0.00180424326179638, -0.00107745502434416, 0.00242014705705761,
-0.01824679745657, 0.0123019701003545, -0.0245935735677402,
0.0181321397860132), .Dim = c(20L, 1L)), fitted.values = structure(c(1598.57443298879,
1435.74973092922, 1397.92464316794, 1296.90202189518, 1440.3201303663,
1544.11695101118, 1777.97079874181, 1766.50571671645, 1925.27360388028,
1863.26963233038, 1773.08363764691, 1887.26580055295, 1887.48006609474,
1841.66200850472, 1991.90290660363, 2233.04775631848, 2081.30246965768,
1872.12639817609, 1899.38583561568, 2213.43437455052, 2214.00832820531,
1745.36311914995, 1678.67975050944, 1502.35472259274, 1512.27350460399,
1456.14165844166, 1464.3803467642, 1517.99443293857, 1484.54280422369,
1382.37041287489, 1452.43700910726, 1545.16934543365, 1440.50974319508,
1475.59742668699, 1544.88546424501, 1790.95280713647, 1916.4267023671,
1928.72804180587, 1819.15839770808, 1916.43079357329, 1836.80043977753,
1720.25638746452, 1730.03629161412, 1614.6048115754, 1599.23641723244,
1635.86950932066, 1543.46360784778, 1641.35066985679, 1608.60556151299,
1651.47649465456, 1475.15006990464, 1403.67294742438, 1507.58932406857,
1666.3170708439, 1696.06132797576, 1543.32187293056, 1704.58043626911,
1914.72424191575, 2109.33624862625, 2092.98934458578, 2222.13355258602,
2084.68677709368, 1962.9230489947, 2045.61547393981, 2140.30565941261,
2097.46130996426, 2126.07936955385, 2226.18935508502, 2269.54492801286,
2300.37314952852, 2398.48786829541, 2303.31270702723, 2332.74139979969,
2146.51487558643, 2101.27480789243, 2111.61910899422, 2053.57840714969,
2046.56606362537, 2073.82870990658, 2094.88831798868, 2334.85185938782,
2541.72156227893, 2502.36031483721, 2398.12240784327, 2266.35832277135,
2151.05248890962, 2266.88803633019, 2366.19453856405, 2399.97570044332,
2341.74959623409, 2144.33465155869, 2102.91952061083, 2214.48622101851,
2179.48115699957, 2288.28092735955, 2224.55218736155, 2195.1506809087,
2163.94619334319, 2161.41843642149, 2134.75060670667, 2138.77895768654,
2142.84680080931, 2258.55072549978, 2297.90237035988, 2314.94197015208,
2300.99928929609, 2277.39754662665, 2291.06980363364, 2487.04257346235,
2381.05768214413, 2509.40078456481, 2657.61336243367, 2528.65026804303,
2434.2722174014, 2366.04811963942, 2270.6647135766, 2231.33965004538,
2376.51043520344, 2249.42861599343, 2193.98771109322, 2252.12327312365,
2210.76969838623, 2180.50451255189, 2221.92898123682, 2537.84678083006,
2329.57350097532, 2252.82349908982, 2143.92033677754, 2092.3142840022,
2084.70304624685, 2111.18929138546, 2160.05383108999, 2280.94409931504,
2118.22029344747, 2214.65738250204, 2269.05911898631, 2084.26658709038,
2016.04764576402, 2095.57091797435, 2161.07354463394, 2427.77607700887,
2333.91103594967, 2234.23838054763, 2250.71557301013, 2186.97925802073,
2129.51096829218, 2115.40228652934, 2094.89231085691, 2086.41044567131,
2180.94542608489, 2105.38187642016, 2459.45788915933, 2292.36325639374,
2410.75372754831, 2375.56640249604, 2491.11938114866, 2470.51372278037,
2464.95765202085, 2600.85929020727, 2709.48518695182, 2779.77558137814,
2518.29927341458, 2344.06621605191, 2391.56719713269, 2368.68842788795,
2199.93530349068, 2113.92970206565, 2458.96718445444, 3121.97852988865,
2559.40932439262, 2331.12829078836, 2238.54586985577, 2241.91440620202,
2225.29804576634, 2154.14147781021, 2060.57980596908, 2037.30100544426,
2215.93410789353, 2364.42668160056, 2518.72871618042, 2537.34279365294,
2473.76096855791, 2623.63387707374, 2589.08335304697, 2577.0563838788,
2349.53279218826, 2305.52193868551, 2232.63712180453, 2167.50003597208,
2320.23187534213, 2281.86365949586, 2281.21119271599, 2323.2014703372,
2185.94404743238, 2140.21863271207, 2011.67723856012, 1966.52063119589,
2002.67344212857, 1952.41101080662, 1988.37461163105, 2126.75137749373,
2239.14722292367, 2320.98046489603, 2444.91847853015, 2431.69548763034,
2514.73820659393, 2505.85249387343, 2888.19773974179, 2853.20690693738,
2502.20865871069, 2524.56894781003, 2659.52271740553, 2615.9025930681,
2923.69327019152, 2754.76074569658, 2784.59488335761, 2874.24378479002,
2683.41908597168, 2733.83011888159, 2774.1325162997, 2906.41593326865,
2726.06821502751, 2460.21579967528, 2450.8035097605, 2547.39389733175,
2625.60323572861, 2827.94083526683, 2971.92012845614, 3042.90981987278,
2835.00811374845, 2846.98066660519, 2871.21876763166, 2901.99696373824,
2627.47532996657, 2583.75084300313, 2602.68041642846, 2632.8054092953,
2667.85374690972, 2639.10586730146, 2466.95799545022, 2381.06823502402,
2531.32611053776, 2407.14812148706, 2342.75701798463, 2401.73791085847,
2365.50645844524, 2404.50408575777, 2452.57343738519, 2613.15332739214,
2665.50965844576, 2723.8237337447, 2915.09266385617, 2890.17498445896,
2853.6278331055, 2868.1228183545, 2917.07803535669, 2876.59409770233,
2577.82035337979, 2581.91435020803, 2520.20342021937, 2603.37973251208,
2536.03988578365, 2510.83398648802, 2472.80606784857, 2425.51212342113,
2442.02863541673, 2465.73405821711, 2384.42988766816, 2555.51500549788,
2737.77091706275, 2425.00224845814, 2460.17325671183, 2639.16650619329,
2816.37024420397, 2755.69999167982, 2802.64991688288, 2685.12803367301,
2521.77568128564, 2500.99980614696, 2620.41659854805, 2529.25134423133,
2590.14804885984, 2318.80485234464, 2341.88940012276, 2460.21008281205,
2513.70688167177, 2437.71670675479, 2383.29782281743, 2499.36244454453,
2472.98602901478, 2491.10649022417, 2350.1405559119, 2362.78308814045,
2431.3911847573, 2321.15216823049, 2355.74203614213, 2429.60523843166,
2355.61947983433, 2346.3751018515, 2453.82214513707, 2542.98125962684,
2342.43364707529, 2302.17741211575, 2388.93541944219, 2435.41878657221, ....
Sample output from dput for actual observed values:
structure(list(index12 = c(6297.416944, 5406.865556, 4718.355556,
5304.729167, 4968.014722, 5081.130833, 5544.955, 4655.009444,
4269.023056, 4346.588333, 4511.455833, 5102.57, 4818.673333,
4862.343056, 4785.176667, 5385.005278, 6469.080833, 7166.025278,
7010.708333, 511.114167)), .Names = "index12", class = "data.frame", row.names = c(NA,
-20L))
The value of Point is unusual in spite of hour unit data. I think you failed to make a model.
Here is my example:
actual_data <- structure(list(index12 = c(6297.416944, 5406.865556, 4718.355556,
5304.729167, 4968.014722, 5081.130833, 5544.955, 4655.009444,
4269.023056, 4346.588333, 4511.455833, 5102.57, 4818.673333,
4862.343056, 4785.176667, 5385.005278, 6469.080833, 7166.025278,
7010.708333, 511.114167)),
.Names = "index12", class = "data.frame", row.names = c(NA, -20L))
# I suppose that actual_data was taken per hour.
num_actual <- as.numeric(actual_data[,1])
model <- bats(num_actual)
fore_cast <- forecast(model, h=24, level=90)
fore_cast # Point is from 21 to 44 because of length(actual_data)=20 and demanding predictions for the next 24 hours
# Point Forecast Lo 90 Hi 90
# 21 5063.207 2902.187 7224.226
# 22 5108.114 2946.988 7269.241
# :
# 44 5108.114 2944.629 7271.600
# plot() has forecast method. It draws actual_data and prediction, and paints Lo90-Hi90.
plot(fore_cast, main="")