Something like this might get you at least part of the way there:
const = function(x) {x*0}
plot(c(-100,100), c(0,0), col="gray60", lty=3, lwd=2, yaxt="n",
xlim=c(-10,10), type="l",
xlab="", ylab="")
curve(const, 3, 8, lwd=4, add=TRUE)
points(3, 0, pch=16, cex=1.5)
Then you can fiddle with the axis() command to get the x-axis looking how you
want it. Or you can turn off the x-axis and add axis-like annotations right
beneath the plotted interval.
You can also package the code above into a function for plotting any
interval(s) entered by the user.
HTH,
Joel
On May 9, 2013, at 4:33 AM, Yahoo! wrote:
> Dear Michael:
>
> Thank you very much.
>
> I am still not able to make it works.
>
>
> thanks
> abou
>
> ========================
>
> AbouEl-Makarim Aboueissa
>
> Sozan Elsalakawy
>
> Mohamed Agamia
>
>
>
> 246 Auburn Street, #158
>
> Portland, ME 04103
>
> USA
>
>
>
> Tel: (207) 797-2724
>
> Email: [email protected]
>
> --- On Thu, 5/9/13, R. Michael Weylandt <[email protected]> wrote:
>
> From: R. Michael Weylandt <[email protected]>
> Subject: Re: [R-sig-teaching] graphing inequalities (intervals) in one varible
> To: "Yahoo!" <[email protected]>
> Cc: "R-sig-teaching" <[email protected]>
> Date: Thursday, May 9, 2013, 6:49 AM
>
> Here's the start of a function. I'll leave it to you to do it better
> (it should probably also use S4 methods, but that's another project):
>
> interval <- function(lower = -Inf, upper = Inf, lower_closed = FALSE,
> upper_closed = FALSE){
> structure(.Data = NULL, lower = lower, upper = upper, lower_closed =
> lower_closed, upper_closed = upper_closed, class = 'interval')
> }
>
> plot.interval <- function(x){
> l <- attr(x, "lower")
> u <- attr(x, "upper")
>
> r <- c(l, u) * c(if(l > 0) 0.7 else 1.2, if(u > 0) 1.2 else 0.7)
> plot(r, c(0,1), main = '', bty = 'n', xlab = '', ylab = '', yaxt =
> 'n', type = 'n', xaxt = 'n')
>
> axis(1, at = seq(r[1], r[2], length.out = 10))
>
> lines(c(l, u), c(0.5, 0.5), col = 2, lwd = 2)
>
> lc <- attr(x, 'lower_closed')
> uc <- attr(x, 'upper_closed')
>
>
> points(c(l, u), c(0.5, 0.5), pch = c(1, 19)[c(lc, uc) + 1], col = 2, cex = 2)
>
> }
>
> On Wed, May 8, 2013 at 12:10 PM, Yahoo! <[email protected]> wrote:
>> Dear All:
>>
>> It seems a very silly question. But I never tried it before. I am teaching a
>> college algebra class this summer.
>>
>> I need some help with graphing intervals on the real line. For examples:
>>
>> {x | -7<= x < 5 and x > 7}
>>
>> {x | x > 3}
>>
>> etc...
>>
>>
>> thank you very much
>> abou
>>
>> ========================
>>
>> AbouEl-Makarim Aboueissa
>>
>> Sozan Elsalakawy
>>
>> Mohamed Agamia
>>
>>
>>
>> 246 Auburn Street, #158
>>
>> Portland, ME 04103
>>
>> USA
>>
>>
>>
>> Tel: (207) 797-2724
>>
>> Email: [email protected]
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> [email protected] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
[[alternative HTML version deleted]]
_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching