Help:Drawing graphs: Difference between revisions
Jump to navigation
Jump to search
(→rlnorm: calculation error corrected) |
|||
Line 68: | Line 68: | ||
Group = factor(1:5, levels = 1:5, labels = c("Old, CH", "Old, CZ", "Old, GR", "New, all cities", "Renovated, all cities")), | Group = factor(1:5, levels = 1:5, labels = c("Old, CH", "Old, CZ", "Old, GR", "New, all cities", "Renovated, all cities")), | ||
Mean = c(0.83, 0.7, 1.29, 0.65, 0.6), | Mean = c(0.83, 0.7, 1.29, 0.65, 0.6), | ||
Sd = c(0.46, 0.43, 1.09, 0.1, 0.1) | |||
) | ) | ||
Line 74: | Line 74: | ||
for(i in 1:nrow(dat)) { | for(i in 1:nrow(dat)) { | ||
temp <- data.frame(Group = dat$Group[i], Iter = 1:10000, | temp <- data.frame(Group = dat$Group[i], Iter = 1:10000, | ||
Result = rlnorm(10000, | Result = rlnorm(10000, | ||
meanlog = log(dat$Mean[i]^2 / sqrt(dat$Sd[i]^2 + dat$Mean[i]^2)), | |||
sdlog = sqrt(log(1 + dat$Sd[i]^2 / dat$Mean[i]^2)) | |||
)) | |||
out <- rbind(out, temp) | out <- rbind(out, temp) | ||
} | } | ||
Line 86: | Line 88: | ||
p <- ggplot(out, aes(x = Result, linetype = Group)) + | p <- ggplot(out, aes(x = Result, linetype = Group)) + | ||
stat_ecdf(size = 1.2) + | stat_ecdf(size = 1.2) + | ||
scale_x_continuous(limits = c(0, | scale_x_continuous(limits = c(0, 3)) + | ||
theme_grey(base_size = 24) + | theme_grey(base_size = 24) + | ||
labs(x = "Air exchange rate (1/h)", y = "Cumulative probability") + | labs(x = "Air exchange rate (1/h)", y = "Cumulative probability") + |
Revision as of 03:55, 28 September 2013
Moderator:Jouni (see all) |
|
Upload data
|
Question
How to draw graphs in Opasnet?
Answer
R-tools
In R-tools, you have the functionalities of R available. We recommend that you use the package ggplot2 whenever possible. It is very powerful, and borrowing good ideas from others is easier if we all use the same approach. Of course, it is also possible to use plot' (a kind of basic graph) as well, but the limits come sooner. This is an example code that contains all kinds of examples with comments.
----#: . Code seems to work, but gives the yellow errorbox saying "Removed 745 rows containing missing values (geom_point)" --Heta 12:56, 27 August 2013 (EEST) (type: truth; paradigms: science: comment)
rlnorm
- Graph for cumulative probability distributions
GoogleDocs
GoogleDocs is the method of choice for drawing causal diagrams.
- Make a drawing.
- Share it with everyone with open editing.
- Download is in png or svg format.
- Upload the file to Opasnet and copy a link to the original Google document to the image page.
- Use like any image.