R Graph Cookbook


R Graph Cookbook
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$25.49
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Learn to draw any type of graph or visual data representation in R
  • Filled with practical tips and techniques for creating any type of graph you need; not just theoretical explanations
  • All examples are accompanied with the corresponding graph images, so you know what the results look like
  • Each recipe is independent and contains the complete explanation and code to perform the task as efficiently as possible

Book Details

Language : English
Paperback : 272 pages [ 235mm x 191mm ]
Release Date : January 2011
ISBN : 1849513066
ISBN 13 : 9781849513067
Author(s) : Hrishi V. Mittal
Topics and Technologies : All Books, Big Data and Business Intelligence, Data, Cookbooks, Open Source

Table of Contents

Preface
Chapter 1: Basic Graph Functions
Chapter 2: Beyond the Basics: Adjusting Key Parameters
Chapter 3: Creating Scatter Plots
Chapter 4: Creating Line Graphs and Time Series Charts
Chapter 5: Creating Bar, Dot, and Pie Charts
Chapter 6: Creating Histograms
Chapter 7: Creating Box and Whisker Plots
Chapter 8: Creating Heat Maps and Contour Plots
Chapter 9: Creating Maps
Chapter 10: Finalizing graphs for publications and presentations
Index
  • Chapter 1: Basic Graph Functions
    • Introduction
    • Creating scatter plots
    • Creating line graphs
    • Creating bar charts
    • Creating histograms and density plots
    • Creating box plots
    • Adjusting X and Y axes limits
    • Creating heat maps
    • Creating pairs plots
    • Creating multiple plot matrix layouts
    • Adding and formatting legends
    • Creating graphs with maps
    • Saving and exporting graphs
    • Chapter 2: Beyond the Basics: Adjusting Key Parameters
      • Introduction
      • Setting colors of points, lines, and bars
      • Setting plot background colors
      • Setting colors for text elements: axis annotations, labels, plot titles, and legends
      • Choosing color combinations and palettes
      • Setting fonts for annotations and titles
      • Choosing plotting point symbol styles and sizes
      • Choosing line styles and width
      • Choosing box styles
      • Adjusting axis annotations and tick marks
      • Formatting log axes
      • Setting graph margins and dimensions
      • Chapter 3: Creating Scatter Plots
        • Introduction
        • Grouping data points within a scatter plot
        • Highlighting grouped data points by size and symbol type
        • Labelling data points
        • Correlation matrix using pairs plot
        • Adding error bars
        • Using jitter to distinguish closely packed data points
        • Adding linear model lines
        • Adding non-linear model curves
        • Adding non-parametric model curves with lowess
        • Making three-dimensional scatter plots
        • How to make Quantile-Quantile plots
        • Displaying data density on axes
        • Making scatter plots with smoothed density representation
        • Chapter 4: Creating Line Graphs and Time Series Charts
          • Introduction
          • Adding customized legends for multiple line graphs
          • Using margin labels instead of legends for multiple line graphs
          • Adding horizontal and vertical grid lines
          • Adding marker lines at specific X and Y values
          • Creating sparklines
          • Plotting functions of a variable in a dataset
          • Formatting time series data for plotting
          • Plotting date and time on the X axis
          • Annotating axis labels in different human readable time formats
          • Adding vertical markers to indicate specific time events
          • Plotting data with varying time averaging periods
          • Creating stock charts
          • Chapter 5: Creating Bar, Dot, and Pie Charts
            • Introduction
            • Creating bar charts with more than one factor variable
            • Creating stacked bar charts
            • Adjusting the orientation of bars—horizontal and vertical
            • Adjusting bar widths, spacing, colors, and borders
            • Displaying values on top of or next to the bars
            • Placing labels inside bars
            • Creating bar charts with vertical error bars
            • Modifying dot charts by grouping variables
            • Making better readable pie charts with clockwise-ordered slices
            • Labelling a pie chart with percentage values for each slice
            • Adding a legend to a pie chart
            • Chapter 6: Creating Histograms
              • Introduction
              • Visualizing distributions as count frequencies or probability densities
              • Setting bin size and number of breaks
              • Adjusting histogram styles: bar colors, borders, and axes
              • Overlaying density line over a histogram
              • Multiple histograms along the diagonal of a pairs plot
              • Histograms in the margins of line and scatter plots
              • Chapter 7: Creating Box and Whisker Plots
                • Introduction
                • Creating box plots with narrow boxes for a small number of variables
                • Grouping over a variable
                • Varying box widths by number of observations
                • Creating box plots with notches
                • Including or excluding outliers
                • Creating horizontal box plots
                • Changing box styling
                • Adjusting the extent of plot whiskers outside the box
                • Showing the number of observations
                • Splitting a variable at arbitrary values into subsets
                • Chapter 8: Creating Heat Maps and Contour Plots
                  • Introduction
                  • Creating heat maps of single Z variable with scale
                  • Creating correlation heat maps
                  • Summarizing multivariate data in a heat map
                  • Creating contour plots
                  • Creating filled contour plots
                  • Creating three-dimensional surface plots
                  • Visualizing time series as calendar heat maps
                  • Chapter 9: Creating Maps
                    • Introduction
                    • Plotting global data by countries on a world map
                    • Creating graphs with regional maps
                    • Plotting data on Google maps
                    • Creating and reading KML data
                    • Working with ESRI shapefiles
                    • Chapter 10: Finalizing graphs for publications and presentations
                      • Introduction
                      • Exporting graphs in high resolution image formats: PNG, JPEG, BMP, TIFF
                      • Exporting graphs in vector formats: SVG, PDF, PS
                      • Adding mathematical and scientific notations (typesetting)
                      • Adding text descriptions to graphs
                      • Using graph templates
                      • Choosing font families and styles under Windows, Mac OS X, and Linux
                      • Choosing fonts for PostScripts and PDFs

                      Hrishi V. Mittal

                      Hrishi Mittal has been working with R for a few years in different capacities. He was introduced to the exciting world of data analysis with R when he was working as Senior Air Quality Scientist at King’s College London, where he used R extensively to analyze large amounts of air pollution and traffic data for informing the London Mayor’s Air Quality Strategy. He has experience in various other programming languages, but prefers R for data analysis and visualization. He is actively involved in various R mailing lists, forums and the development of some R packages. In early 2010, he started Pretty Graph Limited (http://www.prettygraph.com), a software company specializing in web-based data visualization products. The company’s flagship product Pretty Graph uses R as the backend engine for helping researchers and businesses visualize and analyze data. The goal is to bring the power of R to a wider audience by providing a modern graphical user interface which can be accessed by anyone and from anywhere simply using a web browser.

                      Code Downloads

                      Download the code and support files for this book.


                      Submit Errata

                      Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                      Errata

                      - 3 submitted: last submission 03 Dec 2013

                      Errata type: Code | Page no.: 207

                      The first line of code reads:

                      sd -> data.frame(col=colours,values= ,...)

                      This should be replaced with :

                      sd <- data.frame(col=colours,values= ,...)

                      Errata type: technical | Page number: 160 | Errata date: 13 May 2013

                      The image in the "How to do it..." section should be replaced with the following image:

                       

                      Errata type: technical | Page number: 161 | Errata date: 13 May 2013

                      The image on this page should be replaced with the following image:

                      Sample chapters

                      You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                      Frequently bought together

                      R Graph Cookbook +    jBPM Developer Guide =
                      50% Off
                      the second eBook
                      Price for both: $34.79

                      Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                      What you will learn from this book

                      • Construct multiple graph matrix layouts
                      • Summarize multivariate datasets with a single graph
                      • Create custom graph functions to avoid code repetition
                      • Make and re-use visual themes for graphs
                      • Save and export graphs in various formats to print or publish
                      • Learn to use fonts and annotations in graphs on Windows, Mac, and Linux
                      • Combine different graph types to give a better visual summary of complex datasets
                      • Present geographical data on maps
                      • Use heatmaps to spot trends and anomalies in large datasets
                      • Add scientific annotations and formulae to label graphs
                      • Add text descriptions to create graph presentation handouts
                      • Create beautiful color palettes and apply them to graphs

                      In Detail

                      With more than two million users worldwide, R is one of the most popular open source projects. It is a free and robust statistical programming environment with very powerful graphical capabilities. Analyzing and visualizing data with R is a necessary skill for anyone doing any kind of statistical analysis, and this book will help you do just that in the easiest and most efficient way possible.

                      Unlike other books on R, this book takes a practical, hands-on approach and you dive straight into creating graphs in R right from the very first page.

                      You want to harness the power of this open source programming language to visually present and analyze your data in the best way possible – and this book will show you how.

                      The R Graph Cookbook takes a practical approach to teaching how to create effective and useful graphs using R. This practical guide begins by teaching you how to make basic graphs in R and progresses through subsequent dedicated chapters about each graph type in depth. It will demystify a lot of difficult and confusing R functions and parameters and enable you to construct and modify data graphics to suit your analysis, presentation, and publication needs.

                      You will learn all about making graphics such as scatter plots, line graphs, bar charts, pie charts, dot plots, heat maps, histograms and box plots. In addition, there are detailed recipes on making various combinations and advanced versions of these graphs. Dedicated chapters on polishing and finalizing graphs will enable you to produce professional-quality graphs for presentation and publication. With R Graph Cookbook in hand, making graphs in R has never been easier.

                      Approach

                      This hands-on guide cuts short the preamble and gets straight to the point – actually creating graphs, instead of just theoretical learning. Each recipe is specifically tailored to fulfill your appetite for visually representing you data in the best way possible.

                      Who this book is for

                      This book is for readers already familiar with the basics of R who want to learn the best techniques and code to create graphics in R in the best way possible. It will also serve as an invaluable reference book for expert R users.

                      Height Map Topography

                       

                       

                       

                      Code Download and Errata
                      Packt Anytime, Anywhere
                      Register Books
                      Print Upgrades
                      eBook Downloads
                      Video Support
                      Contact Us
                      Awards Voting Nominations Previous Winners
                      Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                      Resources
                      Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software