I was trying to plot using ggplot but I am a beginner. The data frame (newdata) contains 2002 rows and 3 columns. When I use basic graphics plot function I get a perfect plot like an inverted bell shape but when I use ggplot2 I don't get a similar plot.
(i solved it..my dataframe had character columns,i converted them to numerical values and i plotted it..i works fine now..)
now i have two plots val vs dat1 and val vs dat2 , now i need to combine them using facet wrap...any help would be appreciated..
val = -1000,-999,-998 to 998,999, 1000.
dat1 = 1.2, 3.4, 5.5, 33.3, 55.4, ...
so on. dat2 is similar to y values.
str(newdata)
'data.frame': 2001 obs. of 3 variables:
$ val : chr "-1000" "-999" "-998" "-997" ...
$ dat1 : num 0.229 0.235 0.247 0.25 0.249 ...
$ dat2 : num 1.97 1.98 1.98 1.98 1.98 ...
ggplot(data = newdata) +
geom_point(mapping = aes(x = val, y = dat1))
updated..dput(data) since the data is very huge im adding a part of it.
structure(list(**val** = c("-1000", "-999", "-998", "-997",
"-996", "-995", "-994", "-993", "-992", "-991"), dat1 = c(0.229377104377104,
0.23526936026936, 0.246843434343434, 0.250210437710438, 0.248526936026936,
0.252314814814815, 0.226641414141414, 0.230218855218855, 0.223484848484848,
0.236952861952862), dat2 = c(1.97385049452862,
1.97675496296296, 1.97780065909091, 1.97756823063973, 1.97745205218855,
1.98053092087542, 1.98291262079125, 1.98401634175084, 1.98796655597643,
1.98639806102694)), row.names = c(NA, 10L), class = "data.frame")
dput(head(newdata)), with enough data to be able to demonstrate plotting the data. (edit your question and post it there in a code-block, not here in a comment, please!)dputformat? Please edit the question with the output ofdput(newdata). Or, if it is too big with the output ofdput(head(newdata, 20)).