Watts-College / paf-513-template

https://watts-college.github.io/paf-513-template/
MIT License
0 stars 0 forks source link

Lab 3 #7

Open KaytieS opened 7 months ago

KaytieS commented 7 months ago

Can anyone help me with how to make the blue line for the graph in our lab? Do you just use the lines() function? I have tried using this function with multiple different codes and it either doesn't look right or it comes up with an error. @JasonSills are you able to help with this? Is it just using the lines() function? I'm not sure what to google to help with this. This is what I have right now and no line shows up: league_strikeouts <- aggregate(SO ~ yearID, data = Teams, FUN = mean) lines(x = league_strikeouts$yearID, y = league_strikeouts$SO, col= "blue")

JasonSills commented 7 months ago

@KaytieS,

You will want to use the plot() function. Note that in 1.4 Type of Plot in your plot() Function reading you have four types of plots. You will want to add in type = in your plot() function and choose the type you want to use. Let's take a look at this code:

plot( 
      x=fertilizer, y=corn.height,
      type="p",
      main='type="p"',
      cex.main=2,
      xlab="",
      ylab="",
      col.axis="gray60",
      frame.plot=F
    )

Here type is p, which will return a scatter plot of fertilizer and corn height. You also have: l, b, and o. Use your plot() function and select input the type of graph that you want.