Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a straight faint dotted/dashed line through y=0

Tags:

graph

plot

r

I want to be able to draw a faint dotted or dashed line through y=0 to make it more obvious when the plotted line goes below 0. If possible id like the whole area of the graph below the y=0 line to be lightly shaded to show even better when the plotted line drops below zero.

Here is just an example of a type of graph that i would want to shade/draw a line:

http://s27.postimg.org/v94uey56r/Rplot02.png

There are lots of different graph types that i would like to do this to so it doesnt have to be specific, just aslong as it works so i have a general idea of what to do is good enough :)

thankyou

like image 641
Summer-Jade Gleek'away Avatar asked Sep 10 '14 12:09

Summer-Jade Gleek'away


People also ask

How do you make a dotted line in R?

If you choose type = "l", R plots solid lines by default. Use the optional lty argument to set the line type. For example, plot(x, y, type = "l", lty = "dashed") plots a dashed line.

How do you make a dotted line in Matlab?

Create a plot with a red dashed line and circular markers by specifying the linespec argument as '--or' . For this combination, '--' corresponds to a dashed line, 'o' corresponds to circular markers, and 'r' corresponds to red. You do not need to specify all three aspects of the line.


1 Answers

How about abline(h = 0, lty = 2)?

like image 128
Lars Lau Raket Avatar answered Sep 21 '22 13:09

Lars Lau Raket