- Applied Data Visualization with R and ggplot2
- Dr. Tania Moulik
- 158字
- 2021-07-23 16:59:45
Plotting with qplot and R
Suppose that we want to visualize some of the variables in the built-in datasets. A dataset can contain different kinds of variables, as discussed previously. Here, the climate data includes numerical data, such as the temperature, and categorical data, such as hot or cold. In order to visualize and correlate different kinds of data, we need to understand the nomenclature of the dataset. We'll load a data file and understand the structure of the dataset and its variables by using the qplot and R base package. Let's begin by executing the following steps:
- Plot the temperature variable from the airquality dataset, with hist(airquality$Temp) .
hist is part of the built-in R graphics package.
Take a look at the following output screenshot:

- Use qplot (which is part of the ggplot2 package) to plot a graph, using the same variables.
- Type the qplot(airquality$Temp) command to obtain the output, as shown in the following screenshot:
推薦閱讀
- Java編程全能詞典
- 網頁編程技術
- 數控銑削(加工中心)編程與加工
- 空間傳感器網絡復雜區域智能監測技術
- PostgreSQL Administration Essentials
- 大數據驅動的設備健康預測及維護決策優化
- MATLAB/Simulink權威指南:開發環境、程序設計、系統仿真與案例實戰
- 邊緣智能:關鍵技術與落地實踐
- 大數據導論
- Cloudera Hadoop大數據平臺實戰指南
- 電氣自動化工程師自學寶典(基礎篇)
- 多傳感器數據智能融合理論與應用
- 網絡設備規劃、配置與管理大全(Cisco版)
- Kibana 7 Quick Start Guide
- Building Impressive Presentations with Impress.js