Take the 2-minute tour ×

I get a graph1.jpg with the following code,

x = seq(-0.25, 1.25, length = 400)
plot(x, y1,type="l",ann=FALSE)
mtext("x", 1, at=1.25, line=1)
mtext("y", 2, at=1.25, line=1)

Please compare graph1.jpg and graph2.jpg,there are two main diffrences between them,how can i change graph1 into graph2?

1.To change the coordinate axis in graph1 into graph2's.How to set right origin of coordinate
2.No arrow of coordinate axis in graph1
3.To make the y (mtext in y axis in graph1.jpg) horizontal

This is a graph1.jpg. enter image description here

This is a graph2.jpg,maybe graph2.jpg is made by gimp. enter image description here

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Using arrows , axis and setting some plot parameters you can get this :

enter image description here

## you call plot without axes, without box, without axes labels
plot(x, y1,type="l",frame.plot=FALSE,
## write some text
## draw axes lines with arrows
arrows(min(x), 0, max(x), 0)
arrows(0, min(x), 0, max(x))
## add axes ticks
share|improve this answer

Your Answer


