The AWK Programming Language by Aho Alfred V. Kernighan Brian W. Weinberger Peter J. & Brian W. Kernighan & Peter J. Weinberger

The AWK Programming Language by Aho Alfred V. Kernighan Brian W. Weinberger Peter J. & Brian W. Kernighan & Peter J. Weinberger

Author:Aho, Alfred V., Kernighan, Brian W., Weinberger, Peter J. & Brian W. Kernighan & Peter J. Weinberger
Language: eng
Format: epub
Publisher: Pearson Education
Published: 2023-09-15T00:00:00+00:00


7.2 A Language for Drawing Graphs

The lexical and syntactic simplicity of our assembly language made its analysis easy to do with field splitting. This same simplicity also appears in some higher-level languages. Our next example is a processor for a prototype language called graph, for plotting graphs of data. The input is a graph specification in which each line is a data point or labeling information for the coordinate axes. Data points are x-y pairs, or y values for which a default sequence of x values 1, 2, 3, etc., is to be generated. Labeling information consists of a keyword and parameter values like

label caption xlabel caption ylabel caption

Such lines can appear in any order, so long as they precede the data. They are all optional.

The processor reads the data and produces a Python program together with a temporary file containing the data in the right format. Running the Python program produces a nicely formatted graph. This is a reasonable division of labor: Awk is well suited for simple processing, while Python plotting libraries like Matplotlib do an excellent job of displaying information. For example, this input:

Click here to view code image

title US Traffic Deaths by Year xlabel Year ylabel Traffic deaths 1900 36 1901 54 1902 79 1903 117 1904 172 ... 2017 37473 2018 36835 2019 36355 2020 38824 2021 42915

produces the output shown in Figure 7-1.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Cloud Auditing Best Practices: Perform Security and IT Audits across AWS, Azure, and GCP by building effective cloud auditing plans by Shinesa Cambric Michael Ratemo(942)
Ansible for Real-Life Automation - A complete Ansible handbook filled with practical IT automation use cases (2022) by Packt(613)
Learn Wireshark - A definitive guide to expertly analyzing protocols and troubleshooting networks using Wireshark - 2nd Edition (2022) by Packt(567)
Data Engineering with Scala and Spark by Eric Tome Rupam Bhattacharjee David Radford(336)
Kubernetes Secrets Handbook by Emmanouil Gkatziouras | 
Rom Adams
 | Chen Xi(194)
Power BI for Jobseekers by Alan Murray(148)
Machine Learning for Imbalanced Data by Kumar Abhishek Dr. Mounir Abdelaziz(146)
Data Labeling in Machine Learning with Python by Vijaya Kumar Suda(136)
Learn PyCharm (Python Technologies) by HASANRAZA ANSARI(133)
Hands-On Scikit-Learn for Machine Learning Applications Data Science Fundamentals with Python by David Paper (Apress;2019;9781484253724;eng)(133)
The AWK Programming Language by Aho Alfred V. Kernighan Brian W. Weinberger Peter J. & Brian W. Kernighan & Peter J. Weinberger(132)
SWIFT AND C++ PROGRAMMING MADE SIMPLE: A BEGINNER’S GUIDE TO PROGRAMMING - 2 BOOKS IN 1 by STOKES MARK(125)
Programming for Problem-Solving with C by Kamaldeep;(124)
Asynchronous Programming in Rust by Carl Fredrik Samson;(123)
The Influence of a Self-Avatar on Space and Body Perception in Immersive Virtual Reality by Ivelina Piryankova(118)
Quantum Machine Learning by Claudio Conti(111)
Practical Machine Learning on Databricks by Debu Sinha(110)
Addison-Wesley Learn Python the Hard Way, A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code 3rd (2014) by Unknown(108)
Cyber Forensics up and Running by Vashishth Tarun;(103)
Graph Data Science with Python and Neo4j: Hands-on Projects on Python and Neo4j Integration for Data Visualization and Analysis Using Graph Data Science for Building Enterprise Strategies by Timothy Eastridge(101)