Re: [R] vjust unresponsive (ggplot2)

2015-12-23 Thread Hadley Wickham
vjust was always a hack that I never thought should work. The margins
parameter is the correct way to solve this problem as of ggplot2 2.0.0.

Hadley

On Tuesday, December 22, 2015, Nordlund, Dan (DSHS/RDA) <nord...@dshs.wa.gov>
wrote:

> Ista,
>
> You are correct, I was not at the latest release of ggplot2.  I updated to
> the latest version and am now seeing the same result as you and the OP.  So
> it does look like an issue with the latest version of ggplot2.
>
> Dan
>
> Daniel Nordlund, PhD
> Research and Data Analysis Division
> Services & Enterprise Support Administration
> Washington State Department of Social and Health Services
>
>
> > -Original Message-
> > From: Ista Zahn [mailto:istaz...@gmail.com <javascript:;>]
> > Sent: Tuesday, December 22, 2015 10:48 AM
> > To: Nordlund, Dan (DSHS/RDA)
> > Cc: r-help@r-project.org <javascript:;>
> > Subject: Re: [R] vjust unresponsive (ggplot2)
> >
> > Hi Dan,
> >
> > Chances are that you haven't yet upgraded to ggplot2 version 2.0. unit
> (as
> > well as arrow and alpha) are now re-exported from ggplot2.
> >
> > Using the latest release I also see that vjust doesn't seem to do
> anything.
> >
> > Best,
> > Ista
> >
> > On Tue, Dec 22, 2015 at 1:37 PM, Nordlund, Dan (DSHS/RDA)
> > <nord...@dshs.wa.gov <javascript:;>> wrote:
> > > Are you sure it is not working for you?  Your example code did not
> work for
> > me at all until I removed the plot .margin  parameter (unit wasn't
> > recognized).  Once I did that hjust and vjust worked as expected.
> However,
> > values between .1 and .9 for vjust don't really move the axis title very
> much
> > so it may not be real noticeable.  Try a value like 2 or 3, just to make
> sure you
> > easily see the change in position before concluding that nothing is
> > happening.
> > >
> > > Dan
> > >
> > > Daniel Nordlund, PhD
> > > Research and Data Analysis Division
> > > Services & Enterprise Support Administration Washington State
> > > Department of Social and Health Services
> > >
> > >
> > > -Original Message-
> > > From: R-help [mailto:r-help-boun...@r-project.org <javascript:;>] On
> Behalf Of Ryan
> > > Utz
> > > Sent: Tuesday, December 22, 2015 10:00 AM
> > > To: r-help@r-project.org <javascript:;>
> > > Subject: [R] vjust unresponsive (ggplot2)
> > >
> > > Hi all,
> > >
> > > I cannot for the life of me get my axis titles to adjust vertically in
> a ggplot.
> > I've seen several posts about this and have tried everything:
> > > keeping vjust within 0 and 1, adjusting the margins, etc. hjust is
> behaving
> > just as it should but vjust just mocks me in silence. No error message is
> > produced.
> > >
> > > Here's a sample code:
> > >
> > > x=data.frame(sample(1:10))
> > > x[,2]=sample(1:10)
> > >
> > > ggplot(data=x,aes(x=V2,y=V2))+theme(axis.title.y=element_text(vjust=.1
> > > ,hjust=0.6),
> > > plot.margin=unit(c(1,1,2,2),'cm'))
> > >
> > > No matter what I put into vjust, nothing happens. Am I missing
> something
> > obvious??
> > >
> > > Thanks ahead of time for any help,
> > > Ryan
> > >
> > >
> > > --
> > >
> > > Ryan Utz, Ph.D.
> > > Assistant professor of water resources
> > > *chatham**UNIVERSITY*
> > > Home/Cell: (724) 272-7769
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > __
> > > R-help@r-project.org <javascript:;> mailing list -- To UNSUBSCRIBE
> and more, see
> > > 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.
> > >
> > > __
> > > R-help@r-project.org <javascript:;> mailing list -- To UNSUBSCRIBE
> and more, see
> > > 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.
> __
> R-help@r-project.org <javascript:;> mailing list -- To UNSUBSCRIBE and
> more, see
> 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.
>


-- 
http://had.co.nz/

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] vjust unresponsive (ggplot2)

2015-12-22 Thread Ista Zahn
Hi Dan,

Chances are that you haven't yet upgraded to ggplot2 version 2.0. unit
(as well as arrow and alpha) are now re-exported from ggplot2.

Using the latest release I also see that vjust doesn't seem to do anything.

Best,
Ista

On Tue, Dec 22, 2015 at 1:37 PM, Nordlund, Dan (DSHS/RDA)
 wrote:
> Are you sure it is not working for you?  Your example code did not work for 
> me at all until I removed the plot .margin  parameter (unit wasn't 
> recognized).  Once I did that hjust and vjust worked as expected.  However, 
> values between .1 and .9 for vjust don't really move the axis title very much 
> so it may not be real noticeable.  Try a value like 2 or 3, just to make sure 
> you easily see the change in position before concluding that nothing is 
> happening.
>
> Dan
>
> Daniel Nordlund, PhD
> Research and Data Analysis Division
> Services & Enterprise Support Administration
> Washington State Department of Social and Health Services
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ryan Utz
> Sent: Tuesday, December 22, 2015 10:00 AM
> To: r-help@r-project.org
> Subject: [R] vjust unresponsive (ggplot2)
>
> Hi all,
>
> I cannot for the life of me get my axis titles to adjust vertically in a 
> ggplot. I've seen several posts about this and have tried everything:
> keeping vjust within 0 and 1, adjusting the margins, etc. hjust is behaving 
> just as it should but vjust just mocks me in silence. No error message is 
> produced.
>
> Here's a sample code:
>
> x=data.frame(sample(1:10))
> x[,2]=sample(1:10)
>
> ggplot(data=x,aes(x=V2,y=V2))+theme(axis.title.y=element_text(vjust=.1,hjust=0.6),
> plot.margin=unit(c(1,1,2,2),'cm'))
>
> No matter what I put into vjust, nothing happens. Am I missing something 
> obvious??
>
> Thanks ahead of time for any help,
> Ryan
>
>
> --
>
> Ryan Utz, Ph.D.
> Assistant professor of water resources
> *chatham**UNIVERSITY*
> Home/Cell: (724) 272-7769
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> 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.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] vjust unresponsive (ggplot2)

2015-12-22 Thread Nordlund, Dan (DSHS/RDA)
Are you sure it is not working for you?  Your example code did not work for me 
at all until I removed the plot .margin  parameter (unit wasn't recognized).  
Once I did that hjust and vjust worked as expected.  However, values between .1 
and .9 for vjust don't really move the axis title very much so it may not be 
real noticeable.  Try a value like 2 or 3, just to make sure you easily see the 
change in position before concluding that nothing is happening.

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ryan Utz
Sent: Tuesday, December 22, 2015 10:00 AM
To: r-help@r-project.org
Subject: [R] vjust unresponsive (ggplot2)

Hi all,

I cannot for the life of me get my axis titles to adjust vertically in a 
ggplot. I've seen several posts about this and have tried everything:
keeping vjust within 0 and 1, adjusting the margins, etc. hjust is behaving 
just as it should but vjust just mocks me in silence. No error message is 
produced.

Here's a sample code:

x=data.frame(sample(1:10))
x[,2]=sample(1:10)

ggplot(data=x,aes(x=V2,y=V2))+theme(axis.title.y=element_text(vjust=.1,hjust=0.6),
plot.margin=unit(c(1,1,2,2),'cm'))

No matter what I put into vjust, nothing happens. Am I missing something 
obvious??

Thanks ahead of time for any help,
Ryan


-- 

Ryan Utz, Ph.D.
Assistant professor of water resources
*chatham**UNIVERSITY*
Home/Cell: (724) 272-7769

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] vjust unresponsive (ggplot2)

2015-12-22 Thread Ista Zahn
That looks to me like it might be buggy. At least I would have
expected vjust to do _something_.

In terms of the practical issue, you can adjust the distance between
the title and the axis with margin, e.g.

ggplot(data=x,aes(x=V2,y=V2))+theme(axis.title.y=element_text(margin =
margin(0, 5, 0, 0)))

Best,
Ista

On Tue, Dec 22, 2015 at 12:59 PM, Ryan Utz  wrote:
> Hi all,
>
> I cannot for the life of me get my axis titles to adjust vertically in a
> ggplot. I've seen several posts about this and have tried everything:
> keeping vjust within 0 and 1, adjusting the margins, etc. hjust is behaving
> just as it should but vjust just mocks me in silence. No error message is
> produced.
>
> Here's a sample code:
>
> x=data.frame(sample(1:10))
> x[,2]=sample(1:10)
>
> ggplot(data=x,aes(x=V2,y=V2))+theme(axis.title.y=element_text(vjust=.1,hjust=0.6),
> plot.margin=unit(c(1,1,2,2),'cm'))
>
> No matter what I put into vjust, nothing happens. Am I missing something
> obvious??
>
> Thanks ahead of time for any help,
> Ryan
>
>
> --
>
> Ryan Utz, Ph.D.
> Assistant professor of water resources
> *chatham**UNIVERSITY*
> Home/Cell: (724) 272-7769
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] vjust unresponsive (ggplot2)

2015-12-22 Thread Nordlund, Dan (DSHS/RDA)
Ista,

You are correct, I was not at the latest release of ggplot2.  I updated to the 
latest version and am now seeing the same result as you and the OP.  So it does 
look like an issue with the latest version of ggplot2.

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services


> -Original Message-
> From: Ista Zahn [mailto:istaz...@gmail.com]
> Sent: Tuesday, December 22, 2015 10:48 AM
> To: Nordlund, Dan (DSHS/RDA)
> Cc: r-help@r-project.org
> Subject: Re: [R] vjust unresponsive (ggplot2)
> 
> Hi Dan,
> 
> Chances are that you haven't yet upgraded to ggplot2 version 2.0. unit (as
> well as arrow and alpha) are now re-exported from ggplot2.
> 
> Using the latest release I also see that vjust doesn't seem to do anything.
> 
> Best,
> Ista
> 
> On Tue, Dec 22, 2015 at 1:37 PM, Nordlund, Dan (DSHS/RDA)
> <nord...@dshs.wa.gov> wrote:
> > Are you sure it is not working for you?  Your example code did not work for
> me at all until I removed the plot .margin  parameter (unit wasn't
> recognized).  Once I did that hjust and vjust worked as expected.  However,
> values between .1 and .9 for vjust don't really move the axis title very much
> so it may not be real noticeable.  Try a value like 2 or 3, just to make sure 
> you
> easily see the change in position before concluding that nothing is
> happening.
> >
> > Dan
> >
> > Daniel Nordlund, PhD
> > Research and Data Analysis Division
> > Services & Enterprise Support Administration Washington State
> > Department of Social and Health Services
> >
> >
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ryan
> > Utz
> > Sent: Tuesday, December 22, 2015 10:00 AM
> > To: r-help@r-project.org
> > Subject: [R] vjust unresponsive (ggplot2)
> >
> > Hi all,
> >
> > I cannot for the life of me get my axis titles to adjust vertically in a 
> > ggplot.
> I've seen several posts about this and have tried everything:
> > keeping vjust within 0 and 1, adjusting the margins, etc. hjust is behaving
> just as it should but vjust just mocks me in silence. No error message is
> produced.
> >
> > Here's a sample code:
> >
> > x=data.frame(sample(1:10))
> > x[,2]=sample(1:10)
> >
> > ggplot(data=x,aes(x=V2,y=V2))+theme(axis.title.y=element_text(vjust=.1
> > ,hjust=0.6),
> > plot.margin=unit(c(1,1,2,2),'cm'))
> >
> > No matter what I put into vjust, nothing happens. Am I missing something
> obvious??
> >
> > Thanks ahead of time for any help,
> > Ryan
> >
> >
> > --
> >
> > Ryan Utz, Ph.D.
> > Assistant professor of water resources
> > *chatham**UNIVERSITY*
> > Home/Cell: (724) 272-7769
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.