Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just as a preamble, please make sure you include all code and relevant data in future questions. If you look at your question above, you will see that some objects such as <code>torre</code> are not defined. That means we can't copy and paste into our R setups. Also the data to which you linked could not be used with the code in the question as it was a limited subset. My advice: (a) create fake data that looks like the data you are using (b) keep your code to the absolute minimum (c) test and double-check code and data in a new R session <strong>before</strong> you post.</p> <p>As far as I can tell you want something like the below. Of course you will have to adapt it for your own purposes, but it should give you some ideas on how to tackle your problem. Notice most of the cosmetic properties such as line colours, thicknesses, legends and titles have been omitted from the plot: they are not important for the purposes of this question. EDIT Another approach might be to use the same data frame for the wind data and then use a faceting variable to show the speed in a different but linked plot.</p> <pre><code>require(ggplot2) require(scales) require(gridExtra) require(lubridate) set.seed(1234) # create fake data for temperature mydf &lt;- data.frame(datetime = ISOdatetime(2013,08,04,0,0,0) + seq(0:50)*10*60, temp = runif(51, 15, 25)) # take a subset of temperature data, # basically sampling every 60 minutes wind &lt;- mydf[minute(mydf$datetime) == 0, ] # then create fake wind velocity data wind$velocity &lt;- runif(nrow(wind), -5, 20) # define an end point for geom_segment wind$x.end &lt;- wind$datetime + minutes(60) ggplot(data = mydf, aes(x = datetime, y = temp, group = 1)) + geom_line() + geom_segment(data = wind, size = 3, aes(x = datetime, xend = x.end, y = 10, yend = velocity), arrow = arrow(length = unit(0.5, "cm"))) + theme() </code></pre> <p>This generates the following plot: <img src="https://i.stack.imgur.com/5M4qW.png" alt="screenshot"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload