lattice

R: How to Draw heat map divided by a digonal line?

时光总嘲笑我的痴心妄想 提交于 2021-02-10 23:51:02
问题 I came across this article on Nature Methods which provided a very nice heatmap: http://www.nature.com/nmeth/journal/v12/n4/full/nmeth.3311.html Different from other heat map is each rectangle is divided by a diagonal line, with 1 part represent the literature data and the other in-house data. I think this is a very nice way to compare the data. However, I do not know how to draw this pic in R. Does anyone have any clue on how to do this? A small screenshot is provided below: Below is a demo

R: How to Draw heat map divided by a digonal line?

元气小坏坏 提交于 2021-02-10 23:43:37
问题 I came across this article on Nature Methods which provided a very nice heatmap: http://www.nature.com/nmeth/journal/v12/n4/full/nmeth.3311.html Different from other heat map is each rectangle is divided by a diagonal line, with 1 part represent the literature data and the other in-house data. I think this is a very nice way to compare the data. However, I do not know how to draw this pic in R. Does anyone have any clue on how to do this? A small screenshot is provided below: Below is a demo

Relative frequency histogram in R, ggplot

与世无争的帅哥 提交于 2021-02-08 08:16:08
问题 I can draw relative frequency histogram in R, using lattice package: a <- runif(100) library(lattice) histogram(a) I want to get the same graph in ggplot . I tried dt <- data.frame(a) ggplot(dt, aes(x = a)) + geom_bar(aes(y = ..prop..))+ scale_y_continuous(labels=percent) but it doesn't work like that. What I should change in the code? Calculating relative frequency before graph is not an option for me. 回答1: You want a histogram, not a barplot, so: ggplot(dt, aes(x = a)) + geom_histogram(aes

change the default arguments of a function in R

醉酒当歌 提交于 2021-02-08 07:40:28
问题 I'm following up on this answer . I'm wondering if there is a way to set the default for argument rug to FALSE and argument multiline to TRUE in the plots generated by library(effects) as, for example, shown below in the code? library(effects) m <- lm(Fertility ~ Examination*Education, data = swiss) plot(allEffects(m), rug = FALSE, multiline = TRUE) # By default, change `rug = FALSE` # `multiline = TRUE ` 回答1: I think if you're just trying to add those two options to @MrFlick's answer you

removing the ticks on the 3rd and 4th axes in plots from library effects in R

牧云@^-^@ 提交于 2021-02-08 03:01:06
问题 I'm wondering if there is a way to remove the tickmarks (the axes) on the 3rd and 4th axes of the plot generated by library effects as shown below? library(effects) m <- lm(Fertility ~ ., data = swiss) plot(allEffects(m), rug = FALSE) 回答1: It doesn't look like the package authors choose to expose that propertly very easily. We could write our own version of plot.efflist which is doing most of the work here. Here's the alternative version plot.efflist <- function (x, selection, rows, cols,

Add alpha value to lattice xyplot panel function

怎甘沉沦 提交于 2021-02-07 20:16:57
问题 I want to assign two alpha values in xyplot panel function: points with alpha= 0.3 and lines with alpha=1 . Here is an example: library(lattice) library(sp) data(meuse) xyplot(elev~ copper,data=meuse,groups=factor(soil),grid = TRUE,scales=list(tck=c(1,0), x=list(cex=1.1), y=list(cex=1.1)), auto.key = list(space = 'right',text=c("1", "2", "3")), par.settings = list(superpose.symbol = list(pch =20, cex = 1, col = c("#006837", "#41ab5d","#fd8d3c"))), type = c("p", "smooth"),col.line =c("#006837"

Add alpha value to lattice xyplot panel function

好久不见. 提交于 2021-02-07 20:16:42
问题 I want to assign two alpha values in xyplot panel function: points with alpha= 0.3 and lines with alpha=1 . Here is an example: library(lattice) library(sp) data(meuse) xyplot(elev~ copper,data=meuse,groups=factor(soil),grid = TRUE,scales=list(tck=c(1,0), x=list(cex=1.1), y=list(cex=1.1)), auto.key = list(space = 'right',text=c("1", "2", "3")), par.settings = list(superpose.symbol = list(pch =20, cex = 1, col = c("#006837", "#41ab5d","#fd8d3c"))), type = c("p", "smooth"),col.line =c("#006837"

Controlling z labels in contourplot

谁说我不能喝 提交于 2021-02-07 04:22:47
问题 I am trying to control how many z labels should be written in my contour plot plotted with contourplot() from the lattice library. I have 30 contour lines but I only want the first 5 to be labelled. I tried a bunch of things like contourplot(z ~ z+y, data=d3, cuts=30, font=3, xlab="x axis", ylab="y axis", scales=list(at=seq(2,10,by=2))) contourplot(z ~ z+y, data=d3, cuts=30, font=3, xlab="x axis", ylab="y axis", at=seq(2,10,by=2)) but nothing works. Also, is it possible to plot two

R pch plotting in illustator as “q”

邮差的信 提交于 2021-02-06 16:34:37
问题 Every time I use pch=21 for plotting in R with lattice, my plot plots normally in the R plotting window and in pdf (circles with borders); however when I open a saved pdf version of my plot in Adobe Illustrator or Inkscape, the dots are oddly converted to "q"'s. Can anyone explain this? It's pretty frustrating, as I would like to edit my plot in either Illustrator or Inkscape. 回答1: I think you might want to use: useDingbats = FALSE as in: pdf("myplot.pdf", useDingbats=FALSE) plot() dev.off()

R pch plotting in illustator as “q”

橙三吉。 提交于 2021-02-06 16:30:19
问题 Every time I use pch=21 for plotting in R with lattice, my plot plots normally in the R plotting window and in pdf (circles with borders); however when I open a saved pdf version of my plot in Adobe Illustrator or Inkscape, the dots are oddly converted to "q"'s. Can anyone explain this? It's pretty frustrating, as I would like to edit my plot in either Illustrator or Inkscape. 回答1: I think you might want to use: useDingbats = FALSE as in: pdf("myplot.pdf", useDingbats=FALSE) plot() dev.off()