problem about ggplot2

2,753 views
Skip to first unread message

Jiang, Yuan-yuan(AWF)

unread,
Mar 21, 2013, 4:39:45 AM3/21/13
to ggp...@googlegroups.com

Hi all,

When I run the R code in Shell to draw the graph , it shows the following mistake:

‘Error in structure(list(call = match.call(), aesthetics = aesthetics,  :

  object 'percent' not found

Calls: drawCI ... scale_y_continuous -> continuous_scale -> structure

Execution halted’

 

The function I use  to draw the graph is:

if(nrow(ExpInfo) == 3) {

             title <- paste('(',as.character(ExpInfo$Name[1]), ", version: ",as.character(vrsn),')',sep='')

    }

   

    df = as.data.frame(forplot)

        

    df$metric = as.factor(unlist(df$metric))

    df$lift = unlist(df$lift)

    df$name = unlist(df$name)

   

    g = ggplot(df, aes(metric, lift))

    g + scale_x_discrete(name='Metrics',

                    breaks=n,

                    labels=displayname

            ) + scale_colour_hue(name='Legend') + scale_y_continuous('Lift',  label = percent) + opts(title = paste(expID, title, rawStr), axis.text.x=theme_text(angle=90)) + stat_summary(

                    fun.y = function(x) median(x),

                    fun.ymin = function(x) min(x),

                    fun.ymax = function(x) max(x),

                    geom='pointrange', aes(color=name), position=position_dodge(width=0.20)) + geom_hline(aes(yintercept=0), colour='#AA0000')

    ggsave(file=plotfile, width=15, height=6)

 

 

Thanks,

yuanyuan

Roman Luštrik

unread,
Mar 21, 2013, 9:35:58 AM3/21/13
to Jiang, Yuan-yuan(AWF), ggp...@googlegroups.com
Can you show us str() of df?

Cheers,
Roman



--
--
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
 
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
In God we trust, all others bring data.

adam.l...@pnc.com

unread,
Mar 21, 2013, 12:44:25 PM3/21/13
to Jiang, Yuan-yuan(AWF), ggp...@googlegroups.com
Hi,

Try "library(scales)", which you need to use the percent label.  





Adam Loveland





From: "Jiang, Yuan-yuan(AWF)" <yuan...@ebay.com>
To: "ggp...@googlegroups.com" <ggp...@googlegroups.com>
Date: 03/21/2013 09:27 AM
Subject: problem about ggplot2
Sent by: ggp...@googlegroups.com




--

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example:



To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options:
http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.


The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US Law. The postal address for PNC is 249 Fifth Avenue, Pittsburgh, PA 15222. If you do not wish to receive any additional advertising or promotional messages from PNC at this e-mail address, click here to unsubscribe. https://pnc.p.delivery.net/m/u/pnc/uni/p.asp
By unsubscribing to this message, you will be unsubscribed from all advertising or promotional messages from PNC. Removing your e-mail address from this mailing list will not affect your subscription to alerts, e-newsletters or account servicing e-mails.


Reply all
Reply to author
Forward
0 new messages