Re: [R] ggsave() with width only

2021-09-20 Thread Ivan Calandra
Dear Adam, This would work indeed, but then the default aspect ratio (1.618) would be used. I could as well calculate the height from the width and aspect ratio. Unfortunately, this doesn't help me in my case (but as I said, I have found a workaround). Thank you again. Ivan -- Dr. Ivan Cal

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,

Re: [R] Improve my plot

2021-09-20 Thread Jim Lemon
Hi varin, Not too difficult: par(mar=c(5,13,4,1)) barplot(height=c(574,557,544,535,534,532,531,527,526,525,524,520,518, 512,507,504,504,489,488,488,487,484,484,474,472,455,444,420), names.arg=c("Fribourg(f)","Valais(d)", "Appenzell Rhodes Intérieures","Fribourg(d)","Jura","Schwyz", "Schaffhouse"

[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, positi

Re: [R] Improve my plot

2021-09-20 Thread Bert Gunter
Don't do this! Use a dotchart instead. See the Wikipedia article on dotplots or search. height=c(574,557,544,535,534,532,531,527,526,525,524,520,518,512,507,504,504,489,488,488,487,484,484,474,472,455,444,420) ## kudos for plotting the sorted results rather than alphabetically. nm <- c("Fribourg

Re: [R] Improve my plot

2021-09-20 Thread varin sacha via R-help
Hi Rui, Many thanks but when I copy and paste your R code here below I get 2 error mesages : ## h <- c(574,557,544,535,534,532,531,527,526,525,         524,520,518,512,507,504,504,489,488,488,         487,484,484,474,472,455,444,420) nms <- c("Fribourg(f)","Valais(d)","Appenzell Rho

Re: [R] Improve my plot

2021-09-20 Thread Rui Barradas
Hello, With package ggplot2 this is easy. ggplot2 is meant to work with data in lists or data.frames, so I use the new pipe operator to pass the data on to ggplot(). h <- c(574,557,544,535,534,532,531,527,526,525, 524,520,518,512,507,504,504,489,488,488, 487,484,484,474,472,455,

Re: [R] ggsave() with width only

2021-09-20 Thread Adam Wysokiński via R-help
Dear Ivan, I think you don't need to provide the aspect ratio, as this should work as well: save_plot("/tmp/plot.png", p, base_width = 5, base_height = NULL) -- Regards, Adam Wysokiński On 9/20/21 16:09, Ivan Calandra wrote: Dear Adam, The function cowplot::save_plot() actually doesn't help

[R] Improve my plot

2021-09-20 Thread varin sacha via R-help
Dear R-experts, Here below my R code. I would need your help to improve my graph/plot. - The x-axis to be longer not to stop at 500 value - All the name on the y-axis to appear not only a few of them and the name (Fribourg(f), Appenzell Rhodes Intérieures,...) to appear entire, not to be cut Ma

Re: [R] ggsave() with width only

2021-09-20 Thread Ivan Calandra
Dear Adam, The function cowplot::save_plot() actually doesn't help in my case because I need to know the aspect ratio (which I don't in advance). If I knew the aspect ratio, I could calculate the height from the width or vice-versa, and then I could use ggplot2::ggsave(). I have found a work