R graph

R基础绘图—散点图&线图
title: “R Graph”
author: “intro”
date: “2022/1/18”
output:
pdf_document: default
html_document: default

在这里插入代码片

knitr::opts_chunk$set(echo = TRUE)

Basic Graph Functions

scatter plot

cars <- cars
str(cars)
head(cars)

在这里插入图片描述
在这里插入图片描述

cars <- cars
str(cars)
head(cars)
plot(cars$dist~cars$speed, # y~x
     pch=19,#Set the plotting symbol to filled dots
     col='lightblue',#Set the color of plotting symbol to red
     main="Relationship between car distance & speed", # Plot aTitle
     xlab="Speed (miles per hour)", #X axis title
     ylab="Distance travelled (miles)", #Y axis title
     xlim=c(0,30), #Set x axis limits from 0 to 30
     ylim=c(0,140), #Set y axis limits from 0 to 140
     xaxs="i", #Set x axis style as internal
     yaxs="i", #Set y axis style as internal
     )

在这里插入图片描述

line graphs

plot(cars$dist~cars$speed,
type="l", #Specify type of plot as l for line
col='blue',
main="Relationship between car distance & speed",
xlab="Speed miles per hour",
ylab="Distance travelled (miles)")

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值