similar to: ggplot: Trouble with xlim() and discrete scales

Displaying 20 results from an estimated 10000 matches similar to: "ggplot: Trouble with xlim() and discrete scales"

2023 Jan 12
1
Reg: ggplot error
Hallo I am not familiar with any of packages you use (except of MASS and ggplot2) and the code is too complicated without any hint where the error could come from and what is the message you get. I wonder if anybody would like to go through your whole code. 1. data seems to be read correctly ICUData <- read.csv(file = "ICUData.csv", stringsAsFactors = TRUE) ICUData.neuro <-
2017 Dec 13
1
overlay two histograms ggplot
Hi all, How can I overlay these two histograms? ggplot(gg, aes(gg$Alz, fill = gg$veg)) + geom_histogram(alpha = 0.2) ggplot(tt, aes(tt$Cont, fill = tt$veg)) + geom_histogram(alpha = 0.2) thanks for any help! Elahe
2009 Feb 02
1
Broke ggplot...
It appears I broke ggplot in my script, but that maybe it is because the caffeine has worn off or maybe it is late in the day.   I thought I was beginning to understand ggplot, but I have encountered a silly little issue.   For some reason the following does not produce a histogram with fill due to the Person's characteristics: (Note that VADeaths_flat_df$Data works fine...)    
2009 Nov 04
1
Patterned shading in ggplot
Am trying to produce a graph which prints out well in black and white using ggplot2. I have the following example set up nicely, but want to shade the red bars in one pattern and the blue in another so they print out clearly. I tried changing colours to 1 light, 1 dark, but then the overlapping colour looks virtually identical to the darker one. I noted the option density in barplot, but
2013 Jul 25
1
GGplot 2 – cannot get histogram and box plot axis to match.
Problem: I am trying to get the histogram and box plot x axis to match. I?ve tried using the expand_limits function to make the axis match but that didn?t make the axis match. The histogram?s axis are still consistently larger than the ones for the box plot (though the function did help). Does anyone have a suggestion as to what I should do instead? Background: I am building a Shiny app that
2008 Jun 13
1
overlaid transparent histograms
Hello all-- I'm attempting to produce overlaid histograms with partially transparent columns. Whether this display will end up being useful, I can't say. But I do want to get it right. I've already got one solution (shown below), but I tried some other versions and had questions about my results. (Note: I'm using a quartz device, so transparency shows up correctly. You might
2013 Jan 17
3
Getting discrete colors on plot
Hi, This is my first post; I'm new to R but am a senior statistical programmer. I have done a lot of graphs using SAS Graph but now am trying to transition to using graphs in R. I'm trying to produce a graph where the colors have three categories- ideally I would like them to be Green for good, Yellow for Questionable, and Red for bad. So I tried to do this in GGPLOT; here is my code:
2017 Aug 18
1
help with stacked ggplot
Hi, I am new to R and this is probably a very basic question but I can?t seem to figure out a solution. I am creating a stacked ggplot with the following data and code: PercentageData.csv looks like this: decision treatment percentage labtreatment defect 0 53.49 COMMON defect 1 78.00 ASYMMETRIC defect 2 96.67 PRIVATE coop 0 46.51 COMMON coop 1 22.00 ASYMMETRIC coop 2 3.33 PRIVATE %Load data:
2009 Aug 19
2
ggplot2 legend problem
I'm trying to overlay two histograms using transparency to enable viewing of multiple distributions on a single scale. So far ggplot2 seems to do what I want. However I'm having a problem generating the legend coloring appropriate to each distribution in the plot. Here is a test case to show my best (failed) effort so far: library(ggplot2) x <- data.frame(X=rnorm(1000, mean=0)) y
2017 Nov 07
1
fill histogram in ggplot
Hi all, I have the following data and I have a histogram for mms like ggplot(hist,aes(x=hist$mms))+ geom_histogram(binwidth=1,fill="white",color="black")and then I want to fill the color of histogram by probable=1 and probable=0, could anyone help me in this? My data: structure(list(probable = c(1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L,
2012 Jan 12
1
relative frequency plot using ggplot or other function
Hi I have a data frame in the following form. There are two groups and for each 'width' relative frequency for group1 and group2 is given. How to plot this in R using ggplot or other package. Width relativeFrequency1 relativeFrequency2 1 100 0.0006388783 0.02265428 2 200 0.0022677303 0.02948625 3 300 0.0061182673 0.01739936 4 400 0.0152237225 0.02569902 5 500
2009 Jul 23
1
Another question on gplot
I am getting following strange error : library(sn) library(ggplot2) dat1 <- as.matrix(rsn(1000, 0, 1, 0))[,1] ggplot() + geom_histogram(aes(x = dat1, y = ..density.., fill = ..count..)) + xlab("Distribution") + scale_y_continuous("") Error: No data for layer Can anyone please tell me why it is coming? -- View this message in context:
2010 Jul 29
2
ggplot2 histograms... a subtle error found
Hello all, I have a peculiar and particular bug that I stumbled across with ggplot2. I cannot seem to replicate it with anything other than my specific data set. Here is the problem: - when I try to plot a histogram, allowing for ggplot2 to decide the binwidths itself, I get the following error: - stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
2007 Nov 08
1
ggplot2 facets as rows and columns
Does anyone (Hadley??) know if there's a straightforward way in ggplot2 to get data divided by a single factor to plot as a rectangular grid of subplots? So far I've only been able to get such data plotted as a single row or single column of skinny subplots. The code below gives an example implemented with lattice, and my best attempt in ggplot2 cheers Ben Bolker ------------ g=
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
2011 Jun 07
1
ggplot 2: Histogram with bell curve?
I am learning ggplot2 commands specifically qplot for the time being and I have figured out how to create histograms and normal density curves but I am not sure how to add a normal bell curve or other dist. as well on top of a histogram. Here are the two graphs that I created. ## Histogram t<-rnorm(500) w<-qplot(t, main="Normal Random Sample", fill=I("blue"),
2010 Nov 09
1
ggplot2: facet_grid with different vertical lines on each facet
Hello, I am plotting many histograms together using facet_grid in ggplot2. However, I want to then add a vertical line to each histogram, or facet, each of which vertical lines are at different x-values. The following example adds all vertical lines to each facet: ggplot(data,aes(values)) + geom_histogram() + facet_grid(.~variable) + geom_vline(xintercept=c(5,10,15)) How can I add a vertical
2016 Jul 13
2
par() y ggplot2
Hola. Tengo 4 gráficos: a <- qqnorm(total$ImpTotal) #con lattice y b, c y d son variaciones de este tipo?, creados con ggplot2: ?b <- g <- ggplot(data = total, aes(x=ImpTotal, fill=Convenio)) g + geom_histogram(binwidth = 90) ? Los quiero representar de la forma: par(mfrow=c(2,2)) a b c d Pero los que crea con ggplot2 aparecen en par(mfrow=c(1,1)), es decir: ignora la instrucción.
2010 Jan 18
2
ggplot2 histogramm
Hi, i get no success change the title of the "fill" (colour) legend and the defintion of "levels". Have anybody a hint how i can do this. df <- data.frame(variable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500)) p <- ggplot(df, aes(x = variable)) p + geom_histogram(aes(y= ..count.. /
2007 Sep 20
1
ggplot and xlim/ylim
Hello everyone, I am (happily) using ggplot2 for all my plotting now and I wondered is there is an easy way to specify xlim and ylim somewhere when using the ggplot syntax, as opposed to the qplot syntax. Eg. qplot(data=mtcars,y=wt, x=qsec,xlim=c(0,30)) <-> ggplot(mtcars, aes(y=wt, x=qsec)) + geom_point() + ??? Indeed the ggplot syntax is in general more flexible and powerful and