[R] R syntax, space smaller than space

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue May 20 15:21:19 CEST 2008



Duncan Murdoch wrote:
> On 5/20/2008 6:52 AM, Torsten Wiebke wrote:
>> Hallo,
>> does nobody have an answer?
>>> I changed something in the package "climatol" especially in the
>>> function "diagwl". Dos anybody know where I can put the code in the
>>> Internet to discuss it?
>> I put it to: http://de.pastebin.ca/1023676
>> It would be kind if someone can have a look what is to make better.
> 
> It would be helpful if you created a 2 or 3 line example illustrating 
> your problem.  The link you posted is very long, and it is probably 
> discouraging people from even looking at it.  I know it discouraged me.
>>
>> Pleas give me a hint where I can search to answer this questions:
>>> But "mtext(paste(round(mean(tm*10))/10, ' °', "C ",round(sum(p)),"
>>> mm",sep="")" makes the ° and the C very short together. There is no
>>> space. How can I fill a space in there which is smaller as a normal
>>> space?
> 
> I don't believe it's possible.  You can have no space, or a full space.


Indeed, but if you use mathematical annotation you wil have more 
control. See ?plotmath for details.

Some examples:

plot(1:10, main =
     substitute(tm2 * degree * "C, " * p2 * "mm",
         list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p)))))


plot(1:10, main =
     substitute(tm2 * degree ~~ "C, " * p2 * "mm",
         list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p)))))

plot(1:10, main =
     substitute(tm2 * degree * phantom(".") * "C, " * p2 * "mm",
         list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p)))))

plot(1:10, main =
     substitute(tm2 * degree * phantom("m") * "C, " * p2 * "mm",
         list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p)))))

Best wishes,
Uwe Ligges



>>>
>>> Also I made more transparency in the  colours with: sfcol= rgb(0, 0, 
>>> 0,alpha =0.2)
>>> Is there a possibility to safe the diagram as *png (because of the
>>> transparancy) ?
>> Or an other format. I want to put it in an LaTeX file. With the pdf 
>> output I have to burst
>> it in two pages and to experiment with the "trim" function of the
>> includegraphicx package (\includegraphics[%
>> trim= 270 280 200 200,
>> scale=0.167,
>> ]{../FotosBilder/Bilder/Klimadig/angermuendeklidig}) Is there a
>> possibility to get only one pdf page only with the graphick, bet is
>> that textwidth the same as picturwidth is.
> 
> There are two independent sets of measurements when you are including R 
> graphics in LaTeX.  There is the set that R knows about:  it determines 
> how big the fonts are relative to the plot region, how big points are, 
> etc.  Then there is the size within LaTeX.  There doesn't need to be any 
> connection between them.
> 
> What I normally do is plot slightly larger than I intend to display the 
> graphic, then use "\includegraphics[width=\textwidth]{graphic}" to 
> include it.  I find that this makes the fonts slightly smaller, and they 
> seem to be more consistent with the style of a paper.
> 
> Duncan Murdoch
> 
> ______________________________________________
> 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