Discussion:
Trying to use geom_grid and also geom_tile at the same time
Diego
2013-04-19 21:44:00 UTC
Permalink
Hi! I was trying to plot some data (longitude,latitude,variable) of two
differents years (with geom_grid) and also to import a digital elevation
model (with geom_tile) as a background image for both panels but I have
this error :*Error in eval(expr, envir, enclos) : object 'value' not found*.
I attached the code and the data for reproduce it. Somebody can help me
please? Thank in advance.
--
--
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 ggplot2-/***@public.gmane.org
To unsubscribe: email ggplot2+unsubscribe-/***@public.gmane.org
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Ista Zahn
2013-04-21 14:41:13 UTC
Permalink
X-Received: by 10.50.185.200 with SMTP id fe8mr1252329igc.0.1366555298863;
Sun, 21 Apr 2013 07:41:38 -0700 (PDT)
X-BeenThere: ggplot2-/***@public.gmane.org
Received: by 10.50.153.6 with SMTP id vc6ls1512243igb.42.gmail; Sun, 21 Apr
2013 07:41:33 -0700 (PDT)
X-Received: by 10.68.83.104 with SMTP id p8mr4044692pby.0.1366555293918;
Sun, 21 Apr 2013 07:41:33 -0700 (PDT)
Received: from mail-pb0-x22f.google.com (mail-pb0-x22f.google.com [2607:f8b0:400e:c01::22f])
by gmr-mx.google.com with ESMTPS id qo12si3891256pbb.1.2013.04.21.07.41.33
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Sun, 21 Apr 2013 07:41:33 -0700 (PDT)
Received-SPF: pass (google.com: domain of istazahn-***@public.gmane.org designates 2607:f8b0:400e:c01::22f as permitted sender) client-ip=2607:f8b0:400e:c01::22f;
Received: by mail-pb0-f47.google.com with SMTP id rq13so215454pbb.34
for <ggplot2-/***@public.gmane.org>; Sun, 21 Apr 2013 07:41:33 -0700 (PDT)
X-Received: by 10.66.51.102 with SMTP id j6mr241608pao.210.1366555293822; Sun,
21 Apr 2013 07:41:33 -0700 (PDT)
Received: by 10.68.234.6 with HTTP; Sun, 21 Apr 2013 07:41:13 -0700 (PDT)
In-Reply-To: <abd8937b-e667-4025-bc29-12138b1fb799-/***@public.gmane.org>
X-Original-Sender: istazahn-***@public.gmane.org
X-Original-Authentication-Results: gmr-mx.google.com; spf=pass
(google.com: domain of istazahn-***@public.gmane.org designates 2607:f8b0:400e:c01::22f
as permitted sender) smtp.mail=istazahn-***@public.gmane.org; dkim=pass header.i=@gmail.com
Precedence: list
Mailing-list: list ggplot2-/***@public.gmane.org; contact ggplot2+owners-/***@public.gmane.org
List-ID: <ggplot2.googlegroups.com>
X-Google-Group-Id: 604545605438
List-Post: <http://groups.google.com/group/ggplot2/post?hl=en>, <mailto:ggplot2-/***@public.gmane.org>
List-Help: <http://groups.google.com/support/?hl=en>, <mailto:ggplot2+help-/***@public.gmane.org>
List-Archive: <http://groups.google.com/group/ggplot2?hl=en>
Sender: ggplot2-/***@public.gmane.org
List-Subscribe: <http://groups.google.com/group/ggplot2/subscribe?hl=en>, <mailto:ggplot2+subscribe-/***@public.gmane.org>
List-Unsubscribe: <http://groups.google.com/group/ggplot2/subscribe?hl=en>, <mailto:googlegroups-manage+604545605438+unsubscribe-/***@public.gmane.org>
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.r.ggplot2/7593>

Hi,
Post by Diego
Hi! I was trying to plot some data (longitude,latitude,variable) of two
differents years (with geom_grid)
I assume you mean facet_grid here.

and also to import a digital elevation
Post by Diego
model (with geom_tile) as a background image for both panels but I have this
error :Error in eval(expr, envir, enclos) : object 'value' not found. I
attached the code and the data for reproduce it. Somebody can help me
please? Thank in advance.
Sure. The problem is that you map color to value and size to Area in
the ggplot() call, but neither of those variables exist in the DEM
data.frame. My advice in general is to only specify mappings in the
ggplot call that apply to all subsequent geoms, and specify all others
in the individual geom calls. In your example this looks like

a <- ggplot(meltdata[meltdata$Point!='E',],aes(Longitude,Latitude)) +
geom_point(aes(color=value,size=Area)) +
scale_size_area(max_size=10) +
guides(color=guide_legend(override.aes=list(size=10)))
a <- a + facet_grid(variable ~ .)
a <- a + geom_tile(data=DEM,aes(fill=Altitude))


Best,
Ista
Post by Diego
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
https://github.com/hadley/devtools/wiki/Reproducibility
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
For more options, visit https://groups.google.com/groups/opt_out.
--

Loading...