lattice

Removing per-panel unused factors in a bar chart with nested factors

喜夏-厌秋 提交于 2019-12-19 17:33:57
问题 Some time ago I asked a question on how to remove unused factors in a bar chart, and I got a useful solution for that problem, thanks to @Aaron. Now, I am facing a very similar problem, but the solution that I used in the past does not work for this case. This is the code to reproduce the data frame that I am using: set.seed(17) df <- data.frame(BENCH = sprintf('bench-%s', sort(rep(letters[1:8], 4))), CLASS.CFG = sprintf('class-%s', c(rep('C', 4), rep('A', 4), rep('B', 8), rep('C', 8), rep('A

Creating a trellised (faceted) thin-plate spline response surface

天大地大妈咪最大 提交于 2019-12-19 09:18:20
问题 I am trying to plot a bunch of thin-plate spline response surfaces for measurements related to two continuous variables plus one discrete variable. So far, I have been subsetting the data based on the discrete variable to generate pairs of plots, but it seems to me there should be a way to create some slick trellised plots instead. It seems like this could be done by faceting heatmaps in ggplot2 with geom_tile and geom_contour , but I am stuck on (1) how to reorganize the data (or interpret

R: Four Lattice barcharts side-by-side in 2x2 Window?

一笑奈何 提交于 2019-12-19 04:45:29
问题 Code where I would like to do 2x2 barcharts side-by-side such that the y-axis max value would be the same in all and common ylabel common xlabel common legends common title each barchart with their own subtitle separator line between each barchart like in Fig. 2 Code # Wanted output 2x2 barchart where top column Ite. 1 and Ite. 2 and row-names female and male # http://www.magesblog.com/2012/12/changing-colours-and-legends-in-lattice.html require("lattice") f<-function(x) as.double(as

R: Four Lattice barcharts side-by-side in 2x2 Window?

人盡茶涼 提交于 2019-12-19 04:45:09
问题 Code where I would like to do 2x2 barcharts side-by-side such that the y-axis max value would be the same in all and common ylabel common xlabel common legends common title each barchart with their own subtitle separator line between each barchart like in Fig. 2 Code # Wanted output 2x2 barchart where top column Ite. 1 and Ite. 2 and row-names female and male # http://www.magesblog.com/2012/12/changing-colours-and-legends-in-lattice.html require("lattice") f<-function(x) as.double(as

How to draw a chart with sorted horizontal error bars (sorted barcharts with error marks)?

橙三吉。 提交于 2019-12-19 03:08:18
问题 I would like to plot means and standard errors as a horizontal barchart, and I want the mean sorted. I've found the way to plot horizontal sorted barcharts using lattice, but I do not know how to add error marks. The following are my data and the R code I came up with. data <- structure(c(0.67, 0.67, 0.76, 0.66, 0.71, 0.6, 0.52, 0.6, 0.71, 0.76, 0.76, 0.71, 0.6, 0.61, 0.9, 0.5, 0.58, 0.84, 0.68, 0.88, 0.89, 0.96, 1, 0.95, 1, 1, 0.98, 0.78, 0.98, 1, 1, 0.99, 1, 1, 0.95, 0.92, 1, 0.91, 1, 0.87,

Superposed xyplot Panels with Grouped Regression Lines

孤者浪人 提交于 2019-12-18 13:35:00
问题 I want to superpose multiple groups on a single panel in lattice, and want independent regression lines. It is fairly easy to get multiple panels, each with a regression line by using a conditioning factor: xyplot( Petal.Width ~ Petal.Length | Species, data = iris, panel = function(x, y, ...) { panel.xyplot(x, y, ...) panel.abline(lm(y~x), col='#0080ff') }, grid = TRUE ) It is also fairly easy to print a single regression for all of the points in a superposed xyplot: xyplot( Petal.Width ~

Multiple lattice plots with gridExtra

删除回忆录丶 提交于 2019-12-18 12:43:03
问题 There is very convenient way of plotting multiple graphs and that's with gridExtra - grid.arrange : grid.arrange(plot1,plot2,plot3,plot4,plot5,plot6,plot7,plot8,plot9, ncol=3) The above command draws 3x3 graphs in one window. Now, I'm using my own lattice setup to draw unique lines etc. via trellis.par.set(my.setup) However using the grid.arrange command for plotting multiple plots won't pass on the setup as the output plots are in default colours. So the question is how to pass on the my

Relationship between plotting packages in R

谁说胖子不能爱 提交于 2019-12-18 11:48:41
问题 I am just starting out with R, and beginning to start producing charts. I am aware that there are at least three different plotting packages, the standard one, ggplot2 and lattice. Are these packages complementary, or do they cover much the same ground? If they are complementary, when do I use each? If they cover the same ground, which one should I, as a new R user, put my energy into mastering? 回答1: There are 4 plotting systems. There is standard, grid, lattice, and ggplot2. The latter two

conditional panel function in lattice for multiple y variables

二次信任 提交于 2019-12-18 08:55:08
问题 I have a dataset in which a value ( mean ) can or cannot fall within an interval given by lower.bound and upper.bound . I would like to plot this using lattice and have achieved something really nice, but there are still three things missing, I don't know how to tackle (I am relatively new to lattice ). df <- read.table("http://pastebin.com/raw.php?i=FQh6F12t") require(lattice) lattice.options(default.theme = standard.theme(color = FALSE)) head(df) ## code topic problem mean lower.bound upper

How to add points to multi-panel Lattice graphics bwplot?

血红的双手。 提交于 2019-12-18 07:23:05
问题 I'm making box-and-whisker plots in Lattice with bwplot. I want to add points for means. I've figured out how to do this for simple plots using panel.points . However, when I make a multi-panel bwplot using + and outer=TRUE , I don't know how to put different points in different panels. This example illustrates the problem with my attempted solution, which doesn't work. (For the sake of simplicity, it puts "x"s at arbitrary points rather than at means.) # make some data: df <- data.frame(var1