Re: [R] ggplot trouble when I combine a layer with group and a layer with group=1

2025-04-15 Thread Laurent Rhelp
For interested people I got an answer on this link, thank you. https://stackoverflow.com/questions/79573847/ggplot-trouble-when-i-combine-a-layer-with-group-and-a-layer-with-group-1?noredirect=1#comment140334381_79573847 Le 12/04/2025 à 17:24, Laurent Rhelp a écrit : Dear RHelp-list,   I wan

Re: [R] ggplot with major and MINOR tick marks on a log scale

2025-01-21 Thread Rui Barradas
Às 19:38 de 21/01/2025, Rui Barradas escreveu: Às 02:18 de 21/01/2025, Sorkin, John escreveu: I have used ggplot to create a graph on which the y-axis is on the log scale. (see data and code, below.) I would like to add minor tick marks, which will also be on the log scale. The data and code ar

Re: [R] ggplot with major and MINOR tick marks on a log scale

2025-01-21 Thread Rui Barradas
Às 02:18 de 21/01/2025, Sorkin, John escreveu: I have used ggplot to create a graph on which the y-axis is on the log scale. (see data and code, below.) I would like to add minor tick marks, which will also be on the log scale. The data and code are below. I hope somone can tell me how I can m

Re: [R] ggplot with major and MINOR tick marks on a log scale

2025-01-20 Thread Kimmo Elo
Hi, this code could/should work: --- snip --- PopByDayByAQIminus %>% ggplot(aes(x=AQI_Cat,y=TotalPop/100), group=Day,color=Day,shape=as_factor(Day), linetype = as_factor(Day)) + geom_point(size=4,alpha=0.7)+ geom_line(linewidth=1.5,alpha=0.3)+ theme(axis

Re: [R] ggplot with major and MINOR tick marks on a log scale

2025-01-20 Thread Bert Gunter
dget() should be dput(), of course. But you don't need dput() either, as assigning the structure() call suffices. -- Bert On Mon, Jan 20, 2025 at 6:18 PM Sorkin, John wrote: > I have used ggplot to create a graph on which the y-axis is on the log > scale. (see data and code, below.) I would lik

Re: [R] ggplot two-factor legend

2024-07-18 Thread SIBYLLE STÖCKLI via R-help
Thanks a lot Rui and Jeff Yes including labels=c() in scale_linetype_manual() was the hint. Sibylle -Original Message- From: Rui Barradas Sent: Thursday, July 18, 2024 6:50 PM To: sibylle.stoec...@gmx.ch; r-help@r-project.org Subject: Re: [R] ggplot two-factor legend Às 17:43 de 18

Re: [R] ggplot two-factor legend

2024-07-18 Thread Rui Barradas
Às 17:43 de 18/07/2024, Rui Barradas escreveu: Às 16:27 de 18/07/2024, SIBYLLE STÖCKLI via R-help escreveu: Hi I am using ggplot to visualise y for a two-factorial group (Bio: 0 and 1) x = 6 years. I was able to adapt the colour of the lines (green and red) and the linetype (solid and dashed

Re: [R] ggplot two-factor legend

2024-07-18 Thread Rui Barradas
Às 16:27 de 18/07/2024, SIBYLLE STÖCKLI via R-help escreveu: Hi I am using ggplot to visualise y for a two-factorial group (Bio: 0 and 1) x = 6 years. I was able to adapt the colour of the lines (green and red) and the linetype (solid and dashed). Challenge: my code produces now two legends. One

Re: [R] ggplot two-factor legend

2024-07-18 Thread SIBYLLE STÖCKLI via R-help
uld like the additionally differentiate the two lines (groups) in the linetype. Sibylle -Original Message- From: Jeff Newmiller Sent: Thursday, July 18, 2024 6:13 PM To: sibylle.stoec...@gmx.ch; SIBYLLE STÖCKLI via R-help ; r-help@r-project.org Subject: Re: [R] ggplot two-factor

Re: [R] ggplot two-factor legend

2024-07-18 Thread Jeff Newmiller via R-help
If I follow your question, you want redundant aesthetics. Ggplot normally notices correlated aesthetic mapping variables and merges the legends, so the most likely answer is that your data are not fully correlated in all rows. I have also seen this where data are drawn from different dataframes

Re: [R] ggplot 3-dimensions

2023-12-17 Thread Rui Barradas
Às 09:13 de 17/12/2023, SIBYLLE STÖCKLI via R-help escreveu: Dear R community In the meantime I made some progress: ggplot(data = Fig2b, aes(x = BFF, y = Wert, fill = Effekt))+theme_bw()+ geom_bar(stat = "identity", width = 0.95) + scale_y_continuous(limits=c(0,13), expand=c(0,0))+

Re: [R] ggplot 3-dimensions

2023-12-17 Thread SIBYLLE STÖCKLI via R-help
Dear R community In the meantime I made some progress: ggplot(data = Fig2b, aes(x = BFF, y = Wert, fill = Effekt))+theme_bw()+ geom_bar(stat = "identity", width = 0.95) + scale_y_continuous(limits=c(0,13), expand=c(0,0))+ facet_wrap(~Aspekt, strip.position = "bottom", scales = "free

Re: [R] ggplot with two x-axis and two dimensions

2023-11-25 Thread Rui Barradas
Às 10:29 de 24/11/2023, sibylle.stoec...@gmx.ch escreveu: Dear R-user Does anybody now, if ggplot allows to use two x-axis including two dimensions (similar to excel plot (picture 1 in the pdf attachmet). If yes, how should I adapt my code? The parameters are presented in the input file (attachm

Re: [R] ggplot adjust two y-axis

2023-11-25 Thread CALUM POLWART
rd Giguère > Sent: Friday, November 24, 2023 3:14 PM > To: sibylle.stoec...@gmx.ch; r-help@r-project.org > Subject: RE: [R] ggplot adjust two y-axis > > You could also use more simply facet_wrap(~ Studien_Flaeche). > Charles-Édouard > > -Message d'origine- > De : Char

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread John Kane
0,2500), labels = > c(0,500,1000,1500,2000,2500)) > > -Message d'origine- > De : sibylle.stoec...@gmx.ch > Envoyé : 24 novembre 2023 11:27 > À : 'Charles-Édouard Giguère' ; r-help@r-project.org > Objet : RE: [R] ggplot adjust two y-axis > > Dear Charles-Edoua

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
ère' ; r-help@r-project.org Objet : RE: [R] ggplot adjust two y-axis Dear Charles-Edouard Thanks a lot. Yes indeed barplot sounds excellent. Unfortunately, the scale of the smaller axis is fixed, even If I am able to draw to axes. The idea is to expand the scale to the scale to the second axis

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread sibylle.stoeckli
- From: Charles-Édouard Giguère Sent: Friday, November 24, 2023 3:57 PM To: sibylle.stoec...@gmx.ch; r-help@r-project.org Subject: RE: [R] ggplot adjust two y-axis Hi, I don't know the axis mecanism well enough in ggplot but using the original barplot function you can add an axis on the r

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
2)) axis(4, at = c(0, 5, 10), labels = c(0,50,100)) -Message d'origine- De : sibylle.stoec...@gmx.ch Envoyé : 24 novembre 2023 09:27 À : 'Charles-Édouard Giguère' ; r-help@r-project.org Objet : RE: [R] ggplot adjust two y-axis Dear Charles-Edouard Thanks a lot. So no

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
You could also use more simply facet_wrap(~ Studien_Flaeche). Charles-Édouard -Message d'origine- De : Charles-Édouard Giguère Envoyé : 24 novembre 2023 09:11 À : sibylle.stoec...@gmx.ch; r-help@r-project.org Objet : RE: [R] ggplot adjust two y-axis Hi Sibylle, For that kind of

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
Hi Sibylle, For that kind of data with two different scales, I generally use two graphs that I name gg1 and gg2 and join them using gridExtra::grid.arrange(gg1, gg2). This way, the red part of your graph is easier to interpret. Have a nice day, Charles-Édouard -Message d'origine- De :

Re: [R] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-13 Thread John Kane
Hi John, This should do what you want. I've changed your data.frame name for my own convenience to "dat1". ###=== dat1 <- data.frame( Time = c("Age.25","Age.35","Age.45","Age.55"), Medians = c(128.25,148.75,158.5,168.75) ) # create segments data.frame

Re: [R] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-12 Thread Jim Lemon
Hi John, I'm not sure how to do this with ggplot, but: Time<- c("Age.25","Age.35","Age.45","Age.55") Medians<-c(128.25,148.75,158.5,168.75) > is.character(Time) # [1] TRUE - thus it has no intrinsic numeric value to plot > is.numeric(Medians) # [1] TRUE # coerce Medians to factor and then plot aga

Re: [R] ggplot pointrange from other df and missing legend

2022-05-16 Thread PIKAL Petr
data frame? Best regards Petr > -Original Message- > From: Rui Barradas > Sent: Monday, May 16, 2022 1:53 PM > To: PIKAL Petr ; r-help@r-project.org > Subject: Re: [R] ggplot pointrange from other df and missing legend > > Hello, > > In the code below the legen

Re: [R] GGPLOT: Superscript text in body of plot

2022-01-29 Thread Rui Barradas
Hello, And with annotate, the warning goes away. ggplot(jjdata, aes(x=x, y=y))+ geom_point(size=2,shape=1)+ annotate( "text", x=3, y=7.5, label="R^{2} == 0.23", parse = TRUE ) Hope this helps, Rui Barradas Às 20:04 de 29/01/2022, Rui Barradas escreveu: Hello, Here is

Re: [R] GGPLOT: Superscript text in body of plot

2022-01-29 Thread Rui Barradas
Hello, Here is a way. ggplot(jjdata, aes(x=x, y=y))+ geom_point(size=2,shape=1)+ geom_text(x=3, y=7.5, label=expression(paste(R^2 == '0.23'))) Hope this helps, Rui Barradas Às 19:32 de 29/01/2022, Sorkin, John escreveu: Can you help me create text that has a superscript 2? I am trying

Re: [R] ggplot geom_line problem

2021-08-29 Thread phil
Thank you Jeff. This solves my problem. On 2021-08-28 21:54, Jeff Newmiller wrote: Maybe you will find that coord_cartesian( ylim=c(-30,30) ) works better since it doesn't filter out data before rendering. On August 28, 2021 6:45:11 PM PDT, p...@philipsmith.ca wrote: I am preparing a time serie

Re: [R] ggplot geom_line problem

2021-08-28 Thread Jeff Newmiller
Maybe you will find that coord_cartesian( ylim=c(-30,30) ) works better since it doesn't filter out data before rendering. On August 28, 2021 6:45:11 PM PDT, p...@philipsmith.ca wrote: >I am preparing a time series plot using the ggplot function. It includes >an area plot outlined at its edges w

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
noticed it. It may indeed make sense to more fully specify package::function notation in anything you let others use as they may indeed load more packages … From: John C Frain Sent: Thursday, August 26, 2021 3:17 PM To: Kai Yang Cc: r-help@r-project.org; Avi Gross Subject: Re: [R

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Avi Gross via R-help
indeed load more packages … From: John C Frain Sent: Thursday, August 26, 2021 3:17 PM To: Kai Yang Cc: r-help@r-project.org; Avi Gross Subject: Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Andrew Simmons
Hello, Package 'officer' has a function 'read_xlsx', so when you attach those packages in that order, it returns 'read_xlsx' from package 'officer' instead of 'readxl'. To avoid the confusion, instead of eth <- read_xlsx("c:/temp/eth.xlsx") try eth <- readxl::read_xlsx("c:/temp/eth.xlsx") whi

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Bill Dunlap
The packages "officer" and "readxl" both contain functions named "read_xlsx". It looks like you want the one from readxl so refer to it as readxl::read_xlsx instead of just read_xlsx. -Bill On Thu, Aug 26, 2021 at 12:03 PM Kai Yang via R-help wrote: > Hi all, > I found something, but I don't

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread John C Frain
officer redefines the read_xlsx command. You should have got a message to that effect when you loaded the officer package. You can use the version from the readxl package with readxl::read_xlsx() command. John C Frain 3 Aranleigh Park Rathfarnham Dublin 14 Ireland www.tcd.ie/Economics/staff/fr

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
Hi all, I found something, but I don't know why it happen. when I submitted the following code, the Eth is data frame. I can see 14 obs. of 2 variables library(readxl) library(ggplot2) eth <- read_xlsx("c:/temp/eth.xlsx") but when I add more package (see below,) the Eth is "List of 1" library(r

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
Hi All, 1. the eth is a data frame (not sure that based on error message?) that I load it from excel file. Here is the code: eth <- read_xlsx("c:/temp/eth.xlsx") 2. I try to use the code to convert eth into eth2, but I got error message: > eth2 <- data.frame(eth) Error in as.data.frame.default(x[

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Avi Gross via R-help
Kai, The answer is fairly probable to find if you examine your variable "eth" as that is the only time you are being asked to provide the argument as in "ggplot(data=eth, ..) ...) As the message states, it expects that argument to be a data frame or something it can change into a data.frame.

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Andrew Simmons
The class of 'eth' must be incorrect. You could try 'as.data.frame' or possibly 'as.list' to convert 'eth' to an acceptable form. On Thu, Aug 26, 2021, 11:53 Kai Yang via R-help wrote: > Hello List, > I got an error message when I submit the code below > ggplot(eth, aes(ymax=ymax, ymin=ymin, xma

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Thierry Onkelinx via R-help
eth is not a dataframe but of the class rxlsx. You'll need to convert eth into a dataframe. ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg /

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Avi Gross via R-help
+ geom_rect() + coord_polar(theta="y") + xlim(c(2, 4)) + scale_fill_discrete( labels = eth$label) + theme(axis.ticks = element_blank(), axis.text = element_blank()) Only one of the two above is actually needed, and you can experiment. I can send you personally an attachm

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Kai Yang via R-help
Got it.Thank you. On Friday, August 13, 2021, 03:03:26 PM PDT, Bert Gunter wrote: It's dput()  *not* dupt() .  ?dput tells you how to use it (as usual). Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkel

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Bert Gunter
It's dput() *not* dupt() . ?dput tells you how to use it (as usual). Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Aug 13, 2021 at 2:48 PM Kai Yang via

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Kai Yang via R-help
Hello John, I put my testing data below. I'm not sure how to use dupt() function. would you please give me an example? Thanks, Kai | ethnicity | individuals | | Caucasian | 36062 | | Ashkenazi Jewish | 4309 | | Multiple | 3193 | | Hispanic | 2113 | | Asian. not specified | 1538 | | Chinese | 1

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread John Kane
Would you supply some sample data please? A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with. On Thu, 12 Aug 2021 at 11:45, Kai Yang via R-help

Re: [R] ggplot complicated ylab

2020-12-16 Thread tring
Til: r-help@r-project.org; tr...@gvdnet.dk; r-help mailing list Emne: Re: [R] ggplot complicated ylab Perhaps [1] has some useful ideas? [1] https://stackoverflow.com/questions/13223846/ggplot2-two-line-label-with-exp ression On December 16, 2020 5:02:59 AM PST, tr...@gvdnet.dk wrote: >Dear fr

Re: [R] ggplot complicated ylab

2020-12-16 Thread Jeff Newmiller
Perhaps [1] has some useful ideas? [1] https://stackoverflow.com/questions/13223846/ggplot2-two-line-label-with-expression On December 16, 2020 5:02:59 AM PST, tr...@gvdnet.dk wrote: >Dear friends - I need an ylab on 2 lines - > >Here is what I want: > >exp <- expression(paste("Cumulative Na-Cl

Re: [R] ggplot 3-color gradient scales

2020-08-25 Thread Rui Barradas
Hello, If you want a predetermined number of colors, discretise the data and use scale_color_manual. In the code below I first compute another vector z, with a different range, 0 to 2. (In my first mail it was 0 to 1.) g <- function(x, a = 0, b = 1){ (b - a)*(x - min(x))/(max(x) - min(x)) +

Re: [R] ggplot 3-color gradient scales

2020-08-25 Thread PIKAL Petr
Hi Maybe scale_colour_manual? Cheers Petr > -Original Message- > From: R-help On Behalf Of April Ettington > Sent: Tuesday, August 25, 2020 11:39 AM > To: Rui Barradas > Cc: r-help@r-project.org > Subject: Re: [R] ggplot 3-color gradient scales > > Is there a

Re: [R] ggplot 3-color gradient scales

2020-08-25 Thread April Ettington
Is there a way to set it to 3 color categories instead of a gradient? Like if the color is based on the numbers in a dataframe column, can I make it so anything >1.2 is red, <0.8 is blue, and anything in the middle is green? On Mon, Aug 24, 2020 at 6:28 PM April Ettington wrote: > Thank you so

Re: [R] ggplot 3-color gradient scales

2020-08-23 Thread April Ettington
Thank you so much! On Mon, Aug 24, 2020 at 5:33 PM Rui Barradas wrote: > Hello, > > Note that the midpoint argument can make a big difference. In the code > below try commenting out the line where the default is changed. > > > f <- function(x){ >(x - min(x))/(max(x) - min(x)) > } > > librar

Re: [R] ggplot 3-color gradient scales

2020-08-23 Thread Rui Barradas
Hello, Note that the midpoint argument can make a big difference. In the code below try commenting out the line where the default is changed. f <- function(x){ (x - min(x))/(max(x) - min(x)) } library(ggplot2) df1 <- iris[3:5] names(df1)[1:2] <- c("x", "y") df1$z <- ave(df1$y, df1$Species

Re: [R] ggplot 3-color gradient scales

2020-08-23 Thread Jeff Newmiller
Check out scale_colour_gradient2() On August 23, 2020 8:12:06 PM PDT, April Ettington wrote: >Currently I am using these settings in ggplot to make a gradient from >red >to blue. > >geom_point( aes(x, y, color=z) ) + >scale_colour_gradient(low = "red",high = "blue") + > >z is a ratio, and curren

Re: [R] ggplot to visualize data

2020-06-08 Thread Rui Barradas
Hello, Inline. Às 17:18 de 08/06/20, Neha gupta escreveu: I am still waiting for someone to respond. If someone want to help other, they do not need a special platform for it. Thank you, yet again for not helping. 1. You have waited 41 minutes. 2. You have not posted data and code. 3. Rea

Re: [R] ggplot to visualize data

2020-06-08 Thread Martin Møller Skarbiniks Pedersen
On Mon, 8 Jun 2020 at 18:25, Neha gupta wrote: > I am still waiting for someone to respond. > > Please read this guide about asking questions and try again on the correct mailing-list. https://www.r-project.org/posting-guide.html Regards Martin [[alternative HTML version deleted]]

Re: [R] ggplot to visualize data

2020-06-08 Thread Neha gupta
I am still waiting for someone to respond. If someone want to help other, they do not need a special platform for it. Thank you, yet again for not helping. Regards On Mon, Jun 8, 2020 at 5:41 PM Bert Gunter wrote: > Largely off topic here. RStudio has Help forums on ggplot and other of its >

Re: [R] ggplot to visualize data

2020-06-08 Thread Bert Gunter
Largely off topic here. RStudio has Help forums on ggplot and other of its R software products. Post there. Or on stats.stackexchange.com perhaps for questions about how to visualize statistical data. See the posting guide linked below for what is ON topic here. Bert Gunter "The trouble with havi

Re: [R] ggplot get rid of unused/empty facets

2020-04-30 Thread PIKAL Petr
f Ivan Calandra > Sent: Thursday, April 30, 2020 12:28 PM > To: r-help@r-project.org > Subject: Re: [R] ggplot get rid of unused/empty facets > > Dear Petr, > > This is not a ggplot2 solution, but you could just remove the NA rows and > drop the levels of vzorek: > met2 <

Re: [R] ggplot get rid of unused/empty facets

2020-04-30 Thread Ivan Calandra
Dear Petr, This is not a ggplot2 solution, but you could just remove the NA rows and drop the levels of vzorek: met2 <- met[complete.cases(met), ] met2$vzorek <- droplevels(met2$vzorek) But I guess you already thought about that...! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology an

Re: [R] ggplot stat smooth and poly

2020-04-05 Thread Deepayan Sarkar
On Thu, Apr 2, 2020 at 6:10 PM PIKAL Petr wrote: > Dear all > > I am not sure, but I believe that in past it was possible to add smoothing > lines in ggplot even if some group did not have enough points to perform > calculation (although I did not find any version which could deliver it). > > Her

Re: [R] ggplot inside of the function

2019-11-25 Thread Thevaraja, Mayooran
Great it works. Thank you so much Eric. Cheers, Mayooran -Original Message- From: Eric Berger Sent: Monday, 25 November 2019 11:22 PM To: Thevaraja, Mayooran Cc: r-help Subject: Re: [R] ggplot inside of the function Hi Mayooran, If you define the following function f <- functio

Re: [R] ggplot inside of the function

2019-11-25 Thread Eric Berger
Hi Mayooran, If you define the following function f <- function(m,v) { sprintf("Norm(mu=%.1f, var=%.1f)",m,v) } Then you can modify the setting of Prob as follows Prob <- plyr::rename(Prob_df, c("p_1"=f(mu1,var1),"p_2"=f(mu2,var2),"p_3"=f(mu3,var3))) The lesson here is that wherever you set a

Re: [R] ggplot - position=position_dodge()) and scale_y_continuous

2019-07-30 Thread Rui Barradas
Hello, You must use a categorical variable in 'fill'. Example: (I also set the fill colours to something else.) ggplot(data = datax, aes(x = x, y = y, fill = factor(fac))) + geom_bar(stat = "identity", color = "black", position = position_dodge()) + theme_minimal() + scale_fil

Re: [R] GGPlot plot

2018-07-18 Thread Francesca
Thanks for the answer. Il gio 19 lug 2018, 01:04 Jim Lemon ha scritto: > Hi Francesca, > This looks like a fairly simple task. Try this: > > fpdf<-read.table(text="PASP SUBJC > 0 0 > 4 1 > 0 0 > 8 0 > 4 0 > 0 1 > 0 1", > he

Re: [R] GGPlot plot

2018-07-18 Thread Jim Lemon
Hi again, Sorry, forgot this line: fpdf$PASPpos<-fpdf$PASP > 0 just after reading in the data frame. Jim On Thu, Jul 19, 2018 at 9:04 AM, Jim Lemon wrote: > Hi Francesca, > This looks like a fairly simple task. Try this: > > fpdf<-read.table(text="PASP SUBJC > 0 0 > 4 1

Re: [R] GGPlot plot

2018-07-18 Thread Jim Lemon
Hi Francesca, This looks like a fairly simple task. Try this: fpdf<-read.table(text="PASP SUBJC 0 0 4 1 0 0 8 0 4 0 0 1 0 1", header=TRUE) # get the number of positive PASP results by group ppos<-by(fpdf$SUBJC,fpdf$PASPpos,su

Re: [R] GGPlot plot

2018-07-18 Thread Jeff Newmiller
On Wed, 18 Jul 2018, Francesca wrote: Dear R help, I am new to ggplot so I apologize if my question is a bit obvious. Or perhaps not, as this is the "R-help" mailing list, not the "Ggplot-help" mailing list. Fortunately for you, what you really need to learn is R, and then ggplot will be

Re: [R] GGPlot plot

2018-07-18 Thread Rui Barradas
Hello, Your request is not entirely clear. What kind of a graph do you want? A bar graph with a bar of the fraction of positive levels of PASP per each level of SUBJC? You need to be more specific. Also, please post data like this: # post the output of this command in your next mail dput(hea

Re: [R] ggplot and boxplots

2018-03-13 Thread Yectli Huerta via R-help
On March 12, 2018 11:59 PM, Richard M. Heiberger wrote: > It looks like your V3 is a factor. > > testing_ggplot <- data.frame( > > V1=factor(c(256, 256, 256, 272, 272, 272)), > > V2=c("Disabled", "Disabled", "Enabled", "Disabled", "Enabled", "Enabled"), > > V3=681:686) > thanks for the exp

Re: [R] ggplot and boxplots

2018-03-12 Thread Richard M. Heiberger
It looks like your V3 is a factor. testing_ggplot <- data.frame( V1=factor(c(256, 256, 256, 272, 272, 272)), V2=c("Disabled", "Disabled", "Enabled", "Disabled", "Enabled", "Enabled"), V3=681:686) library(ggplot2) ggplot(testing_ggplot, aes(V2,V3 )) + geom_boxplot() + facet_wrap( ~ V

Re: [R] Ggplot error

2017-11-08 Thread John Kane via R-help
I get the same result as Eric  withR version 3.4.2 (2017-09-28) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 17.04 It looks like you have "tidyverse" loaded so I tried it with just ggplot2 loaded and with tidyverse loaded.  On Wednesday, November 8, 2017, 4:16:14 AM EST, Eri

Re: [R] Ggplot error

2017-11-08 Thread Zeki ÇATAV
Thanks, I think, I found the problem. It seems to related locale setting. If I start with 'LANG=C R' everything's good. -- Zeki Çatav zekicatav.com On Nov 8, 2017 1:56 PM, "John Kane" wrote: I get the same result as Eric with R version 3.4.2 (2017-09-28) Platform: x86_64-pc-linux-gnu (64-bit)

Re: [R] Ggplot error

2017-11-08 Thread Eric Berger
I was not able to reproduce this problem. I tried two environments 1. Ubuntu 14.04.5 LTS, R version 3.4.2 (same R version as yours) 2. Windows 10, same R version On Wed, Nov 8, 2017 at 9:50 AM, Zeki ÇATAV wrote: > Hello, > I've an error recently. > > ggplot(data = mtcars, aes(x= wt, y= mpg)) +

Re: [R] ggplot inside function doesn't plot

2017-11-02 Thread David Winsemius
> On Nov 2, 2017, at 10:03 AM, Ed Siefker wrote: > > I don't really understand. I mean, I understand the solution is > print(ggplot(...)). But why is that required in a function and not at > the console? The REPL design of the interactive console is offered the user as a convenience, but I ag

Re: [R] ggplot inside function doesn't plot

2017-11-02 Thread Duncan Murdoch
On 02/11/2017 1:03 PM, Ed Siefker wrote: I don't really understand. I mean, I understand the solution is print(ggplot(...)). But why is that required in a function and not at the console? Shouldn't I be able to rely on what I do at the console working in a script? Is this inconsistent behavior

Re: [R] ggplot inside function doesn't plot

2017-11-02 Thread Richard M. Heiberger
FAQ 7.22 Open the file indicated by system.file("../../doc/FAQ") and scroll down to 7.22 On Thu, Nov 2, 2017 at 1:03 PM, Ed Siefker wrote: > I don't really understand. I mean, I understand the solution is > print(ggplot(...)). But why is that required in a function and not at > the console? >

Re: [R] ggplot inside function doesn't plot

2017-11-02 Thread Ed Siefker
I don't really understand. I mean, I understand the solution is print(ggplot(...)). But why is that required in a function and not at the console? Shouldn't I be able to rely on what I do at the console working in a script? Is this inconsistent behavior by design? On Thu, Nov 2, 2017 at 11:54

Re: [R] ggplot inside function doesn't plot

2017-11-02 Thread David Winsemius
> On Nov 2, 2017, at 9:27 AM, Ed Siefker wrote: > > I have a function: > > myplot <- function (X) { >d <- plotCounts(dds2, gene=X, intgroup="condition", returnData=TRUE) >png(paste("img/", X, ".png", sep="")) >ggplot(d, aes(x=condition, y=count, color=condition)) + >geom_poi

Re: [R] ggplot inside function doesn't plot

2017-11-02 Thread PIKAL Petr
Hi You have to print it. just add print(all ggplot stuff) inside the function. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ed Siefker > Sent: Thursday, November 2, 2017 5:27 PM > To: r-help > Subject: [R] ggplot inside function d

Re: [R] ggplot / second axis / just a notation problem

2017-10-17 Thread John
Yes, I did. I should have posted the results here. "~./5" works, but "~.-3" does not. Multiplication and division should work; I am wondering how I should present the plus and the minus in this context. Thanks, John 2017-10-17 2:47 GMT-07:00 Eric Berger : > Hi John, > Why not just try both and

Re: [R] ggplot / second axis / just a notation problem

2017-10-17 Thread Eric Berger
Hi John, Why not just try both and see which one makes sense? On Tue, Oct 17, 2017 at 12:24 PM, John wrote: > Hi, > >I have a question on ggplot2 with the second axis, but I don't think one > needs to know ggplot2 package in order to answer this question. > >In this example, > https://r

Re: [R] ggplot: Pie Chart with correct labels

2017-05-30 Thread Jeff Newmiller
>1. get the order of the labels right You need to order your labels in the Land factor correctly when you create it with the factor function, which was (not) done here but rather before you used dput to generate this code. >2. Why I need to reference "breaks" and "labels" completely? Read the

Re: [R] ggplot problem

2017-05-24 Thread Thierry Onkelinx
Dear Greg, Make sure that your x variable (Betas) is categorical. That is required for geom_boxplot(). And please do read the posting guide. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / t

Re: [R] ggplot expressions

2017-03-20 Thread David Winsemius
> On Mar 20, 2017, at 4:42 AM, Troels Ring wrote: > > Dear friends - here is an example of something that I find annoying > > library(ggplot2) > DDF <- data.frame(x=x<-seq(1,10),y=x^2) > G <- ggplot(data=DDF,aes(x=x,y=y)) + geom_point() > GG<-G+ylab(expression(paste("Total ",CO[2]," halved")))

Re: [R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread Hadley Wickham
You are going to find your life much easier if you: * Organise your code so it's easier to read * Use a consistent naming scheme for your variables * Learn a bit more about how to modify variables succintly Here's my rewriting of your script to make it easier to see what's going on. library(tidy

Re: [R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread John Kane via R-help
I cannot see how you get that code to run. It certainly does not on my machine and some of the manipulations don't make any sense as far as I can see. I changed variable and data.frame names so I would not have to type so much and read in the data with the "stringsAsFactors = FALSE" option. I the

Re: [R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread Thierry Onkelinx
Here is a solution ggplot(exdatframe2) + geom_tile(aes(x = exdatframeT, y = Name, fill = knownstate), colour = "black", height = 0.5) + scale_fill_discrete(na.value = "white") Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest

Re: [R] ggplot grouped barchart based on marginal proportions

2016-09-27 Thread Crump, Ron
Hi Paul, Do you want to avoid using prop.table(mtcars_xtab, 1) ? If not, how about: ggplot(as.data.frame(prop.table(mtcars_xtab, 1)))+ geom_bar(aes(x=Var2,y=Freq,fill=Var1), stat="identity", position="dodge")+ scale_fill_brewer(palette="Set2") Ron. __

Re: [R] GGplot annotate by facet

2016-09-10 Thread John Kane
Hi Saad, Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html for some suggestions on how to ask a question on R-help In particular it would be handy to have some sample data in dput() for

Re: [R] ggplot: geom_bar not respecting factor order when stacking

2016-02-04 Thread PIKAL Petr
Hi So if the legend is in correct order you need to reorder the sequence of bars from top/bottom to bottom/top here is one solution. ggplot(temp, aes(x=trait, y = value)) + geom_bar(stat = "identity", aes(fill=varlevel, order= -as.numeric(varlevel))) Cheers Petr > -Original Message- >

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-10 Thread Bert Gunter
tAnywhere(as.lm) > no object named ‘as.lm’ was found > > > I also found a couple of posts on R-bloggers pointing me to the ‘propagate' > package which has two different methods for constructing confidence intervals. > > http://rmazing.wordpress.com/2013/08/14/predictnls-part

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-10 Thread David Winsemius
different methods for constructing confidence intervals. http://rmazing.wordpress.com/2013/08/14/predictnls-part-1-monte-carlo-simulation-confidence-intervals-for-nls-models/ http://rmazing.wordpress.com/2013/08/26/predictnls-part-2-taylor-approximation-confidence-intervals-for-nls-models/ — David

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-09 Thread Catarina Silva
t = list(a=1,b=2)) Error in pred$fit : $ operator is invalid for atomic vectors > Return error... Ty, Catarina Silva -Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: sábado, 7 de Novembro de 2015 01:09 To: bolseiro.raiz.csi...@portucelsoporcel.com; R mailling l

Re: [R] [GGplot] Geom_smooth with formula "power"?

2015-11-06 Thread Jeff Newmiller
Does [1] help? [1] http://stackoverflow.com/questions/10528631/add-exp-power-trend-line-to-a-ggplot --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live

Re: [R] ggplot: combining geom's in function

2015-10-24 Thread Jeff Newmiller
If you want to use the lattice way of doing things, why are you using ggplot? `+` is defined for the output of ggplot (class "waiver") on the left, and the output of a layer function ("proto") on the right. The design of ggplot assumes left-to-right evaluation, which your first attempt failed to

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
Following up on my previous reply, this following would work but would not behave like a geom function: geom_xyplot <- function (gplot, mapping = NULL, data = NULL, stat = "identity", position = "identity", na.rm = FALSE, type = 'p', ...) { if (any(type=='p')){

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
Hi Thanks for the suggestion. Unfortunately, the qplot function would work nicely if only I did not need to combine its output with other geom called before... A simple example using the data previously described: ggplot(data, aes(x,y,group=g)) + geom_blank() + qplot(x=x,y=y,data=data,group

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread Erich Neuwirth
I often look for examples in http://www.cookbook-r.com/Graphs/ > On 23 Oct 2015, at 18:27, Jeff Newmiller wrote: > > Have you looked at the qplot function in the ggplot2 package? > --- > J

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread Jeff Newmiller
Have you looked at the qplot function in the ggplot2 package? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] ggplot percent format for interest rates

2015-07-26 Thread John Kane
Hi Glenn, I don't understand what you are after. If I run your code I get two figures to the right of the decimal point. Can you give us an example of the layout you want? Clearly I am missing the point. Note I removed the palate command from the code, ggplot(SwapCurve, aes(x = Tenor, y= Rate

Re: [R] ggplot stat_bin question

2015-06-03 Thread John Kane
I don't think there is any reason to get rid of that message unless you have a presentation problem, that is, you are including that output in a paper. All that is, AFAIK, is a notice that ggplot() is using the default binning rule. You can change the number of the bins if you need more gran

Re: [R] ggplot stat_bin question

2015-06-03 Thread Thierry Onkelinx
Dear Glenn, Your code contains a typo: it has bindwidth instead of binwidth. Fixing that will no longer show the message. AFAIK, the message is always displayed when binwidth is not set. You can use suppressMessages() to hide them. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bos

Re: [R] ggplot: connect points with line (not in order)

2015-04-05 Thread Brian Smith
thanks! On Sun, Apr 5, 2015 at 9:15 AM, billy am wrote: > Will this do? > > ggplot(mydat,aes(xx,yy)) + geom_path() > > From : > http://stackoverflow.com/questions/15706281/controlling-order-of-points-in-ggplot2-in-r > > > >

  1   2   3   4   >