Displaying 20 results from an estimated 20000 matches similar to: "ggplot2 problem"
2017 Jun 27
0
ggplot2 geom_bar arrangement
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))
px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
geom_text(aes(y=0)) +
geom_bar(stat =
2012 Feb 01
1
ggplot2(0.9.0): could not find function "=="
Hi,
I have a question related to the newest version of ggplot2 (0.9.0). I
just updated this morning and from CRAN it looks like the Mac version
is the only one at 0.9.0 as of right now.
http://cran.r-project.org/web/packages/ggplot2/index.html
Anyway, I was in the midst of a project where I was trying to
replicate "Back-to-back Bar Charts" in this blog post.
2010 Mar 12
1
simple plot in ggplot2, wrong error bars
I was wondering if anyone could help me with this, simple problem.
I am essentially following the example on Hadley's webpage
(http://had.co.nz/ggplot2/geom_errorbar.html), but it still doesn't make any
sense to me.
df <- data.frame(trt = factor(c("intact", "intact", "removed", "removed")),
coon = c(0.093, 0.06, 0.057, 0.09), group =
2010 Oct 06
2
ggplot2 Pareto plot (Barplot in decreasing frequency)
Hi all
I have a large dataframe with (among others) a categorical variable of 52
levels and would like to create a barplot with the bars ordered in
decreasing frequency of the levels. I belive it is referred to as a pareto
plot.
Consider a subset where I keep only the categorical variable in question.
# Example:
v1 = c("aa", "cc", "bb", "bb",
2017 Jul 27
3
na.rm = T treatment by ggplot2's geom_bar
Hello!
I am trying to understand how ggplot2's geom_bar treats NAs.
The help file says:
library(ggplot2)
?geom_bar
na.rm: If FALSE, the default, missing values are removed with a warning. If
TRUE, missing values are silently removed.
I am trying it out:
md <- data.frame(a = c(letters[1:5], letters[1:4], letters[1:3], rep(NA,
3)))
str(md); levels(md$a)
ggplot(data = md, mapping = aes(x =
2012 Dec 21
2
ggplot2: setting martin
Is it possible to set the margin in ggplot2 to a fixed size? I create many
plots, and I want them to look the same.
Especially I want them to have the same left margin.
But
P<-ggplot()+geom_bar(aes(c("short label1","short
label2"),runif(2)))+coord_flip()
P<-creates a plot with another margin as
ggplot()+geom_bar(aes(c("very very very very long
2017 Jun 27
4
ggplot2 geom_bar arrangement
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)
df <- data.frame(Lab,valuex)
px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
To clarify: my question is not about "who could I exclude NAs from being
counted" - I know how to do that.
My question is: Why na.rm = T is not working for geom_bar in this case?
On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski <
dimitri.liakhovitski at gmail.com> wrote:
> Hello!
>
> I am trying to understand how ggplot2's geom_bar treats NAs.
> The help file
2009 Aug 28
1
problem plotting with ggplot2
Dear R-Help subsribers,
upon running into a wonderful ggplot2 package by accident, I abruptly
encountered another problem. Almost every command run with ggplot2 results
in some sort of error. The one below is far the most common one. Kind people
from ggplot2 mailing list couldn't manage to solve the problem, so I'm
re-posting it here to try my luck. I will recommend myself for any tips
2016 Apr 12
0
ggplot2
Hi James,
If you want to specify the y-values, you need to use stat="identity" as below:
ggplot(probability, aes(x=Fertilizer, y=prob)) +
geom_bar(stat="identity", aes(fill=Treatment))
best,
huzefa
On Tue, Apr 12, 2016 at 1:02 PM, James Henson <jfhenson1 at gmail.com> wrote:
> Dear R Community,
>
> Below is a problem with a simple ggplot2 graph. The code
2010 Mar 09
1
ggplot2 rose diagram
Dear R gurus -
consider this plot:
library(ggplot2)
dat <- sample(1:8,100,replace=TRUE)
smp <- ggplot(data.frame(dat), aes(x=factor(dat),fill=factor(dat))) + geom_bar(width=1)
smp + coord_polar()
Q1. How do I change the font size and weight of bar labels (1,2,3...)? I've been wallowing in the 'Themes' structure and I just can't figure out the correct place to change
2012 Aug 10
1
ggplot2 geom_bar produces white slashes in legend keys
When I am using geom_bar I get these white slashes through the legend keys. I cannot figure out how to remove them.
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()
I have tried using opts(legend.key = theme_blank()) but with no luck.
Any suggestions would be much appreciated.
I am using R vers. 2.15.0 and ggplot 0.9.1, win xp
Best wishes
Jonas Hal
2011 Oct 18
3
Ordering of stack in ggplot (package ggplot2)
I'm trying to reproduce the 3rd graph on the page of this site:
http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ . However, the data
below produces a ggplot with the stacks sorted in alphabetical order from
the bottom up. I'd like the stacks to be in the order "Europe", "Asia",
"Americas, "Africa", "Oceania". Is there an easy way to
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
Just a thought:
Did you try na.rm = TRUE in case you have an object named "T" in scope?
-- Bert
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 Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski
<dimitri.liakhovitski at
2016 Apr 12
2
ggplot2
Dear R Community,
Below is a problem with a simple ggplot2 graph. The code returns the error
message below.
Error: stat_count() must not be used with a y aesthetic.
My code is below and the data is attached as a ?text? file.
# Graph of the probabilities
library(digest)
library(DT)
datatable(probability)
str(probability)
probability$Fertilizer <- as.factor(probability$Fertilizer)
2011 Jul 19
1
Stacked Bar Plot in ggplot2
I'm trying to develop a stacked bar plot in R with ggplot2.
My data:
conv = c(10, 4.76, 17.14, 25, 26.47, 37.5, 20.83, 25.53, 32.5, 16.7, 27.33)
click = c(20, 42, 35, 28, 34, 48, 48, 47, 40, 30, 30)
date = c("July 7", "July 8", "July 9", "July 10", "July 11", "July 12",
"July 13",
"July 14", "July 15",
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
I think you should be more suspicious of yourself, Dimitri. A letter T variable can easily arise in the problem domain when you are not thinking of logical values at all, at which point your cavalier use of T as a synonym for TRUE can suddenly become a bug.
--
Sent from my phone. Please excuse my brevity.
On July 27, 2017 8:18:03 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
Thank you, Bert!
I do NOT have an object named "T" in scope (I checked - and besides, it
would never occur to me to use this name).
TRUE or T results in the same unexpected behavior:
ggplot(data = md, mapping = aes(x = a)) +
geom_bar(na.rm = TRUE)
On Thu, Jul 27, 2017 at 10:57 AM, Bert Gunter <bgunter.4567 at gmail.com>
wrote:
> Just a thought:
>
> Did you try
2010 Feb 26
1
ggplot2 : bug in coord_equal() ?
Hello,
I think there is a bug in coord_equal when x s a factor :
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() + coord_equal(1/2)
David
2013 Feb 03
1
ggplot2 plotting errorbars.
Hi,
i'm using this lines of code:
dodge <-position_dodge(width=0.9)
ggplot(dfm,aes(x = X,y = value)) +
geom_bar(aes(fill = variable), position=dodge, stat="identity") +
geom_errorbar(aes(ymin=value-er, ymax=value+er),width=0.25,
position=dodge,stat="identity")
to plot this data frame
X variable value er
1 A X4 58.74 9.44
2 B X4