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

[R] ggplot two-factor legend

2024-07-18 Thread SIBYLLE STÖCKLI via R-help
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 with the colors for the group and one with the linetype for th

Re: [R] ggplot 3-dimensions

2023-12-17 Thread Rui Barradas
Kind regards Sibylle -----Original Message- From: R-help On Behalf Of SIBYLLE STÖCKLI via R-help Sent: Saturday, December 16, 2023 12:16 PM To: R-help@r-project.org Subject: [R] ggplot 3-dimensions Dear R-user Does anybody now, if ggplot allows to use two x-axis including two dimension

Re: [R] ggplot 3-dimensions

2023-12-17 Thread SIBYLLE STÖCKLI via R-help
e angel of the x-axis. However, I was able to change the first x-axis (BB...), but not the second one (Voegel). Maybe this would solve the problem. - If not, is there another possibility to fix the number of subplots per line? Kind regards Sibylle -----Original Message- From: R-help On Beha

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
-- De : R-help De la part de sibylle.stoec...@gmx.ch Envoyé : 24 novembre 2023 05:52 À : r-help@r-project.org Objet : [R] ggplot adjust two y-axis Dear R-users Is it possible to adjust two y-axis in a ggplot differently? - First y axis (0-60) - Second y axis (0-2500) ### Figure 1 ggplot(Fig1,ae

[R] ggplot adjust two y-axis

2023-11-24 Thread sibylle.stoeckli
Dear R-users Is it possible to adjust two y-axis in a ggplot differently? - First y axis (0-60) - Second y axis (0-2500) ### Figure 1 ggplot(Fig1,aes(BFF,Wert,fill=Studien_Flaeche))+ geom_bar(stat="identity",position='dodge')+ scale_y_continuous(name="First Axis", sec.axis=sec_axis(trans=~.*

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

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

2023-07-12 Thread Sorkin, John
I am trying to plot four points, and join the points with lines. I can plot the points, but I can't plot the points and the line. I hope someone can help my with my ggplot code. # load ggplot2 if(!require(ggplot2)){install.packages("ggplot2")} library(ggplot2) # Create data Time <- c("Age.

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

[R] ggplot pointrange from other df and missing legend

2022-05-16 Thread PIKAL Petr
Hallo all Here are the data from dput test <- structure(list(Sample = c("A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C"), SSAtype = c("one", "one", "one", "two", "two", "two", "one", "one", "one", "two", "two", "two", "one", "one", "one", "two", "

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

[R] ggplot question

2021-09-15 Thread Kai Yang via R-help
Hello List, I use ggplot to draw a stack bar chart. but I error message. please look it below: > ggplot(s8_plot, aes(fill=GTresult, y=cases, x=gc_label) + + geom_bar(position="stack", stat="identity")) Error: Mapping should be created with `aes()` or `aes_()`. GTresult and gc_label are chara

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

[R] ggplot geom_line problem

2021-08-28 Thread phil
I am preparing a time series plot using the ggplot function. It includes an area plot outlined at its edges with a line plot. For some reason the line plot, drawn with geom_line(), has some broken portions where the line does not appear, although the filled geom_area() part of the plot is shown

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
Avi -Original Message- From: R-help mailto:r-help-boun...@r-project.org> > On Behalf Of Kai Yang via R-help Sent: Thursday, August 26, 2021 11:53 AM To: R-help Mailing List mailto:r-help@r-project.org> > Subject: [R] ggplot error of "`data` must be a data frame, or other o

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
ta frame or > something it can change into a data.frame. What you gave it probably is an > object meant to represent an EXCEL file or something. You may need to > extract a data.frame (or tibble or ...) from it before passing that to > ggplot. > > Avi > > -Original Message

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
) > > As the message states, it expects that argument to be a data frame or > something it can change into a data.frame. What you gave it probably is an > object meant to represent an EXCEL file or something. You may need to > extract a data.frame (or tibble or ...) from it before passing

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
it can change into a data.frame. What you gave it probably is an > object meant to represent an EXCEL file or something. You may need to > extract a data.frame (or tibble or ...) from it before passing that to > ggplot. > > Avi > > -Original Message- > From: R-help

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
m it before passing that to ggplot. Avi -Original Message- From: R-help On Behalf Of Kai Yang via R-help Sent: Thursday, August 26, 2021 11:53 AM To: R-help Mailing List Subject: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3

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
om: R-help On Behalf Of Kai Yang via R-help Sent: Thursday, August 26, 2021 11:53 AM To: R-help Mailing List Subject: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx" Hello List, I got an error message when I

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
ust 26, 2021 11:53 AM To: R-help Mailing List Subject: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx" Hello List, I got an error message when I submit the code below ggplot(eth, aes(ymax=ymax, ymin=y

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 /

[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
Hello List, I got an error message when I submit the code below ggplot(eth, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=ethnicity)) +  geom_rect() +  coord_polar(theta="y")  +  xlim(c(2, 4)   )  Error: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object wit

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

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

2021-08-12 Thread Kai Yang via R-help
Hello List, I use the following code to generate a donut plot. # Compute percentages eth$fraction = eth$individuals / sum(eth$individuals) # Compute the cumulative percentages (top of each rectangle) eth$ymax = cumsum(eth$fraction) # Compute the bottom of each rectangle eth$ymin = c(0, head(eth$yma

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

[R] ggplot complicated ylab

2020-12-16 Thread tring
Dear friends - I need an ylab on 2 lines - Here is what I want: exp <- expression(paste("Cumulative Na-Cl balance ","\n", "and (red) ",Delta,HCO[3]^"-"," mmol")) So if exp was OK ylab(exp) would work - but the "\n" doesn't seem to do anything and it all comes on one lin

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

[R] ggplot 3-color gradient scales

2020-08-23 Thread April Ettington
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 currently I am able to identify which have high and low values, but I'd really like to be able to distinguish

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

[R] ggplot to visualize data

2020-06-08 Thread Neha gupta
I have a model NN, which has 10 piece of data in 10 folds of test (ts) data such as 0.1, 0.5, 0.3 etc. And another model SVM, which also have this type of information. I usually visualize it like: boxplot (NN, SVM) I have two questions? (1) I want to ask how can I visualize them via ggplot? (2)

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

[R] ggplot get rid of unused/empty facets

2020-04-30 Thread PIKAL Petr
Dear all I seek some help how to remove unused facets in ggplot Here is my code p <- ggplot(met, aes(x=datum, y=lsp)) p+geom_point(size=5)+geom_line()+facet_grid(.~vzorek) As you can see, there are some empty facets. Is there any reasonably simple way how to automatically get rid of empty facets

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

[R] ggplot stat smooth and poly

2020-04-02 Thread PIKAL Petr
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). Here is the code and data library(ggplot2) p <- ggplot(test, aes(

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

[R] ggplot inside of the function

2019-11-24 Thread Thevaraja, Mayooran
Hello Folks I am working some R package development. When I was using ggplot inside of the function, I need to get the output graph's legend must be corresponding to the input parameters numerical value (need to be automatically changed when we input different parameters). Theref

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

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

2019-07-30 Thread Knut Krueger via R-help
Hello to all, how can I can set both y as character to get the bars beside like example 1 and use scale_y_continuous And an additional question: why are the bar colors of x-axes = 8 turned datax= data.frame("fac"=c(c(rep(1,10),c(rep(2,10,"x"=c(c(1:10,c(1:10))), "y"=c(89,69,46,57

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

[R] GGPlot plot

2018-07-18 Thread Francesca
Dear R help, I am new to ggplot so I apologize if my question is a bit obvious. I would like to create a plot where a compare the fraction of the values of a variable called PASP out of the number of subjects, for two groups of subject codified with a dummy variable called SUBJC. The variable

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

[R] ggplot and boxplots

2018-03-12 Thread Yectli Huerta via R-help
Hi, I was wondering if someone could give me a hint or two. I'm having problems generating ggplot2 boxplots . The plot that is has dots but no boxplots. Below is the dataset > testing_ggplot V1V2 V3 1 256 Disabled 688.61 2 256 Disabled 698.63 3 256 Disabled 700.02 4 256

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)) +

[R] Ggplot error

2017-11-08 Thread Zeki ÇATAV
Hello, I've an error recently. ggplot(data = mtcars, aes(x= wt, y= mpg)) + geom_line() Error: Found object is not a stat. > sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.3 LTS Matrix products: default BLAS: /usr/lib/openblas-base/li

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

[R] ggplot inside function doesn't plot

2017-11-02 Thread Ed Siefker
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_point(position=position_jitter(w=0.1,h=0)) + scale_y_log10

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

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

2017-10-17 Thread John
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://rpubs.com/MarkusLoew/226759 since the transformation of the second axis is given by y1=y2*5, # p <- p + scale_y_con

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

[R] ggplot: Pie Chart with correct labels

2017-05-30 Thread G . Maubach
Hi All, I would like to do the following pie chart using ggplot from an official data source ( http://www.deutscheweine.de/fileadmin/user_upload/Website/Service/Downloads/Statistik_2016-2017-neu.pdf , Tab 8, Page 14): -- cut -- cat("# weinimport_piechart.R\n") # -- Input -

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

[R] ggplot problem

2017-05-23 Thread greg holly
Hi all; When I run the following program substantially I have "Warning message: position_dodge requires non-overlapping x intervals" How I can overcome this problem. Regards, Greg p <- ggplot() + geom_point(data=a, aes(x=Betas, y=Traits, color= Super.Pathway), shape=15, size=4) p <- p + guide

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")))

[R] ggplot expressions

2017-03-20 Thread Troels Ring
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"))) GG GG+annotate("text",x=5,y=50,label=expression(paste("Total ",CO[

[R] ggplot: restricting legend with multiple geoms and nested groups

2017-02-07 Thread Szumiloski, John
Dear useRs: I am having difficulty understanding how to make a legend in ggplot when I only want certain geoms to be indicated, in the presence of nested groups. An example: require(tidyverse) dat <- tibble(X=rep(seq(4),3), # fake data Y=c(-1.11, -0.46, 0.02,

  1   2   3   4   5   6   >