R的画图
关于R基础
有3个需要总结的地方
- R的画图(统计学图,ggplot)
- R的基本语法
- R dataframe相关
Plot
plot(1,2)
plot(c(1, 2, 3, 4, 5), c(3, 7, 8, 9, 12))
x <- c(1, 2, 3, 4, 5)
y <- c(3, 7, 8, 9, 12)
plot(x, y)
其他参数:
type='l'
main="My Graph"
xlab="The x-axis"
ylab="The y axis"
col="red"
cex=2
, 点的大小,默认值为1。pch=25
形状(值从0-25)lwd=2
如果画的不是line,也会起作用lty=3
linestyle, 只有在type=line的时候才会起作用 (值从0-6)
0
removes the line1
displays a solid line2
displays a dashed line3
displays a dotted line4
displays a "dot dashed" line5
displays a "long dashed" line6
displays a "two dashed" line
#画两条线,一定是先plot后line
line1 <- c(1,2,3,4,5,10)
line2 <- c(2,5,7,8,9,10)
plot(line1, type = "l", col = "blue")
lines(line2, type="l", col = "red")
看完了line
abline(lm(y~x))
abline
画回归线lm() linear-model
用线性模型拟合回归线
title("AAA")
给图像添加题目
ggplot
library(ggplot)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color = class))
#区别
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy), color = "blue")
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color = "blue"))
ggplot(data = diamonds) + geom_bar(aes(x = cut, fill = cut)) + scale_fill_brewer(palette = "Dark2")
ggsave(file = "mygraph.png", plot = p)
- geom_smooth()
R的画图的更多相关文章
- R 语言画图的基本参数
R 语言画图的基本参数 点 点的种类 点的种类参数为 pch,每一种符号对应一个数字编号 # 点有25种,为了展示25种点 x = 1:25 y = 1:25 x ## [1] 1 2 3 4 5 6 ...
- R语言画图教程之盒形图
R语言画图教程之盒形图 我们之前有分享过一系列的R语言画图代码(PCA图.Pathway图.火山图.RDA图.热图),今天再来补充一个盒形图(箱形图)的代码. 以下代码只是示例,不能直接搬来用哦,注意 ...
- R语言画图小结
本文以1950年到2010年期间我国的火灾统计数据为例,数据如下所示: (0)加载数据 data<-read.csv("E:\\MyDocument\\p\\Data\\1950~20 ...
- R基本画图
参考内容:闻博,R语言的绘图功能及应用案例 https://wenku.baidu.com/view/80f22fa50029bd64783e2c22.html R画图是以函数操作为基本的画图模式. ...
- R语言画图实例-参考R语言实战
dose <- c(, , , ,) drugA <- c(, , , , ) drugB <- c(, , , , ) # 数据准备 opar <- par(no.reado ...
- R语言画图布局摆放(layout)
require(ggplot2) require(Cairo) require(grid) p = ggplot(iris,aes(x = Species,y = Sepal.Length,colou ...
- R语言画图基础参数设置
Graphical Parameters You can customize many features of your graphs (fonts, colors, axes, titles) th ...
- [R语言画图]气泡图symbols
绘制气泡图主要使用函数symbols(x,y,circle=r).当中x.y是坐标轴,r是每一个点的半径. x<-rnorm(10) y<-rnorm(10) r<-abs(rnor ...
- R语言︱画图
笔者寄语:不论画啥,你先plot准没错. plot 二维坐标绘图 dotchart 点图 barplot 条形图 hist 直方图 pie 饼图 points 添加点 lines 添加线 text 添 ...
- R语言画图
转http://www.cnblogs.com/jiangmiaomiao/p/6991632.html 0 引言 R支持4种图形类型: base graphics, grid graphics, l ...
随机推荐
- BOM的概述及方法
BOM的概述: bom 称为浏览器对象模型(bowser object model),也就意味他可以获取浏览器上的所有内容以及相关的操作.BOM缺乏规范的,存在共有对象来解决这个问题,但是共有对象也存 ...
- SQL Server获取连接的IP地址
来源:http://www.itpub.net/thread-193247-1-1.html 先保存,以后研究一下 1 *--获取连接SQL服务器的信息 2 3 所有连接本机的:操作的数据库名,计算机 ...
- python求列表中n个最大或最小的值
import heapq #y为结果列表,n为所求的n个值,x为来源列表 y=heapq.nsmallest(n,x) y=heapq.nlargest(n,x)
- 日志注解,基于ruoyi的后置切面改进而来
有次接口响应时间太长,想知道具体接口执行的时间是多少,于是决定通过注解来实现这个想法,刚好ruoyi本身就提供了完善的日志注解,虽然是采用后置通知,但是完全不影响我们改造它. 想要实现接口耗时的功能, ...
- 将map转成vo实体
//将map转成vo实体 AssetManagementProductsVO param= JSON.parseObject(JSON.toJSONString(map), AssetManageme ...
- 使用ActiveMQ中遇到的端口占用问题
原Linux虚拟机中安装了ActiveMQ,EMQX.后期使用中主要使用EMQX来实现消息服务,停止了ActiveMQ.但是虚拟机挂起之后,长时间未再使用.近期由于有使用ActiveMQ的需要,而临时 ...
- vue 作者在2022-2-7起宣布 vue3 正式作为默认版本
vue 作者在2022-2-7起宣布 vue3 正式作为默认版本 vue 作者尤雨溪在知乎上发布一篇文章,宣布 Vue3 将在 2022 年 2 月 7 日 成为新的默认版本! 并且还在文章中做出了一 ...
- HAL层分析
1. 安卓HAL模块基本 2. 定义hal层代码的5个特性 1)硬件抽象层具有与硬件的密切相关性. 2) 硬件抽象层具有与操作系统无关性. 3) 接口定义的功能应该包含硬件或者系统所需硬件支持的所有功 ...
- 详解 printf() 函数
声明(叠甲):鄙人水平有限,本文章仅供参考. 1. 引子 #include <stdio.h> int main() { printf("hello world\n") ...
- vue 前端项目创建
一.创建项目 将vue-admin-template-master 模板放入创建的 VS code 的工作空间.重命名为自己的项目. 模块获取方法:关注"Java程序员进阶",回复 ...