generalization of ggplot code is plotting partial x axis problem solved! use xLB not -xLB

I want to eventually make a macro using ggplot. I have successfully gotten the plot to run but when I try to generalize it the entire x axis is not being plotted. I am not sure why. Can someone explain how to correct this? Thank you.

#upper tail working
ggplot(data.frame(x = c(-4, 4)), aes(x)) +
  stat_function(fun = dt, args =list(df =23)) +
  stat_function(fun = dt,   args =list(df =23),
                xlim = c(1.78,4),
                geom = "area") 

#upper tail working but partial x axis is plotted
xUB= 4;
tcrit <-qt(1-alpha,df);        
tcrit<- round(tcrit,4)

ggplot(data.frame(x = c(xLB, xUB)), aes(x)) +
  stat_function(fun = dt, args = list(df)) +
  stat_function(fun = dt, args = list(df),
                xlim = c(tcrit,xUB),
                geom = "area") 

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.