Re: a stupid doubt using geom_text...

35 views
Skip to first unread message

Ista Zahn

unread,
Sep 27, 2012, 3:16:45 PM9/27/12
to Guillermo Bueno, ggp...@googlegroups.com
I think you are looking for ?annotate

Best,
Ista

On Thu, Sep 27, 2012 at 1:37 PM, Guillermo Bueno <cgbu...@gmail.com> wrote:
I have the following plot:

caption <- paste(strwrap("Disturbance intensity of 4.95 cubic meters"))

qplot(INT,Fit.NH4,  data=suelo.int, geom ="smooth",
      ylab="Fitted Values", xlab="log(Disturbance intensity)"
      , main=expression(paste(plain("Ammonium concentration (") * mu
      , plain("g N/g resin)")))) + geom_vline(xintercept = 1.6, colour="black")
      + geom_text(aes(label=caption), position c(x=1.3,y=1))
Inline images 1

the error says something like: "no valid argument for a unitary operator"

I want to add the text vertically to the vertical line that I've created.

any suggestion?

thanks a lot in advance!!
Guillermo

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

Guillermo Bueno

unread,
Sep 27, 2012, 3:52:15 PM9/27/12
to ggp...@googlegroups.com
Hi Izanh!
Thanks a lot!
I've tried, changing the yellow line by: + annotate("text", x=1.2,y=1, label = caption, angle =90)   
but I got the same result...

I attached my data just in case it would be easier to take a look...

Fit.NH4 <- c(0.35520367173899, 0.0538584393600996, 0.0485146414085732, 
  0.0508540898366614, 0.0485441900478153, 0.0499430157105871, 0.0497433288294424, 
  0.0483937725127202, 0.0484547514445964, 0.0481047541622947, 0.0593897136677188, 
  0.0719382514781735, 0.0675033861901799, 0.0657861453581993, 0.0718704630077218, 
  0.0541361495650854, 0.0545039079580982, 0.0591482115062317, 0.805037501226607, 
  0.0549591942533534, 0.178145802807577, 0.519648196944217, 0.186769999154143, 
  0.185045802386719, 0.181643080569884, 0.17890075256435, 0.182653677358267, 
  0.176868083921691, 0.176763895092758, 0.542045292558277, 0.217407397830125, 
  0.206521592149069, 0.18964193169518, 0.186051332187429, 0.180996201684384, 
  0.209886575666937, 0.208637568567034, 0.329750203257229, 0.191955525182697, 
  0.185034721131341, 0.722294407621629, 0.47117728362253, 0.678064951539754, 
  0.471018278959283, 0.471280978784221, 0.470686953640362, 0.471821146602239, 
  0.470799453610216, 0.598456880525459, 0.479723748518597, 0.487850469570779, 
  0.601871301900123, 0.609167509780403, 0.486405615808631, 0.482816666918098, 
  0.479377078915839, 0.492716623763559, 0.519391730790561, 0.470396050994993, 
  0.539698199204661, 0.450614375442907, 0.70645353520743, 0.449803385803399, 
  0.435379176146784, 0.575073792776309, 0.443698564525391, 0.463085827916822, 
  0.446274115223569, 0.431596962685107, 0.479616858064326, 0.559192492658776, 
  0.439194998992426, 0.676131207311357, 0.444409760096976, 0.446587816867162, 
  0.55134948993397, 0.442351376600115, 0.462132829889953, 0.458360890813375, 
  0.538986321763719, 1.71377930665621, 1.69578848868802, 1.74402735242899, 
  1.93259344183095, 1.53641921266261, 1.58483494975849, 1.54909370525429, 
  1.66062844998062, 1.5881085646352, 1.94055151179116, 1.69348403966456, 
  1.90414032219993, 1.75792447035395, 1.63796793421457, 1.80521487685501, 
  1.80047990235977, 1.90722543322325, 1.9813164415883, 1.72191594111563, 
  1.79143038005598)

INT <- c(1.7404661748405, 1.71559810826249, 0.122217632724249, 0.819779831493311, 
         0.131028262406404, 0.548121408509688, 0.488580014818671, 0.0861776962410524, 
         0.104360015324243, 0, 3.36487911898804, 7.10652416715469, 5.78416358660301, 
         5.2721273834578, 7.08631142216243, 1.79840401194672, 1.90805992492422, 
         3.29286950477653, 2.21375387928743, 2.04381436403668, 0.27002713721306, 
         0.336472236621213, 1.89311196348834, 1.56861591791385, 0.928219302739429, 
         0.412109650826833, 1.11841491596429, 0.0295588022415444, 0.00995033085316809, 
         0.00995033085316809, 4.10379972099286, 5.61038712705665, 2.43361335540045, 
         1.75785791755237, 0.806475865866949, 6.2436813459079, 6.00861660592555, 
         5.25879660838575, 2.86903462050803, 1.56653041142282, 2.52572864430826, 
         0.131028262406404, 0.0198026272961797, 0.104360015324243, 0.148420005118273, 
         0.048790164169432, 0.2390169004705, 0.0676586484738149, 0.932164081030445, 
         1.56444054650336, 2.9274534328007, 3.43463215774839, 1.23256026117785, 
         2.68512269645851, 2.08318452795867, 1.50629715351459, 3.74360435380318, 
         3.23474917402449, 0, 3.55962461825667, 4.39011880457122, 6.27266943783546, 
         4.25277179881662, 1.8099267731835, 4.52742483736324, 3.2188758248682, 
         6.50225017007395, 3.65506410561921, 1.16938135955632, 5.31492863235323, 
         2.88312332917134, 2.45616418092235, 2.62900699376176, 3.33932197794407, 
         3.70819176514631, 4.13676527810605, 2.99071973173045, 6.34085300899574, 
         5.70204763736248, 6.06141029779465, 1.61740608208328, 1.50851199384414, 
         1.76644166124377, 1.0952733874026, 1.82454929205105, 1.41342302850814, 
         2.12704052047911, 0.518793793415168, 0.657520002916794, 1.23837423104327, 
         1.09192330051731, 6.89142262436124, 5.26888855585722, 7.63721992388254, 
         5.65178717953782, 3.61091791264422, 3.18511219471539, 5.72031177660741, 
         4.20826830854041, 3.37451111639965)
suelo.int <- data.frame(cbind(INT,Fit.NH4))

Hadley Wickham

unread,
Sep 27, 2012, 3:56:34 PM9/27/12
to Guillermo Bueno, ggp...@googlegroups.com
You need to put the + on the previous line
Hadley

On Thu, Sep 27, 2012 at 7:37 PM, Guillermo Bueno <cgbu...@gmail.com> wrote:
I have the following plot:

caption <- paste(strwrap("Disturbance intensity of 4.95 cubic meters"))

qplot(INT,Fit.NH4,  data=suelo.int, geom ="smooth",
      ylab="Fitted Values", xlab="log(Disturbance intensity)"
      , main=expression(paste(plain("Ammonium concentration (") * mu
      , plain("g N/g resin)")))) + geom_vline(xintercept = 1.6, colour="black")
      + geom_text(aes(label=caption), position c(x=1.3,y=1))
Inline images 1

the error says something like: "no valid argument for a unitary operator"

I want to add the text vertically to the vertical line that I've created.

any suggestion?

thanks a lot in advance!!
Guillermo

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2



--
RStudio / Rice University
http://had.co.nz/

Guillermo Bueno

unread,
Sep 27, 2012, 4:06:07 PM9/27/12
to Hadley Wickham, ggp...@googlegroups.com
Thanks!
perfect!!
Guillermo
--
C. Guillermo Bueno, PhD
Department of Biological Sciences
CW 405, Biological Sciences Bldg. University of Alberta
Edmonton, Alberta,T6G 2E9 Canada
-----------------------------
Pyrenean Institute of Ecology
Avda. Nuestra Señora de la Victoria s/n, P.O. Box 64, 22700 Jaca (Spain)

Reply all
Reply to author
Forward
0 new messages