r - Add trend lines to some plots -


I am new to ggplot2, but decided to learn it because I like its simplicity and view. In many cities, I have a time-series with rain, seeing other questions, I came to know how to make it a new look and conspiracy:

  df < - data.frame (time = time), city = representative (colnames (rain .r), each = neo (rain.), Value = as.vector (rain.yr)) ggplot (df, aes (x = Time, y = value)) + geom_line () + facet_wrap (~ city, ncol = 4)  

I really like the final result in terms of scenes, because it's one in the city Plots but with global axes and I came to know how to add trends: stat_smooth (method = "lm")

The problem is that I have some tendency to plots Add lines I do not want them all, but only for those people where a trend is important (I have vectors with zero and zero)

I know that base graphics (using conspiracy and conspiracy) And adding only one line if this trend is important), but is there a way to do it in ggplot2?

As suggested, just a data frame of that subset Naaa you want to smoothing and use it data stat_smooth () .

  subdf < -diamonds [which is $ $ C in the $ ($ SI = 'SI2', 'SI1')%), ggplot (diamonds, AES (x = carat, y = depth)) + gom_point () + fase_use (~ explanation) + GOM_Smooth (Data = SubDife)  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -