Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread Rui Barradas
Às 00:36 de 13/12/2023, Robert Baer escreveu: coord_cartesian also seems to work for y, and including the breaks = . How about: df=data.frame(year= c(2012,2015,2018,2022),   score=c(495,493, 495, 474)) ggplot(df, aes(x = year, y = score)) +   geom_point() +   geom_smooth(method

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread Ebert,Timothy Aaron
y = "PISA score in mathematics") + scale_y_continuous(limits=c(470,500),oob=scales::squish) Regards, Tim -Original Message- From: R-help On Behalf Of varin sacha via R-help Sent: Tuesday, December 12, 2023 4:19 PM To: r-help@r-project.org; Ben Bolker Subject: Re: [R] ggplot2: Get the r

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread Robert Baer
coord_cartesian also seems to work for y, and including the breaks = .  How about: df=data.frame(year= c(2012,2015,2018,2022),   score=c(495,493, 495, 474)) ggplot(df, aes(x = year, y = score)) +   geom_point() +   geom_smooth(method = "lm", formula = y ~ x) +   labs(title =

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread Ben Bolker
Use scale_x_continuous() and specify your desired breaks On Tue, Dec 12, 2023, 4:19 PM varin sacha wrote: > Dear Ben, > Dear Daniel, > Dear Rui, > Dear Bert, > > Here below my R code. > I really appreciate all your comments. My R code is perfectly working but > there is still something I would

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread varin sacha via R-help
Dear Ben, Dear Daniel, Dear Rui, Dear Bert, Here below my R code. I really appreciate all your comments. My R code is perfectly working but there is still something I would like to improve. The X-axis is showing   2012.5 ;   2015.0   ;   2017.5   ;  2020.0 I would like to see on X-axis only the

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-11 Thread Ben Bolker
On 2023-12-11 5:27 p.m., Daniel Nordlund wrote: On 12/10/2023 2:50 PM, Rui Barradas wrote: Às 22:35 de 10/12/2023, varin sacha via R-help escreveu: Dear R-experts, Here below my R code, as my X-axis is "year", I must be missing one or more steps! I am trying to get the regression line

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-11 Thread Daniel Nordlund
On 12/10/2023 2:50 PM, Rui Barradas wrote: Às 22:35 de 10/12/2023, varin sacha via R-help escreveu: Dear R-experts, Here below my R code, as my X-axis is "year", I must be missing one or more steps! I am trying to get the regression line with the 95% confidence bands around the regression

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-10 Thread Bert Gunter
This can easily be done using predict.lm to get the intervals (confidence or prediction). ?predict.lm contains a plotting example using ?matplot from the graphics package. Here's a somewhat verbose version for your example (first converting Year to numeric, of course): df=data.frame(year=

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-10 Thread Rui Barradas
Às 22:35 de 10/12/2023, varin sacha via R-help escreveu: Dear R-experts, Here below my R code, as my X-axis is "year", I must be missing one or more steps! I am trying to get the regression line with the 95% confidence bands around the regression line. Any help would be appreciated. Best,

[R] ggplot2: Get the regression line with 95% confidence bands

2023-12-10 Thread varin sacha via R-help
Dear R-experts, Here below my R code, as my X-axis is "year", I must be missing one or more steps! I am trying to get the regression line with the 95% confidence bands around the regression line. Any help would be appreciated. Best, S. #

Re: [R] ggplot2 install.package

2022-10-11 Thread Ivan Krylov
On Mon, 10 Oct 2022 15:32:33 +0200 wrote: > Error in nchar(homeDir) : invalid multibyte string, element 1 I searched for nchar(homeDir) in the R source code and on CRAN (as indexed by GitHub), and the only CRAN match was probably unrelated (in the ibmdbR package). There's also a few matches in

Re: [R] ggplot2 install.package

2022-10-11 Thread Spencer Graves
enstag, 11. Oktober 2022 02:42 An: sibylle.stoec...@gmx.ch; R-help@r-project.org Betreff: RE: [R] ggplot2 install.package Can you please provide us with a copy of the error msg? I have used ggplot2 with R 4.2.1, and probably R 4.2.0 in RStudio on Windows 11 and not had trouble. You might need to update R,

Re: [R] ggplot2 install.package

2022-10-11 Thread sibylle.stoeckli
@gmx.ch; R-help@r-project.org Betreff: RE: [R] ggplot2 install.package Can you please provide us with a copy of the error msg? I have used ggplot2 with R 4.2.1, and probably R 4.2.0 in RStudio on Windows 11 and not had trouble. You might need to update R, or RStudio. R and RStudio need to be

Re: [R] ggplot2 install.package

2022-10-10 Thread Ebert,Timothy Aaron
On Behalf Of sibylle.stoec...@gmx.ch Sent: Monday, October 10, 2022 9:33 AM To: R-help@r-project.org Subject: [R] ggplot2 install.package [External Email] Dear R members I am working with RStudio R 4.2.0 and using ggplot2 and gridExtra. Since some windows updates I get some error when loading

[R] ggplot2 install.package

2022-10-10 Thread sibylle.stoeckli
Dear R members I am working with RStudio R 4.2.0 and using ggplot2 and gridExtra. Since some windows updates I get some error when loading ggplot2. * It seems that I am able to install ggplot2. The problem is when loading ggplot2 with library(). * Do you have any ideas to solve

Re: [R] ggplot2

2022-04-05 Thread Greg Minshall
hi, Richard, > I get these warnings, and the package did not install: ... > 1: In install.packages("ggplot2", dependencies = TRUE) : > installation of package ‘curl’ had non-zero exit status Ivan and Kimmo have both pointed out you need the right development tools. in terms of debugging your

Re: [R] ggplot2

2022-04-05 Thread Richard Vickery
; was offered. > > -- > David > > > library(ggplot2) > > > > An alternative > > install.packages("tidyverse") > > library(tidyverse) > > > > The first only installs ggplot2. The alternative installs a bunch of > other stuff as wel

Re: [R] ggplot2

2022-04-04 Thread David Winsemius
e- From: R-help On Behalf Of Richard Vickery Sent: Sunday, April 3, 2022 12:49 PM To: R-help@r-project.org Subject: [R] ggplot2 [External Email] Hi there, I am finally getting to some material I had problems with in university, where I was introduced to R - one of those that because of time

[R] ggplot2

2022-04-03 Thread Richard Vickery
Hi there, I am finally getting to some material I had problems with in university, where I was introduced to R - one of those that because of time constraints, I had challenges figuring out, particularly because I decided long ago on using Fedora Linux. The book, "Understanding Statistics Using

Re: [R] ggplot2 with an arbitrary number of curves from geom_function + legend?

2022-02-27 Thread Jeff Newmiller
discuss this, so >forget I said anything. > > > > >-Original Message- >From: Michael Bonert >To: r-help@r-project.org >Sent: Sun, Feb 27, 2022 8:02 pm >Subject: [R] ggplot2 with an arbitrary number of curves from geom_function + >legend? > >Dear

Re: [R] ggplot2 with an arbitrary number of curves from geom_function + legend?

2022-02-27 Thread Avi Gross via R-help
ltiple vertical (or horizontal) lines by supplying a vector of positions. But as noted, this is not considered a good place by some to discuss this, so forget I said anything. -Original Message- From: Michael Bonert To: r-help@r-project.org Sent: Sun, Feb 27, 2022 8:02 pm Subje

Re: [R] ggplot2: 'not finding <-<- error' [RESOLVED]

2021-11-12 Thread Rich Shepard
On Fri, 12 Nov 2021, Chris Evans wrote: I think it's your xlab. Should be: Chris, Ah, I should know better, but I didn't relate the error message to that line. Thank you. Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] ggplot2: 'not finding <-<- error'

2021-11-12 Thread Chris Evans
ct.org > Sent: Friday, 12 November, 2021 19:23:18 > Subject: [R] ggplot2: 'not finding <-<- error' > I'm writing a script to plot data distributions. It worked in a basic form > and I'm now adding features and tweaking the presentation. When I sourced > the file this e

[R] ggplot2: 'not finding <-<- error'

2021-11-12 Thread Rich Shepard
I'm writing a script to plot data distributions. It worked in a basic form and I'm now adding features and tweaking the presentation. When I sourced the file this error appeared: Error in p1 <- ggplot(data = pdx_disc, aes(x = NULL, y = cfs)) + geom_boxplot(color = "#8B", (from

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-12 Thread Rich Shepard
On Thu, 11 Nov 2021, John Dougherty wrote: You should probably glance at the R Graphics Cookbook. That was my gateway to ggplot. I believe ggplot is a part of the tidyverse so there should good information. John, I have Hadley's ggplot2 book and keep referring to it but haven't used it

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread John Dougherty via R-help
On Wed, 10 Nov 2021 11:44:07 -0800 (PST) Rich Shepard wrote: > I have the code to create ggplot2 boxplots using two attributes (e.g., > chemical concentration and month) from the same tibble. Is there an > example from which I can learn how to make boxplots from different > tibbles/dataframes

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Avi Gross via R-help wrote: This is not a place designed for using packages but since this discussion persists, ... Avi, I'll find a cowplot help site. # Create and save two ggplots, or more in your case: p1 <- ggplot(data=df1, aes(x=NULL, y=cfs)) +

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Avi Gross via R-help
quot;yellow") p2 <- ggplot(data=df2, aes(x=NULL, y=cfs)) + geom_boxplot(color="green", fill="pink") # combine the two or more verically using the plot_grid() from cowplot plot_grid(p1, p2, ncol=1) #END OF CODE -Original Message- From: R-help On Behalf Of Rich Shepar

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Avi Gross wrote: Your message was just to me so the reply is also just to you. Avi, Oops! Mea cupla. Yes, large data sets can be handled if your machine has the memory and one big one takes up the same amount as four smaller ones if combined. This desktop has 32G RAM

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Bert Gunter wrote: These days, 3e6 rows x 3 columns is small, unless large objects are in each cell. I think R would handle this with ease. Thanks, Bert. See my last post showing data set structure and suggested collection for use by grouping. Regards, Rich

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Avi Gross via R-help
. -Original Message- From: R-help On Behalf Of Rich Shepard Sent: Thursday, November 11, 2021 12:56 PM To: R-help Subject: Re: [R] ggplot2: multiple box plots, different tibbles/dataframes On Thu, 11 Nov 2021, Bert Gunter wrote: > You can always create a graphics layout and then p

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Avi Gross via R-help wrote: Say I have a data.frame with columns called PLACE and MEASURE others. The one I call PLACE would be a factor containing the locations you are measuring at. I mean it would be character strings of your N places but the factors would be made in the

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Bert Gunter wrote: You can always create a graphics layout and then plot different ggplot objects in the separate regions of the layout. See ?grid.layout (since ggplots are grobs) and ?plot.ggplot . This also **may** be useful by showing examples using grid.arrange()

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Bert Gunter
You can always create a graphics layout and then plot different ggplot objects in the separate regions of the layout. See ?grid.layout (since ggplots are grobs) and ?plot.ggplot . This also **may** be useful by showing examples using grid.arrange()

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Avi Gross via R-help
() and facet_wrap() as various ways to do this. Note you may want to examine some options such as setting the scales to be the same or free. -Original Message- From: R-help On Behalf Of Rich Shepard Sent: Thursday, November 11, 2021 12:22 PM To: r-help@r-project.org Subject: Re: [R] ggplot2

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Avi Gross wrote: Boxplots like many other things in ggplot can be grouped in various ways. I often do something like this: Avi, I've designed and used multiple boxplots in many projects. They might show geochemical concentrations at two locations or in two (or three)

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Avi Gross via R-help
On Behalf Of Rich Shepard Sent: Thursday, November 11, 2021 8:50 AM To: r-help@r-project.org Subject: Re: [R] ggplot2: multiple box plots, different tibbles/dataframes On Wed, 10 Nov 2021, Avi Gross via R-help wrote: > I think many here may not quite have enough info to help you. Avi, Actua

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Jeff Newmiller wrote: I strongly recommend that you change your way of thinking when it comes to ggplot: if your data are not yet in one data frame then your data are not yet ready for plotting. It is possible to specify separate data frames for different layers of the

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Jeff Newmiller
I strongly recommend that you change your way of thinking when it comes to ggplot: if your data are not yet in one data frame then your data are not yet ready for plotting. It is possible to specify separate data frames for different layers of the plot, but this severely complicates building

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes [RESOLVED]

2021-11-11 Thread Rich Shepard
On Wed, 10 Nov 2021, Rich Shepard wrote: I have the code to create ggplot2 boxplots using two attributes (e.g., chemical concentration and month) from the same tibble. Is there an example from which I can learn how to make boxplots from different tibbles/dataframes (e.g., chemical

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Bill Dunlap wrote: I googled for "ggplot2 boxplots by group" and the first hit was https://www.r-graph-gallery.com/265-grouped-boxplot-with-ggplot2.html which displays lots of variants along with the code to produce them. It has links to ungrouped boxplots and shows how

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Thu, 11 Nov 2021, Bill Dunlap wrote: I googled for "ggplot2 boxplots by group" and the first hit was https://www.r-graph-gallery.com/265-grouped-boxplot-with-ggplot2.html which displays lots of variants along with the code to produce them. It has links to ungrouped boxplots and shows how

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Bill Dunlap
I googled for "ggplot2 boxplots by group" and the first hit was https://www.r-graph-gallery.com/265-grouped-boxplot-with-ggplot2.html which displays lots of variants along with the code to produce them. It has links to ungrouped boxplots and shows how violin plots can better display your data.

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Rich Shepard
On Wed, 10 Nov 2021, Avi Gross via R-help wrote: I think many here may not quite have enough info to help you. Avi, Actually, you've reflected my thinking. But the subject of multiple plots has come up. There are a slew of ways, especially in the ggplot paradigm, to make multiple smaller

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-10 Thread Avi Gross via R-help
. So, although it may also be possible to do whatever it is you want within a single plot, it may also make sense to do it as loosely described above. -Original Message- From: R-help On Behalf Of Rich Shepard Sent: Wednesday, November 10, 2021 4:53 PM To: R-help Subject: Re: [R] ggplot2

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-10 Thread Rich Shepard
On Wed, 10 Nov 2021, Bert Gunter wrote: As always, online search (on "ggplot2 help") seemed to bring up useful resources. I suggest you look here (suggested tutorials and resources are farther down the page): https://ggplot2.tidyverse.org/ Bert, My web search was for multiple boxplots and I

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-10 Thread Bert Gunter
As always, online search (on "ggplot2 help") seemed to bring up useful resources. I suggest you look here (suggested tutorials and resources are farther down the page): https://ggplot2.tidyverse.org/ Bert Gunter On Wed, Nov 10, 2021 at 12:16 PM Rich Shepard wrote: > > On Wed, 10 Nov 2021,

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-10 Thread Rich Shepard
On Wed, 10 Nov 2021, Rich Shepard wrote: I have the code to create ggplot2 boxplots using two attributes (e.g., chemical concentration and month) from the same tibble. Is there an example from which I can learn how to make boxplots from different tibbles/dataframes (e.g., chemical

[R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-10 Thread Rich Shepard
I have the code to create ggplot2 boxplots using two attributes (e.g., chemical concentration and month) from the same tibble. Is there an example from which I can learn how to make boxplots from different tibbles/dataframes (e.g., chemical concentrations and monitoring location)? TIA, Rich

Re: [R] ggplot2 bar chart: order display for each group

2021-09-20 Thread Jeff Newmiller
I could, but this question is off topic on this mailing list. Read the Posting Guide before you post again. Help for ggplot2 can be found in many places... start your search here https://cran.r-project.org/web/packages/ggplot2/index.html. (Hint: your data should be a factor.) On September 20,

[R] ggplot2 bar chart: order display for each group

2021-09-20 Thread Kai Yang via R-help
Hello List, I submitted the code below, it will show two groups of avg_time bar chart for each gc_label. ggplot(s8_GCtime, aes(fill=GTresult, y=avg_time, x=gc_label, label = avg_time)) +    geom_bar(position=position_dodge(), stat="identity") +   geom_text(aes(label=avg_time), vjust=1.6,

Re: [R] ggplot2::geom_path() in a loop problems.

2021-04-24 Thread Jeff Newmiller
Sigh. Don't do this. Setup your data frame with all the data you want to plot and give it to one geom. Use group columns such as factors (e.g. color, size, linetype, etc) to distinguish them. Using multiple geoms with different mappings is usually a recipe for disappointment. It also fails to

Re: [R] ggplot2::geom_path() in a loop problems.

2021-04-24 Thread Martin Møller Skarbiniks Pedersen
On Fri, 23 Apr 2021 at 20:51, Chris Evans wrote: > > I may be quite wrong but isn't the for loop in the second example simply overwriting/replacing the first p2 with the second whereas the p1 version is adding the paths to p1. > > (If you see what I mean, I don't think I have expressed that very

Re: [R] ggplot2::geom_path() in a loop problems.

2021-04-23 Thread Martin Møller Skarbiniks Pedersen
On Fri, 23 Apr 2021 at 20:11, Martin Møller Skarbiniks Pedersen < traxpla...@gmail.com> wrote: > > Hi, > > I have some problems understanding how to use geom_path() inside a loop. > I know the code below is a bit silly but it is just a MRE > (

[R] ggplot2::geom_path() in a loop problems.

2021-04-23 Thread Martin Møller Skarbiniks Pedersen
Hi, I have some problems understanding how to use geom_path() inside a loop. I know the code below is a bit silly but it is just a MRE ( https://stackoverflow.com/help/minimal-reproducible-example ) p1 looks like I expect however p2 only contains the last square. I expected p2 to be the same as

Re: [R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Rui Barradas
Hello, Is it this? plot.background = element_rect(colour = "yellow2", fill = "yellow2") The small white space goes away. Hope this helps, Rui Barradas Às 17:00 de 20/12/20, Martin Møller Skarbiniks Pedersen escreveu: On Sun, 20 Dec 2020 at 17:43, Rui Barradas wrote: Thank you for trying

Re: [R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Jeff Newmiller
Perhaps ?expansion can help? On December 20, 2020 9:00:09 AM PST, "Martin Møller Skarbiniks Pedersen" wrote: >On Sun, 20 Dec 2020 at 17:43, Rui Barradas >wrote: > >Thank you for trying to answer my question. > >> I am not sure I understand the problem. >> With coord_fixed() both axis have the

Re: [R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Martin Møller Skarbiniks Pedersen
On Sun, 20 Dec 2020 at 17:43, Rui Barradas wrote: Thank you for trying to answer my question. > I am not sure I understand the problem. > With coord_fixed() both axis have the same length and the plot is a > square. When resizing the plot window the white areas can be on > top/bottom if the

Re: [R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Rui Barradas
Hello, I am not sure I understand the problem. With coord_fixed() both axis have the same length and the plot is a square. When resizing the plot window the white areas can be on top/bottom if the window height is bigger than its width or to the left/right if it's the other way around. Does

[R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Martin Møller Skarbiniks Pedersen
Hi, I posted this on the Google Group for ggplot2 but got no response. https://groups.google.com/g/ggplot2/c/441srnt6RZU So I hope someone can help me here instead?! - If I don't use the coord_fixed() then all the background is yellow as expected. But I need to coord_fixed() and then it adds

Re: [R] ggplot2 + coord_cartesian + automatic ylim

2020-12-13 Thread Brian Beckage
David, Great suggestion! Thanks, Brian On Dec 13, 2020, at 6:06 PM, David Winsemius mailto:dwinsem...@comcast.net>> wrote: On 12/13/20 12:49 PM, Brian Beckage wrote: As an example to illustrate my question, if I used the following code to plot the price of Apple stock using the

Re: [R] ggplot2 + coord_cartesian + automatic ylim

2020-12-13 Thread Daniel Nordlund
On 12/13/2020 12:49 PM, Brian Beckage wrote: As an example to illustrate my question, if I used the following code to plot the price of Apple stock using the tidyquant package and ggplot2 AAPL<-tq_get(x="AAPL") AAPL %>% ggplot(aes(x = date, y = close)) + geom_line() + labs(title =

Re: [R] ggplot2 + coord_cartesian + automatic ylim

2020-12-13 Thread David Winsemius
On 12/13/20 12:49 PM, Brian Beckage wrote: As an example to illustrate my question, if I used the following code to plot the price of Apple stock using the tidyquant package and ggplot2 AAPL<-tq_get(x="AAPL") AAPL %>% ggplot(aes(x = date, y = close)) + geom_line() + labs(title =

[R] ggplot2 + coord_cartesian + automatic ylim

2020-12-13 Thread Brian Beckage
As an example to illustrate my question, if I used the following code to plot the price of Apple stock using the tidyquant package and ggplot2 AAPL<-tq_get(x="AAPL") AAPL %>% ggplot(aes(x = date, y = close)) + geom_line() + labs(title = "AAPL", y = "Closing Price", x = "") +

Re: [R] ggplot2 stat_smooth formula different units

2020-11-11 Thread David Winsemius
On 11/11/20 2:11 PM, Marcelo Laia wrote: Hi, I am running these approaches: Model 1 ggplot( dat , aes(x=DAP, y=Altura, color=as.factor(Espacamento) )) + geom_point(size=0.5) + stat_smooth(method = "lm", formula = y ~ x + I(x^2), size = 1) +

Re: [R] ggplot2 stat_smooth formula different units

2020-11-11 Thread Marcelo Laia
Hi Rui, You are very welcome! On 11/11/20 at 11:10, Rui Barradas wrote: > > dput(head(dat, 20)) > structure(list(Bloco = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), Espacamento = c("3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1", "3 x 1",

Re: [R] ggplot2 stat_smooth formula different units

2020-11-11 Thread Rui Barradas
Hello, Try removing I() from I(log(y)). But it's hard to say without a reproducible example, please post the output of dput(dat) or, if dat is big, the output of dput(head(dat, 20)) Hope this helps, Rui Barradas Às 22:11 de 11/11/20, Marcelo Laia escreveu: Hi, I am running these

[R] ggplot2 stat_smooth formula different units

2020-11-11 Thread Marcelo Laia
Hi, I am running these approaches: Model 1 ggplot( dat , aes(x=DAP, y=Altura, color=as.factor(Espacamento) )) + geom_point(size=0.5) + stat_smooth(method = "lm", formula = y ~ x + I(x^2), size = 1) + facet_grid(Espacamento ~ Clone) +

Re: [R] Ggplot2 Line Problem

2020-08-17 Thread Stephen P. Molnar
Many thanks. That solved the problem. On 08/17/2020 01:49 AM, Rui Barradas wrote: Hello, This type of problem is almost always a data reshaping problem. ggplot graphics work better if the data is in the long format and you have 3 columns for counts, one column for each category. If you

Re: [R] Ggplot2 Line Problem

2020-08-16 Thread Rui Barradas
Hello, Sorry, I forgot you also want the line type changed. Remove color and linetype from the initial call to ggplot and include aes(color = cases, linetype = cases) in geom_line. Then add a layer scale_linetype_manual with the same name and labels to merge it with the color legend. dfO

Re: [R] Ggplot2 Line Problem

2020-08-16 Thread Rui Barradas
Hello, This type of problem is almost always a data reshaping problem. ggplot graphics work better if the data is in the long format and you have 3 columns for counts, one column for each category. If you reformat from the current wide format to the long format you will have a date vector, a

[R] Ggplot2 Line Problem

2020-08-16 Thread Stephen P. Molnar
I have cobbled together a short script to plot Covid-19 data. setwd("~/Apps/Models/1-CoronaVirus") library(tidyverse) library(lubridate) datO <- read.csv("https://api.covidtracking.com/v1/states/oh/daily.csv;) datO[ ,1] <- ymd(datO[ ,1]) dfO <- tibble::as_tibble(data.frame(datO[

Re: [R] ggplot2 axis

2020-05-09 Thread Rui Barradas
Hello, I cannot reproduce this. If I do db <- iris[3:5] names(db) <- c("length", "width", "support") and change 'lenght' to 'length' in the ggplot call both axis are plotted. But the code is not reproducible, db is missing. Can you post the output of dput(head(db, 30)) in a next mail?

[R] ggplot2 axis

2020-05-09 Thread João Marreiros
Dear users, Does anyone had a problem with ggplot concerning the axis not being shown? (see attachment) ggplot(db, aes (x = lenght, y = width, color = support)) +   geom_point(size=2) +   stat_ellipse() +   labs(x="Lenght (mm)", y="width (mm)", title="Boxplot", color = "Support") I'm using

Re: [R] ggplot2 error bars and convex hulls

2020-04-22 Thread Ivan Calandra
Thanks Rui for these 2 possibilities; I'll have a look. Any one with pointers for the error bars issue? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos

Re: [R] ggplot2 error bars and convex hulls

2020-04-21 Thread Rui Barradas
Hello, As for convex hulls, there is an example of how to construct a stat_hull in vignette("extending-ggplot2", package = "ggplot2") There is also a geom_hull in a GitHub package: devtools::install_github("cmartin/ggConvexHull") Hope this helps, Rui Barradas Às 17:02 de 21/04/20, Ivan

[R] ggplot2 error bars and convex hulls

2020-04-21 Thread Ivan Calandra
Dear useRs, I would like to have horizontal and vertical error bars extending from the means on two continuous variables. This would be the "manual" way of doing it, computing the mean and sd (or whatever stats) beforehand and then calling geom_errorbar() and geom_errorbarh() with appropriate

Re: [R] ggplot2 fill problem in colour shading

2019-08-11 Thread David Winsemius
> On Aug 11, 2019, at 9:13 AM, Troels Ring wrote: > > Dear friends - I have 2 problems with ggplot2 > > Here is the code for illustration > > > > x <- seq(1,10,length=1) > > y <- x^2 > > fill <- rep(0,length(x)) > > fill[(5 > ddf <- data.frame(x,y,fill) > >

Re: [R] ggplot2 fill problem in colour shading

2019-08-11 Thread Rui Barradas
Hello, You must put the NA in scale_fill_manual. Like this: ggplot(data = ddf, aes(x = x, y = y)) + geom_area(aes(fill = fill)) + geom_line() + scale_fill_manual(values = c(NA, "red")) Note also that 'fill' is a factor, were it numeric you would need fill = factor(fill). ddf2 <-

[R] ggplot2 fill problem in colour shading

2019-08-11 Thread Troels Ring
Dear friends - I have 2 problems with ggplot2 Here is the code for illustration x <- seq(1,10,length=1) y <- x^2 fill <- rep(0,length(x)) fill[(5https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

[R] ggplot2 plots/results are different within and outside of loop bug

2019-07-15 Thread mailer@app.tempr.email
Dear Community,I made a Stackoverflow post that I really could use some professional help here (or the issue is just something really really simple :D)https://stackoverflow.com/questions/57029118/ggplot2-plots-results-are-different-within-and-outside-of-loop-bug;>ggplot2 plots/results are

Re: [R] ggplot2 version 3

2018-07-03 Thread Roy Mendelssohn - NOAA Federal via R-help
Thanks! -Roy > On Jul 3, 2018, at 2:40 PM, William Dunlap wrote: > > One way to test the new ggplot2 is to make a new directory to use as an R > library and to install the new ggplot2 there. >newLibrary <- "C:/tmp/newRLibrary" >dir.create(newLibrary) >install.packages("ggplot2",

Re: [R] ggplot2 version 3

2018-07-03 Thread William Dunlap via R-help
One way to test the new ggplot2 is to make a new directory to use as an R library and to install the new ggplot2 there. newLibrary <- "C:/tmp/newRLibrary" dir.create(newLibrary) install.packages("ggplot2", lib=newLibrary) Then you can run two R sessions at once, starting one with

[R] ggplot2 version 3

2018-07-03 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi All: When I ask about updating packages in my R distribution, it lists ggplot2 version 3.0.0 as being available. I know that ggplot2 version 3.0.0 has made some significant changes that will break certain things. I would like to install the new version, to see if it breaks anything that

[R] ggplot2: plot gruped/nested split violins

2018-03-06 Thread Big Floppy Dog
Hi, I posted this on StackOverflow also but did not get a response so I thought that I would also try luck here. The post is at: https://stackoverflow.com/questions/49120060/ggplot2-display-blocks-of-nested-split-violins Basically, I have the following test example:

[R] ggplot2 error

2017-11-09 Thread Thomas Subia via R-help
Hello all, Zeki(?) reported: > ggplot(data = mtcars, aes(x= wt, y= mpg)) + geom_line() > Error: Found object is not a stat. Using R v3.4.62 and R studio, I'm unable to reproduce this error. All the best, Thomas Subia [[alternative HTML version deleted]]

Re: [R] ggplot2 and tikzDevice : problems with accents

2017-10-22 Thread Martin Møller Skarbiniks Pedersen
On 22 October 2017 at 17:56, Jacques Ropers wrote: > > Hi all, > > I can't fathom why the accented "é" in the following ggplot2 graph makes > R hangs when using tikzdevice, whereas it works using simple pdf device. > [...] I just tried your code and my R doesn't hang but it

[R] ggplot2 and tikzDevice : problems with accents

2017-10-22 Thread Jacques Ropers
Hi all, I can't fathom why the accented "é" in the following ggplot2 graph makes R hangs when using tikzdevice,  whereas it works using simple pdf device. ## library(tikzDevice) library(ggplot2) options(tikzDefaultEngine = "luatex") tikzLualatexPackages =c(   "\\usepackage{tikz}\n",  

Re: [R] ggplot2 geom_bar arrangement

2017-06-28 Thread Jeff Newmiller
In the general case it is not possible to do as you ask because "Lab" can be duplicated. However, in your specific case it is unique in your data frame, so you just have to control the order of the factor labels instead of letting them be set up in the default manner. Of course, you have to be

Re: [R] ggplot2 geom_bar arrangement

2017-06-27 Thread Thomas Mailund
The order the bars are plotted in is determined by the levels in a factor, and your labels are treated as a factor. You can make sure you keep the order of your labels by simply doing this: Lab <- factor(Lab, levels = Lab) before constructing the data frame. Cheers On 27 Jun 2017, 20.43

Re: [R] ggplot2 geom_bar arrangement

2017-06-27 Thread Brian Smith
Thanks Jean, that worked! On Tue, Jun 27, 2017 at 3:58 PM, Adams, Jean wrote: > You just have to change the levels of the factor ... > > library(ggplot2) > > Lab = c(letters[4:6], letters[1:3]) > valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) > df <- data.frame(Lab,valuex) > > # set

[R] ggplot2 geom_bar label justification

2017-06-27 Thread Brian Smith
Hi, I was trying to make a horizontal bar plot. The barplot works when the text labels are of reasonable length, but not if some of them are slightly long. I think the long ones get 'squeezed' by default before the plot is flipped and keep the skew after the flip. Is there a way I can get around

Re: [R] ggplot2 geom_bar arrangement

2017-06-27 Thread Adams, Jean
You just have to change the levels of the factor ... library(ggplot2) Lab = c(letters[4:6], letters[1:3]) valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) df <- data.frame(Lab,valuex) # set the factor levels to the same order as observed in the data frame df$Lab <- factor(df$Lab, levels=unique(df$Lab))

[R] ggplot2 geom_bar arrangement

2017-06-27 Thread Brian Smith
Hi, I was trying to draw a geom_bar plot. However, by default, the bars are arranged according to the label, which I don't want. I want the bars to appear exactly as they appear in the data frame. For example in the code: Lab=c(letters[4:6],letters[1:3]) valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4)

[R] ggplot2: ..n.. and ..count.. in geom_text

2017-04-18 Thread G . Maubach
Hi All, I have the following code: -- cut (g03_02_p02 <- ggplot(data = d_kzb_input) + geom_bar( mapping = aes(x = v03_02_r01, y = round(..prop.. * 100, 0)), fill = c_ww_palette["blue"]) + scale_y_continuous(limits = c(0, c_y_limit)) + theme_classic() + ggtitle(paste0("Question

Re: [R] ggplot2 question plot mean/error bars

2017-04-06 Thread PIKAL Petr
5, 2017 11:06 PM To: r-help <r-help@r-project.org> Subject: Re: [R] ggplot2 question plot mean/error bars Dear Rxperts.. Here is the updated code.. to the above example.. how do I make the white circles as "white filled" so that lines in the circles are not shown.? Thanks and muc

Re: [R] ggplot2 question plot mean/error bars

2017-04-05 Thread Santosh
Dear Rxperts.. Here is the updated code.. to the above example.. how do I make the white circles as "white filled" so that lines in the circles are not shown.? Thanks and much appreciated Santosh q <- data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(

[R] ggplot2 question plot mean/error bars

2017-04-05 Thread Santosh
Hello Rxperts.. I am trying to generate a mean+/- error plot.. using ggplot2.. with filled black and white circles and black lines, but no overlap of lines and circles (symbols). Also, with no top and right lines of the plot box. I remember having done this before.. unable to reproduce how I did!

Re: [R] ggplot2: Adjusting title and labels

2017-03-16 Thread Ulrik Stervbo
Hi Georg, If you remove the coord_polar, you'll see that the optimal y-value for the labels is between the upper and lower bound of the stacked bar-element. I am not sure it is the most elegant solution, but you can calculate them like this: df <- data.frame(group = c("Male", "Female",

[R] ggplot2: Adjusting title and labels

2017-03-16 Thread G . Maubach
Hi All, I have a question to ggplot 2. My code is the following: -- cut -- library(ggplot2) library(scales) df <- data.frame(group = c("Male", "Female", "Child"), value = c(25, 25, 50)) blank_theme <- theme_minimal() + theme( axis.title.x = element_blank(), axis.title.y =

  1   2   3   4   5   6   7   8   9   10   >