Displaying 20 results from an estimated 700 matches similar to: "How can I make the legend in ggplot2 the same height as my plot?"
2023 Jun 28
1
horizontal grouped stacked plots and removing space between bars
I have code like this:
data <- read.csv("test1.csv", stringsAsFactors=FALSE, header=TRUE)
# Graph
myplot=ggplot(data, aes(fill=condition, y=value, x=condition)) +
geom_bar(position="dodge", stat="identity", width=0.5) +
scale_fill_manual(values=c("#7b3294", "#c2a5cf", "#a6dba0", "#008837"))+
2009 Nov 26
1
Barplot with confidence intervals
I have a file in the following format:
Scenario1 Scenario1CIL Scenario1CIU Scenario2 Scenario2CIL Scenario2CIU
60 57 62 45 48 50
110 101 111 51 50 52
120 117 122 64 62 66
192 190 194 79 75 79
where:
First column = Scenario1 mean value
Second column = Scenario1 Low Confidence Interval
Third column = Scenario1 Upper Confidence Interval
Fourth column = Scenario2 mean value
Fifth column =
2017 Jun 16
0
point size
You could add size = log10_P to the aes() inside geom_point().
Untested code below.
See also http://ggplot2.tidyverse.org/reference/geom_point.html
ggplot(mydata, aes(x = X, y = log10_P)) +
theme_bw() +
theme(panel.border=element_blank(), legend.position="top",
axis.text=element_text(size = 8)) +
geom_point(aes(color = Traits, size = log10_P))
Jean
On Fri, Jun 16, 2017 at
2017 Jun 16
2
point size
Hi all;
I am running the following ggplot codes. Runs well. However, I need to
reflect the numeric values of the log10_P to the point size in the graph.
Your help highly appreciated,
Regards,
Greg
p <- ggplot(mydata, aes(x = X, y = log10_P)) +
theme_bw() +theme(panel.border=element_blank())
+ theme(legend.position="top", axis.text=element_text(size = 8))
(p1 <- p +
2017 Nov 17
2
How to produce rainfall maps
Dear R users,
I need to produce rainfall maps using R.
I know that this is possible, I looked though the web, I found the example below reported (the author is Andrew Tredennick).
I would ask you if this is the most performing way to make rainfall maps; if yes would someone be able to give me an example of how file.asc and pointfile.csv should be? If no would somebody please show me another way
2008 Oct 24
1
Automatically adjust text size in plot
Hi all,
I'm writing a function that will automatically generate a report based
on answers to a questionnaire. The exact questions and answers to the
questionnaire can vary. One of the question types is in a "matrix"
format, where the agreement to several statements can be indicated on
a scale.
I'm planning to plot this on a multilevel barplot, and only labeling
each "bar
2017 Nov 21
0
How to produce rainfall maps
Hi,
You might get more help from the R-sig-geo list, which is devoted to
spatial topics.
However.
The *.asc file is an ArcGIS raster export format. You should use
whatever the appropriate import commands are for your own gridded
rainfall data. If you have a different format, you might or might not
be able to import it directly with raster.
?raster will tell you more about the kinds of formats
2017 Nov 10
1
How to create separate legend for each plot in the function of facet_wrap in ggplot2?
Hi R users,
I need to create more than 20 figures (one for each group) in one page. I
have a common legend for 20 figures using the facet_wrap. However the
range of the values among the groups are very wide. For example one group
has the value of 0 to 3, but the values of some of the groups has ranged
from 0 to 20 so that when I used a single common legend for all 20 figures,
I could not display
2018 Nov 14
2
Los puntos no tapen el mapa hecho ggplot
Buenos días. Hago mis mapas con el código que os copio abajo, pero me
gustaría que me dibujase las líneas del mapa después de poner los
puntos para que se vean. Puedo hacer los puntos más pequeños, pero
entonces quedan separados y yo quiero que rellenen el mapa.
Gracias, como siempre,
Manuel
print(ggplot(legend=FALSE)+geom_path(data=map_data('world'),
aes(x=long,
2013 Jan 24
1
Insert segment only on particular facets in ggplot
Dear R users,
I am working on a data-set with 3 species. They are apple, orange and
banana.
I want to annotate the facets only on the bottom panel. However, by default
I am getting annotations on all the plots. I was able to get text
annotation only on the desired plot. However, I am confused what I need to
do for the arrows / segments.
Here is my code:
library(ggplot2)
library(grid)
tempobs
2019 Sep 19
2
ggplot con gradientes complejos
Muy buenas. Quiero hacer un mapa que me pinte en azul los valores negativos
y en rojo los positivos. Los negativos llegan hasta -400 y los positivos
hasta 200. Si pongo limits=c(-200, 200), me colorea bien los positivos
(rojo), pero los negativos por debajo de -200 me los pone gris. Si pongo
limits=c(-400, 200), me colorea bien los negativos (azul), pero los
positivos apenas se ven. Necesito que
2018 Dec 12
2
Subset dentro de un for
Gracias a los tres, Raúl, Marcelino y Carlos.
Lo del "get" de Marcelino me da la respuesta a lo que yo exactamente
preguntaba, y funciona, pero ahora tengo problemas con el for, por lo
que probablemente recurra al eval parse de Raúl o Carlos, que ya
tienen el for. Aún así, lo intento 1º con el get.
Con subset(df, subset=get(GT[i])>0) el problema es que en el for hago
un
2013 Nov 01
1
Package(s) for making waffle plot-like figures?
Dear all,
I am trying to make a series of waffle plot-like figures for my data to
visualize the ratios of amino acid residues at each position. For each one
of 37 positions, there may be one to four different amino acid residues. So
the data consist of the positions, what residues are there, and the ratios
of residues. The ratios of residues at a position add up to 100, or close
to 100 (more on
2019 Sep 20
2
ggplot con gradientes complejos
Gracias Emilio. Si, son asimétricos porque se mueven en rangos distintos.
De hecho, miden cosas distintas, pero una muestra no puede ser positiva y
negativa a la vez. Me planteo multiplicar las positivas por 2 y al editar
el mapa corregirlo para que indique los valores reales. Eso funcionaría,
pero son muchos mapas y quizás haya una función en ggplot que evite el
problema directamente.
Manuel
El
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
Hi everyone (again),
before you all start screaming that the reordering of factors has been
discusse on several threads and is not particular to ggplot2, hear me out.
I can easily reorder my x-axis factor in facet.grid() in ggplot2. What I
cannot reorder are the factors represented on the strips. I can see that the
graphs are changing, so I am afraid of what it is I am doing. Why is ggplot2
2018 Dec 12
2
Subset dentro de un for
Gracias Marcelino. Si, (i in 1:length(GT)), lo he utilizado mil veces,
pero se me sigue olvidando de una vez a otra. Lo iba a mirar, pero me
centré primero en que me hiciera bien el mapa.
He probado el for y me da este error:
Error in aes(x = lon, y = lat, color = get(GT[i]), size = 2) +
scale_colour_gradient(low = ("white"), :
non-numeric argument to binary operator
2019 Sep 20
2
ggplot con gradientes complejos
No sé muy bien, Carlos, como hacerlo, pero no parece más sencillo que lo de
multiplicar por 2 los positivos y después editar el mapa.
De lo que decías, Emilio, de cambiar el color del punto central creo que
haría más confusa la interpretación.
El vie., 20 sept. 2019 a las 10:33, Carlos Ortega (<cof en qualityexcellence.es>)
escribió:
> Hola,
>
> Una alternativa que suele
2017 Aug 04
1
legend and values do not match in ggplot
I have following codes for ggplots. The legends are given in the plot do
not match with the values specified in the codes given below. Your helps
highly appreciated.
Greg
library(ggplot2)
p <- ggplot(a,aes(x=NO_BMI_FI_beta ,y=FI_beta ,color= Super.Pathway))+
theme_bw() +theme(panel.border=element_blank()) +
geom_point(size=3)
p2<-p+scale_color_manual(name="Super.Pathway",
2023 Jun 16
1
Issue with crammed Y axis
Hi,
I have a data frame like this:
> dput(df)
structure(list(ID = 1:8, Type = c("gmx mdrun -ntmpi 8 -ntomp 1 -s
benchPEP.tpr -nsteps 10000 -resethway",
"gmx mdrun -ntmpi 8 -ntomp 1 -s benchPEP.tpr -nsteps 10000 -resethway",
"gmx mdrun -ntmpi 8 -s benchPEP.tpr -nsteps 4000 -resetstep 3000",
"gmx mdrun -ntmpi 8 -s benchPEP.tpr -nsteps 4000 -resetstep
2017 Nov 22
2
How to produce rainfall maps
Fwiw the engine behind geom_raster needs explicit observation-per-row form
for input (with no structural normalization), so conversion to points is
perfectly proper here, albeit confusing in context. (It's closer to what
graphics devices actually use ultimately, but the expansion is laid out
very early in ggplot2 because there's no standard for intermediate forms.)
Cheers, Mike
On Wed,