[R] Plots: I've deleted axes, now to delete space

Adele_Thompson at cargill.com Adele_Thompson at cargill.com
Thu May 19 00:16:55 CEST 2011


I've never used an R command without reading the documentation first. I think that would be impractical. I am not an expert at deciphering the documentation though and I post here because I did in fact read the documentation, do extensive google searches, ask friends/collegues and still find no answer. This forum is not a first resort for me. There is a very bad rep of R forums being notoriously harsh on new comers. I myself do not like when people do not try. In order to avoid this harshness (I have not found this forum any more harsh than your everyday educated R user), I do my own research and ask a question when I get stuck. I realize that people still are upset by my ignorance and that is their choice. I will get better and better at R and less and less likely to run into any of these issues. I am not a programmer or statistician by trade, but I am a learner and thus will continue to improve.

You have not offended me at all as few people have this ability.
Thank you for your help.

Adele

-----Original Message-----
From: bt_jannis at yahoo.de [mailto:bt_jannis at yahoo.de] 
Sent: Wednesday, May 18, 2011 04:53 PM
To: Thompson, Adele - Adele_Thompson at cargill.com
Cc: r-help at r-project.org
Subject: Re: [R] Plots: I've deleted axes, now to delete space

On 05/16/2011 06:18 PM, Adele_Thompson at cargill.com wrote:
> Re-sizing within the dev command works well. I'm not sure why I would need the dev.off(). I have the plot commands run. Then I have the dev.copy2pdf command.
> Thanks again for your help.
>

Well, you really should get into the habit of reading the documentation 
of each of the commands you use. To get familiar with the concept of 
graphics in R (and to answer your question regarding  def.off()) I would 
recommend having a look at some basic textbook about R or one of the 
many tutorials on R available on the web. (googeling "graphics R" gives 
you a really helpful link with the third entry!)

The answer to your question basicly is that you need to tell R that your 
figure is finished (by running def.off() ). Then R can create the file. 
Usually figures are created by a sequence of calls so "R" itself can 
never now whether it would be necessary to add some elements to the plot 
later or not.

Sorry for beeing a bit harsh, but quite often many of the questions here 
on the list can be easily answered by searching documentation, the web 
or getting familiar with the basic R concepts!


HTH
Jannis





> -----Original Message-----
> From: Greg.Snow at imail.org [mailto:Greg.Snow at imail.org]
> Sent: Monday, May 16, 2011 11:11 AM
> To: Thompson, Adele - Adele_Thompson at cargill.com; r-help at r-project.org
> Subject: RE: [R] Plots: I've deleted axes, now to delete space
>
> If your goal is to end up with a pdf file, then I would suggest creating the pdf file directly using the pdf function (you can specify height and width in the function) then run your commands to create the plot and use dev.off() to finish.
>
> You often get different results when writing directly to a file vs doing one of the dev.copy because of some different settings.  In general the dev.copy approach can be a quick and easy solution for a simple graph, but plotting directly to the file tends to work better if you want a quality graph in the file.
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Schatzi
> Sent: Monday, May 16, 2011 8:41 AM
> To: r-help at r-project.org
> Subject: Re: [R] Plots: I've deleted axes, now to delete space
>
> I am outputting the plot to a pdf file using the code:
> dev.copy2pdf(file="testing.pdf")
>
> The plots are too small though unless I first manually increase the size in
> R and then use the dev.copy command. Is there a way to automatically
> increase the window size? I tried fin and din, but those do not seem to work
> or they only increase the size to a certain degree, even though I can
> manually increase it to fill my screen.
>
>
> Schatzi wrote:
>> Thanks all for the replies. I am getting better slowly but surely. I
>> imagine that I will get better at figuring out things as well so I don't
>> have to post as many questions. I do lots of searches, but still cannot
>> figure out how to do everything that I need.
>>
>> The new code is as such:
>> par(mfrow=c(4,7), mar=c(2, 2, 2, 1.5), oma=c(1, 1, 4, 0))
>> for (i in 1:28) {
>> a<-seq(1,3,1)
>> plot(a,a, ann=FALSE, main= "plot of a vs a")
>> }
>> mtext("Plot of a vs a",side=3,outer=TRUE)
>>
>>
>> -----Original Message-----
>> From: murdoch.duncan at gmail.com [mailto:murdoch.duncan at gmail.com]
>> Sent: Friday, May 13, 2011 03:25 PM
>> To: Thompson, Adele - Adele_Thompson at cargill.com
>> Cc: Greg.Snow at imail.org; r-help at r-project.org
>> Subject: Re: [R] Plots: I've deleted axes, now to delete space
>>
>> On 11-05-13 4:21 PM, Adele_Thompson at cargill.com wrote:
>>> Easy fix. Under ?par, I don't see where I can enter an overall title.
>>> Should I add a text command or something?
>> mtext() writes text in the margins; argument "outer" puts it in the
>> outer margins.
>>
>> Duncan Murdoch
>>
>>> -----Original Message-----
>>> From: Greg.Snow at imail.org [mailto:Greg.Snow at imail.org]
>>> Sent: Friday, May 13, 2011 03:17 PM
>>> To: Thompson, Adele - Adele_Thompson at cargill.com; r-help at r-project.org
>>> Subject: RE: [R] Plots: I've deleted axes, now to delete space
>>>
>>> Look at the help for par, specifically the section on 'mar' to set the
>>> per plot margins smaller and the section on 'oma' to leave room for the
>>> overall title.
>>>
>> ______________________________________________
>> R-help at 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> -----
> In theory, practice and theory are the same. In practice, they are not - Albert Einstein
> --
> View this message in context: http://r.789695.n4.nabble.com/Plots-I-ve-deleted-axes-now-to-delete-space-tp3521078p3526379.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list