Here's the code. The problem seems to be specific for lattice as I can 
easily use a vector with pos in "plot".

trellis.device(,width=600, height = 400)
xyplot(Npop~Narea,
scales=list(x=list(log=TRUE, at=my.at,labels = formatC(my.at, big.mark = 
",", format="d")),
y=list(log=TRUE, at=c(1,10,100,1000,10000,100000,1000000))),
panel=function(...) {
     panel.xyplot(..., type="p", col="black", cex=.5, pch=20)
     panel.text(x=log10(Narea), y=log10(Npop), lab=t,  cex=.5, pos=c(4,2))
         }

)

On 10/10/2011 13:58, Carlos Ortega wrote:
> Hi Allan,
>
> Please could you send the modified code where now it should appear x 
> and y coordinates?.
> I do not fully understand the error message you get.
>
> Regards,
> Carlos Ortega
> www.qualityexcellence.es <http://www.qualityexcellence.es>
>
> 2011/10/10 Allan Sikk <a.s...@ucl.ac.uk <mailto:a.s...@ucl.ac.uk>>
>
>     Thanks, Carlos,
>
>     Tried that, but no success, still getting this error message:
>
>     Warning messages:
>     1: In if (pos == 1) { :
>       the condition has length > 1 and only the first element will be used
>     2: In if (pos == 2) { :
>       the condition has length > 1 and only the first element will be used
>
>     Thanks,
>     Allan
>
>     On 10/10/2011 12:10, Carlos Ortega wrote:
>     > Hello,
>     >
>     > To check the possible values of "pos" parameter you need to review
>     > "text()" as it is indicated in the lattice help of panel.text().
>     > In  text() it says:
>     >
>     > |pos|
>     >
>     > a position specifier for the text. If specified this overrides any
>     > |adj| value given. Values of |1|, |2|, |3| and |4|, respectively
>     > indicate positions below, to the left of, above and to the right of
>     > the specified coordinates.
>     >
>     >
>     > So, the coordinates should be "x=4, y=2" for your case.
>     > Additionally you can use ltext() function which is explained in the
>     > same panel.text() help.
>     >
>     >
>     > Regards,
>     > Carlos Ortega
>     > www.qualityexcellence.es <http://www.qualityexcellence.es>
>     <http://www.qualityexcellence.es>
>     >
>     > 2011/10/10 Allan Sikk <a.s...@ucl.ac.uk
>     <mailto:a.s...@ucl.ac.uk> <mailto:a.s...@ucl.ac.uk
>     <mailto:a.s...@ucl.ac.uk>>>
>     >
>     >     Hi,
>     >
>     >     I need to vary the placements of data labels but I cannot
>     assign a
>     >     vector to "pos" option. Any vectors work fine with "cex", for
>     >     example. What could be the problem here?
>     >
>     >     xyplot(Npop~Narea, data=size,
>     >     scales=list(x=list(log=TRUE), y=list(log=TRUE),
>     >     xlab=expression(N[A]), ylab=expression(N[P]),
>     >     panel=function( ...) {
>     >        panel.lines(..., type="l", col.line="black", lwd=.25)
>     >        panel.xyplot(..., type="p", col="black", cex=.5, pch=20)
>     >        panel.text(..., lab=t, cex=.5, pos=c(4,2))
>     >     })
>     >
>     >     Many thanks,
>     >     Allan
>     >
>     >     ______________________________________________
>     > R-help@r-project.org <mailto:R-help@r-project.org>
>     <mailto:R-help@r-project.org <mailto:R-help@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.
>     >
>     >
>
>     --
>
>     DrAllan Sikk
>
>     Lecturer in Baltic Politics
>
>     University College London, School of Slavonic and East European
>     Studies
>
>     16 Taviton St, London WC1H 0BW, United Kingdom
>
>     tel: +44 (0)20 7679 4872 <tel:%2B44%20%280%2920%207679%204872>
>
>     http://www.homepages.ucl.ac.uk/~tjmsasi/
>     <http://www.homepages.ucl.ac.uk/%7Etjmsasi/>
>
>     Latest research:
>
>     - 'Newness as a Winning Formula for New Political Parties', /Party
>     Politics/, forthcoming.
>
>     - 'Parties and Populism', Centre for European Politics, Security and
>     Integration (CEPSI) Working Paper (2010),
>     http://bit.ly/partiespopulism.
>
>     - (with Rein Taagepera) 'Parsimonius Model for Predicting Mean Cabinet
>     Duration on the Basis of Electoral System', /Party Politics/, 16(2),
>     2010, 261-81.
>
>     - 'Force Mineure?The Effects of the EU on Party Politics in a Small
>     Country: The Case of Estonia,' /Journal of Communist Studies and
>     Transition Politics/, 25(4), 2009, 468-90.
>
>     - (with Rune Andersen) 'Without a Tinge of Red: The Fall and Rise of
>     Estonian Greens, 1987-2007', /Journal of Baltic Studies/, 40(3), 2009,
>     349-73.
>
>
>            [[alternative HTML version deleted]]
>
>     ______________________________________________
>     R-help@r-project.org <mailto:R-help@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.
>
>

-- 

DrAllan Sikk

Lecturer in Baltic Politics

University College London, School of Slavonic and East European Studies

16 Taviton St, London WC1H 0BW, United Kingdom

tel: +44 (0)20 7679 4872

http://www.homepages.ucl.ac.uk/~tjmsasi/

Latest research:

- 'Newness as a Winning Formula for New Political Parties', /Party 
Politics/, forthcoming.

- 'Parties and Populism', Centre for European Politics, Security and 
Integration (CEPSI) Working Paper (2010), http://bit.ly/partiespopulism.

- (with Rein Taagepera) 'Parsimonius Model for Predicting Mean Cabinet 
Duration on the Basis of Electoral System', /Party Politics/, 16(2), 
2010, 261-81.

- 'Force Mineure?The Effects of the EU on Party Politics in a Small 
Country: The Case of Estonia,' /Journal of Communist Studies and 
Transition Politics/, 25(4), 2009, 468-90.

- (with Rune Andersen) 'Without a Tinge of Red: The Fall and Rise of 
Estonian Greens, 1987-2007', /Journal of Baltic Studies/, 40(3), 2009, 
349-73.


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to