Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
manually condense the legend
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peng Zhang  
View profile  
 More options Sep 18 2012, 4:26 pm
From: Peng Zhang <pczh...@gmail.com>
Date: Tue, 18 Sep 2012 13:26:41 -0700 (PDT)
Local: Tues, Sep 18 2012 4:26 pm
Subject: manually condense the legend

Dear all,

I am plotting paths for seven subgroup (g). I specify color=g, so they will
have different colors. Next I want to enhance one of them by choosing
different size for one of seven subgroups, I then create a manual scale for
size according to g==1.

In the plot, I will have both legends for color and size. My question is if
there is a way that I can manually condense those two legends into one.
(six lines with the regular size and different colors and one more line
with enhanced size and another color)

Thanks,
Peng


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kohske Takahashi  
View profile  
 More options Sep 26 2012, 6:15 pm
From: Kohske Takahashi <takahashi.koh...@gmail.com>
Date: Thu, 27 Sep 2012 07:14:55 +0900
Local: Wed, Sep 26 2012 6:14 pm
Subject: Re: manually condense the legend
Could you please provide a reproducible example:
https://github.com/hadley/devtools/wiki/Reproducibility

2012/9/19 Peng Zhang <pczh...@gmail.com>:

--
Kohske Takahashi <takahashi.koh...@gmail.com>

Assistant Professor,
Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peng Zhang  
View profile  
 More options Sep 26 2012, 9:56 pm
From: Peng Zhang <pczh...@gmail.com>
Date: Wed, 26 Sep 2012 21:56:07 -0400
Local: Wed, Sep 26 2012 9:56 pm
Subject: Re: manually condense the legend
Thank you for your reply.

The following small code gives me two legends (one for color and one for
size). Is it possible that I only have one legend?

thick red line  ----  Cubic
thin green line ---- Linear
thick blue line ----- Quadratic

Thanks,
Peng

x = 1:9
a = rep(x, 3)
b = c(x, x^2, x^3)
col = c(rep("Linear", 9), rep("Quadratic", 9), rep("Cubic", 9))
size = c(rep("Linear", 9), rep("Non-Linear", 18))

d = data.frame(a, b, col, size)
library(ggplot2)
ggplot(data = d, aes(a, b, color = col, size = size)) + geom_path() +
labs(color = "", size = "")

On 09/26/2012 06:14 PM, Kohske Takahashi wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kohske Takahashi  
View profile  
 More options Sep 26 2012, 9:59 pm
From: Kohske Takahashi <takahashi.koh...@gmail.com>
Date: Thu, 27 Sep 2012 10:58:58 +0900
Local: Wed, Sep 26 2012 9:58 pm
Subject: Re: manually condense the legend
you can suppress to show guide by

ggplot(data = d, aes(a, b, color = col, size = size)) + geom_path() +
labs(color = "", size = "") + guides(size = "none")

2012/9/27 Peng Zhang <pczh...@gmail.com>:

> x = 1:9
> a = rep(x, 3)
> b = c(x, x^2, x^3)
> col = c(rep("Linear", 9), rep("Quadratic", 9), rep("Cubic", 9))
> size = c(rep("Linear", 9), rep("Non-Linear", 18))

> d = data.frame(a, b, col, size)
> library(ggplot2)
> ggplot(data = d, aes(a, b, color = col, size = size)) + geom_path() +
> labs(color = "", size = "")

--
Kohske Takahashi <takahashi.koh...@gmail.com>

Assistant Professor,
Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peng Zhang  
View profile  
 More options Sep 26 2012, 10:06 pm
From: Peng Zhang <pczh...@gmail.com>
Date: Wed, 26 Sep 2012 22:06:03 -0400
Local: Wed, Sep 26 2012 10:06 pm
Subject: Re: manually condense the legend
Thanks. I kind of still want size, but to show it together with color.
(by changing the size of line in the color legend)

Best,
Peng

On 09/26/2012 09:58 PM, Kohske Takahashi wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kohske Takahashi  
View profile  
 More options Sep 26 2012, 10:16 pm
From: Kohske Takahashi <takahashi.koh...@gmail.com>
Date: Thu, 27 Sep 2012 11:16:25 +0900
Local: Wed, Sep 26 2012 10:16 pm
Subject: Re: manually condense the legend
then try this:

x = 1:9
a = rep(x, 3)
b = c(x, x^2, x^3)
col = c(rep("Linear", 9), rep("Quadratic", 9), rep("Cubic", 9))

d = data.frame(a, b, col)
d$col <- factor(d$col, levels = c("Linear", "Quadratic", "Cubic"))
library(ggplot2)
ggplot(data = d, aes(a, b, color = col, size = col)) + geom_path() +
scale_size_manual(labels = levels(d$col), values = c(1, 6, 6))

2012/9/27 Peng Zhang <pczh...@gmail.com>:

--
Kohske Takahashi <takahashi.koh...@gmail.com>

Assistant Professor,
Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peng Zhang  
View profile  
 More options Sep 26 2012, 10:22 pm
From: Peng Zhang <pczh...@gmail.com>
Date: Wed, 26 Sep 2012 22:21:55 -0400
Local: Wed, Sep 26 2012 10:21 pm
Subject: Re: manually condense the legend
That is exactly what I am looking for. Thank you for your help!

Best,
Peng

On 09/26/2012 10:16 PM, Kohske Takahashi wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »