lattice

Plot a list of lines with R lattice package

╄→尐↘猪︶ㄣ 提交于 2020-03-21 06:40:31
问题 I'm trying to show some variogram model fits on the top of xy.plots . The panel.plots work for all except for a list of lines I wanted to add to corresponding subplots . require(gstat) require(sp) data(meuse) names(meuse) #make directional variograms b<-variogram(log(zinc)~1, meuse, alpha = c(0, 45, 90, 135)) #split the variogram data by direction a<-lapply(1:length(unique(b$dir.hor)), function(i) subset(b, grepl(unique(b$dir.hor)[[i]], b$dir.hor))) #get the model fit parameters for each

Plot a list of lines with R lattice package

隐身守侯 提交于 2020-03-21 06:40:13
问题 I'm trying to show some variogram model fits on the top of xy.plots . The panel.plots work for all except for a list of lines I wanted to add to corresponding subplots . require(gstat) require(sp) data(meuse) names(meuse) #make directional variograms b<-variogram(log(zinc)~1, meuse, alpha = c(0, 45, 90, 135)) #split the variogram data by direction a<-lapply(1:length(unique(b$dir.hor)), function(i) subset(b, grepl(unique(b$dir.hor)[[i]], b$dir.hor))) #get the model fit parameters for each

R语言:lattice程序包

左心房为你撑大大i 提交于 2020-02-26 18:00:27
R语言:lattice程序包 lattice程序包 实例 lattice程序包 lattice程序包主要用于处理结构稍稍复杂一些的数据集,入门容易,作图速度较快,图形函数种类较多,还可以进行三维绘图。 lattice程序包中主要的函数如下: 实例 调用程序包ggplot2中的diamonds数据集,该数据集包括了砖石的重量、颜色、价格和质量信息等,共10个变量。部分数据如下: 安装并加载程序包 install . packages ( "ggplot2" ) library ( "ggplot2" ) data ( diamonds , package = "ggplot2" ) library ( lattice ) 从数据中随机抽取1000个样本作图 sample = diamonds [ sample ( nrow ( diamonds ) , 1000 ) , ] xyplot ( price ~ carat , data = sample , groups = cut , auto . key = list ( corner = c ( 1 , 0 ) ) , type = c ( "p" , "smooth" ) , span = 0.7 , main = "Price VS. Carat" ) 二元图 bwplot ( color ~ price | cut ,

格子玻尔兹曼机(Lattice Boltzmann Method)系列1:LBM用于流体模拟的基本原理

此生再无相见时 提交于 2020-02-23 01:18:39
1.从粒子碰撞模型到玻尔兹曼方程 首先引入一个分布函数f: LBM在推理过程中的思想实际上跟分子动力学模拟(MD)或是SPH算法很类似,只是推导的过程会相对地十分繁琐,且方向不同导致模型在尺度上的适用性也相差十分大。这些模型中的粒子都规定了一个速度空间和位置空间,以及相应的时间。区别在于,SPH或是MD中,规定的粒子都是可以移动的。而格子玻尔兹曼算法中,粒子被束缚在相应的网格点上,粒子的移动依赖分布函数、密度等参数之间的信息传递来实现。 上述的公式中的右项,可以被划分为两部分:分布函数的变化一部分来源于外力场的影响(下标为d的项),另一部分则来源于粒子碰撞(下标为c的项)。 如果有力学系背景的话,在《弹性力学》课程中,第一课就会提到一个十分基础的定理:刘维尔定理(Liouville’s theorem): 刘维尔定理是《弹性力学》的几个基础定理之一,无法从任何一个已知定理中推理得到,但是也不具有“公理”的显然性和一般性。 接下来再看一个粒子的碰撞模型: 在这个粒子碰撞的模型中,可以总结出一个碰撞的公式,这个公式来源于牛顿的力学碰撞体系。因此我们也可以很容易地发现为什么格子玻尔兹曼机不会适用于纳米级的体系。无论是SPH算法还是MD,在进入纳米级时,都会考虑原子之间的作用势函数,但是LBM并不会将其纳入考量。 以上的两个公式描述了分布函数f控制下,速度空间

Hihocoder1456 Rikka with Lattice

痞子三分冷 提交于 2020-02-09 09:44:54
众所周知,萌萌哒六花不擅长数学,所以勇太给了她一些数学问题做练习,其中有一道是这样的: 勇太有一个$n times m$的点阵,他想要从这$n times m$个点中选出三个点 ${A,B,C}$,满足: 三角形$ABC$面积不为$0$且其内部不存在整点。 边$AB$,$BC$,$CA$上不存在除了端点以外的整点。 现在勇太想要知道有多少种不同的选取方案满足条件。 当然,这个问题对于萌萌哒六花来说实在是太难了,你可以帮帮她吗? 注意${A,B,C}$与${B,A,C}$视为同一种方案。 $n,m leqslant 5 times 10^9$。 题解 一道比较有趣的数论题。看范围应该能猜到是杜教筛一类的东西,但是推不出第一步的式子啊= = 首先考虑题目这个奇怪的条件,其实由皮克定理,我们可以得到,这个三角形的面积为$frac{1}{2}$,也就是说,题目要求的就是面积为$frac{1}{2}$的三角形的个数。 考虑这种三角形大概长什么样子,然后你会发现它只能长成这样: 考虑一个$a times b$的矩形,以这个矩形的两个相对的点为其中两个顶点的三角形的个数。设$vec{BE}$的坐标为$(x,y)$那么这个三角形的面积就可以表示为: $$S=frac{1}{2}|vec{BE} times vec{BD}|=frac{1}{2}|ay-bx|$$ 令$S=frac{1}{2}$

r: Plotting each column against each column

笑着哭i 提交于 2020-01-30 05:14:41
问题 I have a dataframe ("data") with 7 columns (2 Factor, 5 num). The first column is containing the names of 7 different countries and in the following columns I have collected data for different parameters (like population, GDP etc.) characterizing each country. In the last column a factor variable assigns which continent the respective country belongs to. The data looks like this: structure(list(Country = structure(c(5L, 4L, 7L, 2L, 1L, 6L, 3L), .Label = c("Brazil", "Chile", "China", "France",

Changing size of axis labels in hexbin plot

拟墨画扇 提交于 2020-01-24 22:58:13
问题 Is there a way to change the font size of axis labels when plotting hexbin data? library(hexbin) myData <- hexbin(rnorm(100), rnorm(100)) myPlot <- plot(myData, xlab = "Variable 1", ylab = "Variable 2") 回答1: You can suppress the labels and add them separately with grid commands. It may take some trial and error to position them exactly where you want them: library(grid) myPlot <- plot(myData, xlab="", ylab="", lcex=.75) grid.text("Variable 1", .45, .1, gp=gpar(fontsize=12)) grid.text(

Changing size of axis labels in hexbin plot

北战南征 提交于 2020-01-24 22:58:07
问题 Is there a way to change the font size of axis labels when plotting hexbin data? library(hexbin) myData <- hexbin(rnorm(100), rnorm(100)) myPlot <- plot(myData, xlab = "Variable 1", ylab = "Variable 2") 回答1: You can suppress the labels and add them separately with grid commands. It may take some trial and error to position them exactly where you want them: library(grid) myPlot <- plot(myData, xlab="", ylab="", lcex=.75) grid.text("Variable 1", .45, .1, gp=gpar(fontsize=12)) grid.text(

Double x axis (analog to doubleYScale) with lattice extra or similar

泄露秘密 提交于 2020-01-23 09:29:38
问题 I want to make specific figures that we need in oceanography. Unfortunately double, triple or more axes are not very good implemented in R. I don't need a double y axis as in doubleYScale of lattice extra. I need double or triple x axis. I could not find a way to use doubleYScale to my advantage. Maybe that's possible. Help would be appreciated a lot. This is what I have now based on the data: stackoverflow_fluo.csv: http://pastebin.com/embed_js.php?i=7KNEiytF animals_stackoverflow.csv:http:/

Double x axis (analog to doubleYScale) with lattice extra or similar

最后都变了- 提交于 2020-01-23 09:29:08
问题 I want to make specific figures that we need in oceanography. Unfortunately double, triple or more axes are not very good implemented in R. I don't need a double y axis as in doubleYScale of lattice extra. I need double or triple x axis. I could not find a way to use doubleYScale to my advantage. Maybe that's possible. Help would be appreciated a lot. This is what I have now based on the data: stackoverflow_fluo.csv: http://pastebin.com/embed_js.php?i=7KNEiytF animals_stackoverflow.csv:http:/