similar to: A beginner's question about ggplot

Displaying 20 results from an estimated 7000 matches similar to: "A beginner's question about ggplot"

2009 Apr 30
1
Overlaying graphs from different datasets with ggplot
Dear R-users, I recently began using the ggplot2 package and I am still in the process of getting used to it. My goal would be to plot on the same grid a number of curves derived from two distinct datasets. The first dataset (called molten.data) looks like this : Column names : Perc, Week, Weight P10 21 333.3554 P90 21 486.0480 P10 22 452.6347 P90 22 563.8263 P10 23 575.0960 P90
2017 Oct 12
1
dual y-axis for ggplot
Hi John, You can try the following: override.linetype=c("twodash","solid") p <- ggplot(obs, aes(x = Timestamp)) p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity", linetype="Humidity")) p <- p +
2012 Feb 16
2
Problem building up ggplot graph in a loop.
Folks, I want to automate some graphing using ggplot. Here is my code graphChargeOffs2<-function(coffs) { ggplot(coffs, aes(levels)) dataNames<-names(coffs)[!names(coffs) == "levels"] for(i in dataNames) { thisData<-coffs[[i]] last_plot() + geom_line(aes(y = thisData, colour = i)) } last_plot() + ylab("Total Chargeoffs") } coffs is a data.frame.
2017 Oct 12
2
can't print ggplot with Chinese characters to pdf files
I install the Chinese font "Kaiti TC" on my mac, but I can't print the figures to pdf file by "marrangeGrob" command, which is in the package "gridExtra". Error message after I type "ggsave(......)" (last line of the program): "Saving 7.47 x 5.15 in image Error in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y, : invalid font
2017 Oct 12
2
dual y-axis for ggplot
Hi, To my knowledge, an excellent of ggplot with a second y-axis is https://rpubs.com/MarkusLoew/226759 In this example, the author uses two colors for the two lines, but the line shapes are the same -- both are solid. Could each line have its own color as well as its own shape? For example, can I make the red line with the linetype "twodash", while the blue line with the
2010 Nov 04
5
ggplot output
Dear All, I have this script: dat <- data.frame(Month = hstat$Date,C_avg = hstat$C.avg,C_stdev = hstat$C.stdev) ggplot(data = dat, aes(x = Month, y = C_avg, ymin = C_avg - C_stdev, ymax = C_avg + C_stdev)) + geom_point() + geom_line() + geom_errorbar() dat <- data.frame(Month = hstat$Date,K_avg = hstat$K.avg,K_stdev = hstat$K.stdev) ggplot(data = dat, aes(x = Month, y = K_avg,
2017 Oct 12
0
dual y-axis for ggplot
Sorry let me clarify. If I modify the line p <- p + geom_line(aes(y = air_temp, colour = "Temperature")) by p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) and p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity")) by p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity",
2012 Apr 05
1
using for loops with ggplot
Hi all, I have been using ggplot for a few months and ran into this porblem, I am trying to use ggplot in a for loop and it is not working. if I do the following: data=as.data.frame(cbind(rnorm(10),rnorm(10),rnorm(10))) ############ pp=ggplot(data, aes(x=(1:10), y=data[,1])) pp=pp+geom_line(aes(x=(1:10),y = data[,1]),lty=2) pp=pp+geom_line(aes(x=(1:10),y = data[,2]),lty=2)
2009 May 26
4
Creating multiple graphs based on one variable
Dear List, I would like to create several graphs of similar data. I have x and y values for several different individuals (in this case fish). I would like to plot the x and y values for each fish separately. I can do it using a for loop, but I think I should be using "apply". Please let me know what I am doing wrong, or if there is a "better" way to do this. What I have
2017 Oct 13
1
[FORGED] can't print ggplot with Chinese characters to pdf files
Hi Instead of ... ggsave("test_plot_chinese.pdf", m2) ... try ... cairo_pdf("test_plot_chinese.pdf") print(m2) dev.off() Paul On 13/10/17 02:12, John wrote: > I install the Chinese font "Kaiti TC" on my mac, but I can't print the > figures to pdf file by "marrangeGrob" command, which is in the package > "gridExtra". Error message
2017 Oct 13
0
[FORGED] can't print ggplot with Chinese characters to pdf files
Thanks, Paul. Following your solution, I got this error message: Warning message: In cairo_pdf("test_plot_chinese.pdf") : failed to load cairo DLL Is there anything else I need to install? Thanks, John 2017-10-12 19:24 GMT-07:00 Paul Murrell <paul at stat.auckland.ac.nz>: > Hi > > Instead of ... > > ggsave("test_plot_chinese.pdf", m2) > > ...
2013 Jan 08
1
ggplot not showing all the years on the x-axis
Dear R helpers, I am currently having hard time fixing the values on the x-axis of a plot with ggplot: even though I have 12 years, ggplot plots only 3 of them. Here is my example: library(ggplot2) ii <- 2000:2011 ss <- rnorm(12,0,1) pm <- data.frame(ii,ss) tmpplot <- ggplot(pm, aes(x = ii, y = ss)) plot <- tmpplot + geom_line() plot In my case, ggplot reports on the year 2000,
2012 Dec 12
1
ggplot: geom_line with only pairs of points connected
Dear list, I've been using plotmeans {gplots} a lot before, and found the "connect" argument to be quite useful. I've moved to ggplot for several reasons, but would still like to connect lines conditionally, somehow. Is it possible to do? Small example: df <- data.frame(cat=LETTERS[1:4],num=rnorm(4)) ggplot(df, aes(x=cat, y=num)) + geom_point() +
2012 Jan 16
1
ggplot- using geom_point and geom_line at the same time
Hi I am plotting line chart using ggplot and want to use geom_line and geom_point simultaneously. I get the plot but now I have two legends. None of the legend is representing the true values. I need the legend with shape and color both. Thanks > con = textConnection("inputs var1 var2 var3+ 100 10 5 2+ 1000 20 10 4+ 5000 30 15 8+ 10000 40 20 16+ 30000 50 25 32")> data =
2010 Oct 27
3
ggplot - unwanted sorted X values
Hi, I have this script: dat <- data.frame(X = halistat$Date,Y1 = halistat$avg,Y2 = halistat$stdev) ggplot(data = dat, aes(x = X, y = Y1, ymin = Y1 - Y2, ymax = Y1 + Y2)) + geom_point() + # points at the means geom_line() + # if you want lines between pints geom_errorbar() # error bars, Y1 - Y2 and Y1 + Y2 halistat$Date values: 29/1/10 21/2/10 30/3/10 30/4/10 30/5/10 In the resulted
2009 Dec 11
1
ggplot: Problem with legend background
Dear R-users, I am preparing graphs for an upcoming article using the different functions of the ggplot2 package and I've been having problems with the legend background. It doesn't seem to scale when the text size is increased. Here's the mandatory reproducible example: library(ggplot2) repFrame <- data.frame(A= 1:10, B= rnorm(1:10), groupNum = rep(c("First group",
2017 Oct 13
4
[FORGED] can't print ggplot with Chinese characters to pdf files
Hi By the looks of it, you need to install Cairo graphics ... https://www.cairographics.org/download/ Paul On 13/10/17 15:48, John wrote: > Thanks, Paul. Following your solution, ?I got this error message: > > Warning message: > In cairo_pdf("test_plot_chinese.pdf") : failed to load cairo DLL > > Is there anything else I need to install? > > Thanks, >
2017 Oct 16
0
[FORGED] can't print ggplot with Chinese characters to pdf files
Hi, Sorry to bother you with this question here. I tried to install Macports on my Mac OS Sierra, and type "sudo port install cairo", but it did not respond. I haven't seen any file name or app called Macports, but one file called "port" which is located at loca/bin/port" How should I do it? Thanks, John ******* Last login: Sun Oct 15 02:52:49
2009 Dec 01
1
ggplot legend for multiple time series
Hello All, I am trying to create a legend for a black-white graph. The package I use is ggplot2. It can add colors to the legend key but not line types. Can you please help? # example from Wickman (2009, ggplot2 - elegant graphics for data analysis, page 109) library(ggplot2) huron <- data.frame(year=1875:1972, level=LakeHuron) ggplot(huron, aes(year)) +
2013 Jan 21
1
Very slow in processing the equation in the scatter plot ggplot
Hello All, I have plotted a scatter plot in ggplot2 and added a regression line and a regression equation. But the processing is very very slow. One reason might be because I have so many data pairs. Is there any way to speed up this code ? I need to create a multiple layout as well. The code I have used is as follows: setwd("C:/Users/jzd0009/Documents/R software") mydata <-