Hello, I am frastruated with this graph, just cannot get what I need. Thank
you for any suggestions or help. I really appreciate it. I wrote the
following code, but there are 3 problems
1, the red line is added on the graph but without any marker on the y-axis.
I want to display the number '.1361' on the y-axis. So people can easily
tell 'method 2' gets a constant estimate, which is 0.1361.
2, since 'method2' is a constant. I prefer in the legend area, it just
shows
'method2' as a short red bar instead of a knot/spot in the middle of the
red
bar in the legend area. How can I delete that spot?
3, when I draw 'method1' in blue one, I prefer a filled/shaded circle
instead of the unshaded circle. I tried pch='.', seems it does not
really
work.
Hopefully I make my question clear. Thanks a lot for any help!
size=c(80, 40, 20, 16, 10, 8, 4, 2)
estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607)
plot(size, estimate, type="o", lwd=1.5, col="blue",
ylim=c(0, 0.2),
xlim=c(0,80))
abline(h=0.1361, col="red", lwd=1.5)
legend(0, 0.2,c("method1","method2"), cex=0.8,
col=c("blue","red"),
pch=21:1, lty=1);
--
View this message in context:
http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html
Sent from the R help mailing list archive at Nabble.com.
Hi there,
May be part of your problem is solved.
size=c(80, 40, 20, 16, 10, 8, 4, 2)
estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607)
plot(size, estimate, type="o", lwd=1.5, col="blue",
ylim=c(0, 0.2),
xlim=c(0,80), pch=19, axes=F)
abline(h=0.1361, col="red", lwd=1.5)
legend(0, 0.2,c("method1","method2"), cex=0.8,
col=c("blue","red"),
pch=c(19,NA), lty=1);
axis(1)
axis(2,at=c(0,0.10,0.1361,0.2))
bests
milton
On Sun, Jan 3, 2010 at 9:26 PM, aegea <gcheer3@gmail.com> wrote:
>
> Hello, I am frastruated with this graph, just cannot get what I need. Thank
> you for any suggestions or help. I really appreciate it. I wrote the
> following code, but there are 3 problems
>
> 1, the red line is added on the graph but without any marker on the y-axis.
> I want to display the number '.1361' on the y-axis. So people can
easily
> tell 'method 2' gets a constant estimate, which is 0.1361.
>
> 2, since 'method2' is a constant. I prefer in the legend area, it
just
> shows
> 'method2' as a short red bar instead of a knot/spot in the middle
of the
> red
> bar in the legend area. How can I delete that spot?
>
> 3, when I draw 'method1' in blue one, I prefer a filled/shaded
circle
> instead of the unshaded circle. I tried pch='.', seems it does not
really
> work.
>
> Hopefully I make my question clear. Thanks a lot for any help!
>
>
>
> size=c(80, 40, 20, 16, 10, 8, 4, 2)
> estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 ,
> 0.0607)
> plot(size, estimate, type="o", lwd=1.5, col="blue",
ylim=c(0, 0.2),
> xlim=c(0,80))
> abline(h=0.1361, col="red", lwd=1.5)
> legend(0, 0.2,c("method1","method2"), cex=0.8,
col=c("blue","red"),
> pch=21:1, lty=1);
>
> --
> View this message in context:
> http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
You can also try: axis(1) axis(2, las=1) axis(2,at=c(0.1361), las=1) bests milton On Sun, Jan 3, 2010 at 9:26 PM, aegea <gcheer3@gmail.com> wrote:> > Hello, I am frastruated with this graph, just cannot get what I need. Thank > you for any suggestions or help. I really appreciate it. I wrote the > following code, but there are 3 problems > > 1, the red line is added on the graph but without any marker on the y-axis. > I want to display the number '.1361' on the y-axis. So people can easily > tell 'method 2' gets a constant estimate, which is 0.1361. > > 2, since 'method2' is a constant. I prefer in the legend area, it just > shows > 'method2' as a short red bar instead of a knot/spot in the middle of the > red > bar in the legend area. How can I delete that spot? > > 3, when I draw 'method1' in blue one, I prefer a filled/shaded circle > instead of the unshaded circle. I tried pch='.', seems it does not really > work. > > Hopefully I make my question clear. Thanks a lot for any help! > > > > size=c(80, 40, 20, 16, 10, 8, 4, 2) > estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , > 0.0607) > plot(size, estimate, type="o", lwd=1.5, col="blue", ylim=c(0, 0.2), > xlim=c(0,80)) > abline(h=0.1361, col="red", lwd=1.5) > legend(0, 0.2,c("method1","method2"), cex=0.8, col=c("blue","red"), > pch=21:1, lty=1); > > -- > View this message in context: > http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
aegea wrote:> > 1, the red line is added on the graph but without any marker on the > y-axis. I want to display the number '.1361' on the y-axis. So people can > easily tell 'method 2' gets a constant estimate, which is 0.1361. > > 2, since 'method2' is a constant. I prefer in the legend area, it just > shows 'method2' as a short red bar instead of a knot/spot in the middle of > the red bar in the legend area. How can I delete that spot? > > 3, when I draw 'method1' in blue one, I prefer a filled/shaded circle > instead of the unshaded circle. I tried pch='.', seems it does not really > work. > >Thanks for the nice example. size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type="o", lwd=1.5, col="blue", ylim=c(0, 0.2), xlim=c(0,80),pch=16) abline(h=0.1361, col="red", lwd=1.5) # use NA for no dot legend(0, 0.2,c("method1","method2"), cex=0.8, col=c("blue","red"), pch=c(16,NA), lty=1); # text inside it is easy text(-0,0.134,"0.134",col="blue") # outside you could use mtext, but not for exact position mtext("0.134",2,adj=0.7,padj=-1,col="green") # best is to plot another axis #axis(2,0.134,"0.134") # ugly overprint axis(2,0.134,"0.134",las=2,col="red") -- View this message in context: http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998109.html Sent from the R help mailing list archive at Nabble.com.