R语言统计图形:split.screen()函数详解

需积分: 36 30 下载量 21 浏览量 更新于2024-08-09 收藏 4.68MB PDF 举报
"这篇文档主要介绍了R语言中用于拆分屏幕进行绘图的函数split.screen(),以及相关的绘图概念。文档出自《现代统计图形》一书,作者谢益辉,采用Creative Commons许可协议,鼓励自由分享和改进。" 在R语言中,`split.screen()`函数是一个非常实用的工具,它提供了更为灵活的屏幕拆分方式,允许用户自定义图形窗口的位置和布局。在进行复杂的多图对比或者同时展示多个数据集时,这一功能显得尤为有用。不同于其他简单的拆分方法,`split.screen()`不仅能够创建行列布局,还能精确地控制每个图形在屏幕上的位置。 `split.screen()`函数的基本使用语法如下: ```r split.screen(figs, screen, erase = TRUE) ``` - `figs`: 这个参数用于指定在屏幕上创建的图形窗口数量。它可以是一个单一的数字,表示创建的总图形数,也可以是一个向量,表明每行或每列的图形数。 - `screen`: 定义图形在屏幕上的位置。它可以是一个二维向量,例如`c(x, y)`,其中`x`和`y`分别表示图形在屏幕上的列数和行数位置。也可以是一个矩阵,用来更精细地控制多个图形的布局。 - `erase`: 这个布尔参数决定在创建新图形前是否清除当前屏幕。默认设置为`TRUE`,意味着每次调用`split.screen()`都会清空屏幕。 使用`split.screen()`后,可以在每个分割的屏幕上使用常规的绘图命令,如`plot()`,`hist()`等。在绘图完成后,可以使用`next.screen()`或`switch.screen()`函数来切换到下一个或指定的屏幕继续绘图。 《现代统计图形》这本书深入探讨了R语言的图形系统,包括各种高级绘图技术,旨在帮助用户更好地理解和利用R的绘图能力。作者谢益辉强调了知识的自由传播,选择了Creative Commons "署名—非商业性使用—相同方式共享2.5中国大陆" 许可证,鼓励读者在尊重作者权益的前提下自由分享和改进书籍内容。 值得注意的是,虽然文档中提到了`screen()`函数的用法,但未提供详细说明。通常,`screen()`是用来获取或设置当前屏幕状态的,可以配合`split.screen()`使用,以管理和操作多屏幕环境。 R语言的`split.screen()`函数是实现复杂多图显示的重要工具,它为数据分析和可视化提供了极大的便利。通过熟练掌握这个函数,用户可以创建出专业且具有深度的统计图形。

insert overwrite table discountdw.dwd_sd_adds_order_bill_inc partition(dt = '2023-06-06') select t1.order_bill_id, t1.counterfoil_no, t1.acceptor, date_format(to_utc_timestamp(cast(t1.expiry_date as bigint) ,'GMT-8'),'YYYY-MM-dd'), t2.company_id, t1.cert_no, t1.company_name, t1.third_order_id, t1.counterfoil_amt/10000, t1.transaction_amt/10000, t1.rate, '3bp' as service_tariffing, ((DATEDIFF(to_utc_timestamp(t1.expiry_date ,'GMT-8'),to_utc_timestamp(t1.transaction_date ,'GMT-8') ) + adjust_days)* 0.0003 *(counterfoil_amt))/ 360 as service_fee, 360 as total_days, DATEDIFF(to_utc_timestamp(t1.expiry_date ,'GMT-8'),to_utc_timestamp(t1.transaction_date ,'GMT-8') ) + adjust_days as modulation_date, t3.channel_type, t3.bank_name, date_format(to_utc_timestamp(cast(t1.transaction_date as bigint) ,'GMT-8'),'YYYY-MM-dd'), t1.order_status_code, t1.order_status_msg, t4.fee_amt, t4.status, t1.tenant_id, t5.revenue, to_utc_timestamp(cast(t1.create_date as bigint) ,'GMT-8'), to_utc_timestamp(cast(t1.update_date as bigint) ,'GMT-8') from (select * from discountdw.ods_adds_order_bill_inc where dt ='2023-06-06' and channel_id=101110004 )t1 left join (select * from mecdw.ods_company_full where platform_id='sdpjw')t2 on t1.cert_no=t2.cert_no and t1.tenant_id=t2.tenant_id left join discountdw.dim_adds_product_full t3 on t1.partner_id=t3.partner_id and t1.product_id=t3.product_id left join (select * from mecdw.dwd_sc_fee_record_full where dt='2023-06-06' and biz_type=2 ) t4 on t1.order_bill_id=t4.third_id left join (select * from discountdw.ods_sd_order_ext_inc where dt='2023-06-06') t5 on t1.order_bill_id=t5.order_bill_id left join sdpjwdw.dim_holiday_info_full t6 on date_format(to_utc_timestamp(t1.expiry_date ,'GMT-8'),'YYYY-MM-dd') = t6.civic_holiday ;

2023-06-09 上传