Re: [R] text in boxplots

2007-09-07 Thread Yves Moisan

Hi Greg,

Actually, I'm using the scatterplot function in the car namespace.  My
understanding is that the scatterplot is turned into a boxplot when the x
variable is a factor, but I can't see that in the code of the function. 
I've successfully modified the function to output regression stats (R^^2,
etc.) with the method 'text', but I can't seem to get any text printed when
the result of a call to scatterplot is a bunch of boxplots.  

I don't know how boxplots end up being generated (I like it though) in a
call to car:scatterplot.  The same data in ggobi would show the standard
scatterplot with data aligned vertically in lines along the values of the x
(factor) variable but car:scatterplot draws nice boxes around the data as a
bonus.  I guess I'll need to follow with some debugging tool.  I find it odd
that mtext works though.  Or maybe some graphics parameter is set such that
text doesn't show.

Thanx Greg.
-- 
View this message in context: 
http://www.nabble.com/text-in-boxplots-tf4394528.html#a12553104
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] text in boxplots

2007-09-07 Thread Yves Moisan



6. set the reset.par argument to FALSE in calling scatterplot as it
states in the documentation for scatterplot.  (still look at the help on
'xpd' argment to par if you want to add text to the margins).

Hi Greg,

That seems to have done it partly.  I set it to false once and then I could
see some text afterwards, even with reset.par set to TRUE.  

About my not following posting guidelines, I'm sorry but I thought my
question didn't require me to post code.  I suspected graphics parameter to
be off, so the question was why a difference between mtext and text.  Also,
I mentioned earlier that I had succeeded in writing text to the plot for
regression stats (in the reg function of scatterplot.formula) where I did
use what seem to be the normal tricks [e.g. par(usr)].  I couldn't figure
out why setting new graph variables in the main scatterplot.formula function
in the form of 

usrGlobal - par(usr) 

then calling

text(usrGlobal[2]-50,usrGlobal[4]-50,paste(Moyenne = ,r ...)

did not show any text whereas it did in the reg function.

But of course, pasting code could have been shorter for people to read ;-).

Thanx for your help.  
-- 
View this message in context: 
http://www.nabble.com/text-in-boxplots-tf4394528.html#a12558160
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] text in boxplots

2007-09-06 Thread Yves Moisan

Hi All,

I can't get text to print on a boxplot using the 'text' command.  'mtext'
works, but not 'text'.  Is it a matter of boxplots being drawn over text? 
Pointers appreciated.

TIA,

YVes
-- 
View this message in context: 
http://www.nabble.com/text-in-boxplots-tf4394528.html#a12530892
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Automatic anchors for text boxes

2007-08-31 Thread Yves Moisan

Hi All,

I'm struggling to add text automatically to plots.  I have a series of
scatterplots that I have stored in a script because the underlying data
changes often and the plots need to be regenerated.  I use the scatterplot
function (defined in Rcmd, I believe).  When one of the variables is a
factor, a boxplot is drawn over the scatter of the other variable.  In the
case where x is a factor with 10 values, I'll see 10 vertical boxplots.  So
far, so good.  

I was asked to show other stats on top of those scatterplots, e.g. mean,
number of observations, etc.  I can find those values, but the problem is I
don't know how to put them on the plot, given I don't want to look at each
plot one by one and manually identify the locations where I need to add the
text.  I was wondering if something like a pseudo label (I want to keep the
original axis labels) existed that could be used to anchor a text box ?  Or
maybe a semi-manual approach where I could offset such a pseudo-label
position along the y axis?  Since I know the size of my resulting jpegs, I
could use a constant y offset for the text and they'd be aligned properly
along the x axis because they are labels.   For the mean value, I could draw
a short horizontal line segment across the boxplot, but again I'd have the
problem of tying that line segment to specific x-axis values so they
intersect the right boxplot.  Any clues ?

On a related note, I've added regression lines, again by factor (thanks
scatterplot!), and was asked to write the regression equation in plain text. 
I have between one and 7 lines on the plots, so again how could I
automatically tie a text box, this time to a specific regression line ? 
Maybe that would be easier using a legend, but it would be nice to be able
to write the equation alongside the line.

TIA
-- 
View this message in context: 
http://www.nabble.com/Automatic-anchors-for-text-boxes-tf4360108.html#a12426263
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Saving plot into file

2007-08-31 Thread Yves Moisan



uv wrote:
 
 Hello. I am using R with Mac X11. I am looping through a few hundreds of
 text lines, making a plot() for each of them. I would like to save these
 plots graphical images into separate graphical files and I didn't succeed
 doing that. I would be grateful for any suggestion.
 

Use jpeg or similar functions that redirect graphical output to file, e.g.

jpeg(filename = plot.jpg, width = 800, height = 800,pointsize = 12,
quality = 100, bg = white)
plot(...)
dev.off()

As mentioned in ?jpeg : A plot device is opened: nothing is returned to the
R interpreter so you'll see nothing happening except your next graphics
command will be written to the file.

dev.off() restores the normal R-graphics device.  I usually set the working
directory before redirecting the ouput to a file e.g.
setwd(C:/dir/subdir).  That's useful when you have many plots to generate
and want them stored in different places on your filesystem.

HTH,

yvesm
-- 
View this message in context: 
http://www.nabble.com/Saving-plot-into-file-tf4359947.html#a12426520
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.