Alex Restrepo
2017-Oct-30 23:56 UTC
[R] Scatterplot3d :: Rotating x tick labels by x degrees
Hi, I would like to rotate the x axis tick labels by 45 degrees. Using the code below, could someone please provide an example? Many Thanks In Advance, Alex library("scatterplot3d") mydf=data.frame(rate=seq(158, 314) ,age=seq(1, 157) ,market_date=seq(as.Date("2000/1/1"), as.Date("2003/1/1"), by="7 days")) mydf$market_date=as.Date(mydf$market_date, format="%Y-%m-%d") scatterplot3d(mydf$market_date ,mydf$rate ,mydf$age ,x.ticklabs = seq(as.Date("2000/1/1"), as.Date("2003/1/1"), by="330 days")) [[alternative HTML version deleted]]
Olivier Crouzet
2017-Oct-31 15:55 UTC
[R] Scatterplot3d :: Rotating x tick labels by x degrees
Hi Alex, this should be related to the "las" argument of "par()" but actually it does not seem to be parametered in scatterplot3d. Searching the net for "scatterplot3d las" provides a link to: https://stackoverflow.com/questions/25458652/specifying-the-orientation-of-the-axes-labels-in-scatterplot3d You may try the solution that is provided in this link or consider using alternate packages (like rgl or the plotly packages which one may be more powerfull as far as I can judge). However I can't help more. It seems ggplot does not produce 3d plots (but it looks like it can interact with plotly when using 3d plots). Olivier. On Mon, 30 Oct 2017 23:56:02 +0000 Alex Restrepo <alex.restrepo at outlook.com> wrote:> Hi, > > I would like to rotate the x axis tick labels by 45 degrees. Using > the code below, could someone please provide an example? Many > Thanks In Advance, Alex > > library("scatterplot3d") > mydf=data.frame(rate=seq(158, 314) > ,age=seq(1, 157) > ,market_date=seq(as.Date("2000/1/1"), as.Date > ("2003/1/1"), by="7 days")) > > mydf$market_date=as.Date(mydf$market_date, format="%Y-%m-%d") > > scatterplot3d(mydf$market_date > ,mydf$rate > ,mydf$age > ,x.ticklabs = seq(as.Date("2000/1/1"), as.Date > ("2003/1/1"), by="330 days")) > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Olivier Crouzet, PhD /Assistant Professor/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Universit? de Nantes /Guest Researcher/ @UMCG (University Medical Center Groningen) ENT department Rijksuniversiteit Groningen
On 31.10.2017 00:56, Alex Restrepo wrote:> Hi, > > I would like to rotate the x axis tick labels by 45 degrees. Using the code below, could someone please provide an example? Many Thanks In Advance, Alex45 degree rotation is not supported in base R graphics and scatterplot3d uses that. You can use par(las=2) before your code and get them rrotated by 90 degrees, or you can add them individually by s3d <- scatterplot3d(.... Afterwards you could try along trhese lines: par(xpd=TRUE) text(s3d$xyz.convert(desired positions of labels in 3D coordinate system), labels, angle=45) (untested) Best, Uwe Ligges> > library("scatterplot3d") > mydf=data.frame(rate=seq(158, 314) > ,age=seq(1, 157) > ,market_date=seq(as.Date("2000/1/1"), as.Date("2003/1/1"), by="7 days")) > > mydf$market_date=as.Date(mydf$market_date, format="%Y-%m-%d") > > scatterplot3d(mydf$market_date > ,mydf$rate > ,mydf$age > ,x.ticklabs = seq(as.Date("2000/1/1"), as.Date("2003/1/1"), by="330 days")) > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >
David Winsemius
2017-Oct-31 21:13 UTC
[R] Scatterplot3d :: Rotating x tick labels by x degrees
> On Oct 31, 2017, at 8:55 AM, Olivier Crouzet <olivier.crouzet at univ-nantes.fr> wrote: > > Hi Alex, > > this should be related to the "las" argument of "par()" but > actually it does not seem to be parametered in scatterplot3d. > Searching the net for "scatterplot3d las" provides a link to: > > https://stackoverflow.com/questions/25458652/specifying-the-orientation-of-the-axes-labels-in-scatterplot3d > > You may try the solution that is provided in this link or consider using > alternate packages (like rgl or the plotly packages which one may be > more powerfull as far as I can judge). However I can't help more. It > seems ggplot does not produce 3d plots (but it looks like it can > interact with plotly when using 3d plots).Olivier; The cited SO solutions (mine being the first one) were addressing the request for rotated "axis"-labels rather than rotated "axtick"-labels, although the general strategy of looking at the code and using the `text`-function with xpd=TRUE (rather than the `mtext`-function where needed in the definitions of mytext and mytext2) should apply. Alex; I'd encourage you to demonstrate more initiative rather than expecting us to be on-call code servants. I've decided to limit my gratis coding time to 15 minutes daily. I think this might take me an hour or more. I'm still available for on-list code review on this effort. As a start, I'd suggest downloading the scatterplot3d package code and then open up scatterplot3d.R. Find the comment ## label tick marks ... and perhaps decide whether you need to use `text` rather than `mtext`. (`text` can rotate by any amount, but may need "xpd" to be set TRUE. `mtext` is limited to 90 degree increments.) I've used up my time, so the next move is yours. -- David.> > Olivier. > > On Mon, 30 Oct 2017 > 23:56:02 +0000 Alex Restrepo <alex.restrepo at outlook.com> wrote: > >> Hi, >> >> I would like to rotate the x axis tick labels by 45 degrees. Using >> the code below, could someone please provide an example? Many >> Thanks In Advance, Alex >> >> library("scatterplot3d") >> mydf=data.frame(rate=seq(158, 314) >> ,age=seq(1, 157) >> ,market_date=seq(as.Date("2000/1/1"), as.Date >> ("2003/1/1"), by="7 days")) >> >> mydf$market_date=as.Date(mydf$market_date, format="%Y-%m-%d") >> >> scatterplot3d(mydf$market_date >> ,mydf$rate >> ,mydf$age >> ,x.ticklabs = seq(as.Date("2000/1/1"), as.Date >> ("2003/1/1"), by="330 days")) >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at 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. > > > -- > Olivier Crouzet, PhD > /Assistant Professor/ > @LLING - Laboratoire de Linguistique de Nantes > UMR6310 CNRS / Universit? de Nantes > /Guest Researcher/ > @UMCG (University Medical Center Groningen) > ENT department > Rijksuniversiteit Groningen > > ______________________________________________ > R-help at 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.David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
Well, scatterplot3d might not allow it, but have a look at the second example for staxlab in the plotrix package. Jim On Wed, Nov 1, 2017 at 7:30 AM, Uwe Ligges <ligges at statistik.tu-dortmund.de> wrote:> > > On 31.10.2017 00:56, Alex Restrepo wrote: > ... > 45 degree rotation is not supported in base R graphics and scatterplot3d > uses that. >
Maybe Matching Threads
- Scatterplot3d :: Rotating x tick labels by x degrees
- Scatterplot3d :: Rotating x tick labels by x degrees
- Scatterplot3d :: Rotating x tick labels by x degrees
- Scatterplot3d :: Rotating x tick labels by x degrees
- Scatterplot3d :: Rotating x tick labels by x degrees