axis

Ggplot2 Boxplot width setting changes x-axis

夙愿已清 提交于 2020-05-15 19:15:53
问题 I have produced a boxplot with a continuous x-axis unsing geom_boxplot() in ggplot2 . However, as there are many boxes they appear as skinny lines. Another stackoverflow chain (see here) suggested using the width= argument to make all the boxes the same width. However, when I use this argument it changes the x-axis and some of the boxes just disappear! For example, take this example dataframe. I apologise for the number of observations this has but I think the quantity has to do with the

ggplot x-axis labels with all x-axis values

情到浓时终转凉″ 提交于 2020-05-10 04:04:23
问题 I'm plotting ggplot with geom_point . The x-axis will be individuals' ID, and y-axis is variable A. How can I ggplot all and individual ID values on the x-axis without overlapping labels? ID may not be continuous. df sample (actual rows are much longer) > df ID A 1 4 2 12 3 45 5 1 Code for the plot: ggplot(df, aes(x = ID, y = A)) + geom_point() Above code has x-axis in intervals, but not presenting individual ID. Thanks! 回答1: Is this what you're looking for? ID <- 1:50 A <- runif(50,1,100) df

R barplot Y-axis scale too short

左心房为你撑大大i 提交于 2020-05-10 03:43:45
问题 I'm trying to generate a barplot, but the y-axis scale is too short. Here's my code: barplot(as.matrix(dat), log="y", ylim=c(10000,100000000), beside=TRUE, ylab = "Number of reads", col = c("gray","black","white")) It leaves the room for the axis (as per ylim), but doesn't fill in the actual axis. I've been through ?barplot and tried a few things (from googling around I thought xpd = F, yaxs = c(10000,10000000,5) should work, but it didn't). I know it's a minor thing, but it's exactly the

R barplot Y-axis scale too short

筅森魡賤 提交于 2020-05-10 03:42:09
问题 I'm trying to generate a barplot, but the y-axis scale is too short. Here's my code: barplot(as.matrix(dat), log="y", ylim=c(10000,100000000), beside=TRUE, ylab = "Number of reads", col = c("gray","black","white")) It leaves the room for the axis (as per ylim), but doesn't fill in the actual axis. I've been through ?barplot and tried a few things (from googling around I thought xpd = F, yaxs = c(10000,10000000,5) should work, but it didn't). I know it's a minor thing, but it's exactly the

实验:关于XPath中的13个轴

混江龙づ霸主 提交于 2020-04-26 06:35:31
XSLT使用XPath来找寻XML文档中的信息,这几天在学习XSLT的找寻路径过程中,我写了下面这个例子,来加深我对XPath中各个轴的概念的理解 测试用的XML文档和XSLT文档 XML文档:LogReport.xml <?xml version="1.0" encoding="gb2312"?> <?xml-stylesheet type='text/xsl' href='LogReport.xslt'?> <LogReport CreateTime="2015/2/7 20:34:17"> <Data>DataA</Data> <Data>DataB</Data> <Data>DataC</Data> <LogList ListName="XXX"> <Log LogLevel="0" LogItem="Zhang" Description="Log1"> <LogMessage Message="abcdefg" /> </Log> <Log LogLevel="0" LogItem="Wang" Description="Log2"> <LogMessage Message="hijklmn" /> </Log> <Log LogLevel="1" LogItem="Lee" Description="Log3"> <LogMessage Message="opqrst"

pandas从入门到上楼

折月煮酒 提交于 2020-04-08 12:01:20
数据对象 pandas主要有两种数据对象 Series DataFrame 注: 后面代码使用pandas版本0.20.1,通过import pandas as pd引入 Series Series是一种带有索引的序列对象 创建方式 简单创建如下 # 通过传入一个序列给pd.Series初始化一个Series对象, 比如list s1 = pd.Series(list("1234")) print(s1) 0 1 1 2 2 3 3 4 dtype: object DataFrame 类似与数据库table有行列的数据对象 创建方式如下 # 通过传入一个numpy的二维数组或者dict对象给pd.DataFrame初始化一个DataFrame对象 # 通过numpy二维数组 import numpy as np df1 = pd.DataFrame(np.random.randn(6,4)) print(df1) 0 1 2 3 0 -0.646340 -1.249943 0.393323 -1.561873 1 0.371630 0.069426 1.693097 0.907419 2 -0.328575 -0.256765 0.693798 -0.787343 3 1.875764 -0.416275 -1.028718 0.158259 4 1.644791 -1

numpy、pandas做数据清洗

大兔子大兔子 提交于 2020-04-05 20:15:45
<!doctype html> numpy、pandas做数据清洗 numpy、pandas做数据清洗 numpy、pandas空值的清洗 有两种方式 删除空值所在的行数据 将缺失的行或者列进行删除 使用到的数据判断方法: isnull:判断数据是否是为空,如果为空返回True,否则返回False notnull:判断数据是否非空,如果为空返回False,否则返回True any:与isnull组合判断 dropna:删除数据中的空的行数据或者列数据,axis参数表示与其他相反,行为0,列为1 fillna:对操作数据进行填充参数method='ffill'表示向前填充,'bfill'表示向后填充 方式一的实例: 方法一: from pandas import DataFrame,Series df = DataFrame(data = np.random.randint(0,100,size=(7,5))) #创建一个7行5列的二维数组 #随机取值从0到100,形式是7行5列的数组 #设置是三个空值 df.iloc[3,4] = None #三行四列的值为空 df.iloc[2,2] = np.nan #设置2行2列的值为NAN df.iloc[5,3] = None #设置5行3列的值为空 df #panads会自动将None的空值转换成NaN #清洗空值的两种方式

task5 模型融合 打卡

不想你离开。 提交于 2020-04-05 17:13:25
5.1 模型融合目标 对于多种调参完成的模型进行模型融合。 完成对于多种模型的融合,提交融合结果并打卡。 5.2 内容介绍 模型融合是比赛后期一个重要的环节,大体来说有如下的类型方式。 简单加权融合: 回归(分类概率):算术平均融合(Arithmetic mean),几何平均融合(Geometric mean); 分类:投票(Voting) 综合:排序融合(Rank averaging),log融合 stacking/blending: 构建多层模型,并利用预测结果再拟合预测。 boosting/bagging(在xgboost,Adaboost,GBDT中已经用到): 多树的提升方法 5.3 Stacking相关理论介绍 什么是 stacking 简单来说 stacking 就是当用初始训练数据学习出若干个基学习器后,将这几个学习器的预测结果作为新的训练集,来学习一个新的学习器。 将个体学习器结合在一起的时候使用的方法叫做结合策略。对于分类问题,我们可以使用投票法来选择输出最多的类。对于回归问题,我们可以将分类器输出的结果求平均值。 上面说的投票法和平均法都是很有效的结合策略,还有一种结合策略是使用另外一个机器学习算法来将个体机器学习器的结果结合在一起,这个方法就是Stacking。 在stacking方法中,我们把个体学习器叫做初级学习器

numpy 添加删除去重及形状变换

自闭症网瘾萝莉.ら 提交于 2020-04-04 11:24:19
一、数组的添加删除与去重 下面是几个常见的数组操作: append:将值添加到数组末尾 insert: 沿指定轴将值插入到指定下标之前 delete: 返回删掉某个轴的子数组的新数组 unique: 寻找数组内的唯一元素 >>> a = np.array([[1,2,3],[4,5,6]]) >>> np.append(a, [7,8,9]) # 附加后,变成了一维的 array([1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> a #原来的数组没有改变 array([[1, 2, 3], [4, 5, 6]]) >>> a.append([10,11,12]) # ndarray没有这个方法 --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-165-a36f3ca1308b> in <module>() ----> 1 a.append([10,11,12]) AttributeError: 'numpy.ndarray' object has no attribute 'append' >>> np.append(a, [[7,8,9]

Matlab画图

余生颓废 提交于 2020-03-26 04:19:49
http://blog.sina.com.cn/s/blog_4ac35a650100r24v.html 图形的控制与表现 (Figure control and representation) MATLAB提供的用于图形控制的函数和命令: axis: 人工选择坐标轴尺寸. clf:清图形窗口. ginput: 利用鼠标的十字准线输入. hold: 保持图形. shg:显示图形窗口. subplot: 将图形窗口分成N块子窗口。 1.图形窗口(figure window) (1). 图形窗口的创建和选择(Creating and selecting of figure window) figure(n):用于为当前的绘图创建图形窗口,每运行一次figure就会创建一个新的图形窗口,n表示第n个 窗口,如果窗口定义了句柄,也可以用figure(h)将句柄h的窗口作为当前窗口。 clf :用于清除当前图形窗口中的内容。 shg :用于显示当前图形窗口。 (2). 在一个图形窗口中绘制多个子图形(Drawing several subfigures in a single window) subplot(m,n,p):把窗口分成m×n个小窗口,并把第p个窗口当作当前窗口。 例:将4 个图形显示在同一个图形窗口中。 t=0:pi/20:2*pi; [x,y]=meshgrid(t);