This book mainly introduces how to use Python packages such as matplotlib, Seaborn, plotnine, and Basemap to draw professional charts. This book first introduces the basics of Python programming, as well as data manipulation methods of NumPy and Pandas; then compares and introduces the graphic grammar of matplotlib, Seaborn, and plotnine. This book systematically introduces how to use matplotlib, Seaborn, and plotnine to draw common two-dimensional and three-dimensional charts such as category comparison, data relationship, time series, overall local, and geographic space. In addition, this book also introduces the specifications and differences between commercial charts and academic charts, as well as how to use matplotlib to draw HTML interactive page animations. Contents Chapter 1 Python Programming Basics 1 1.1 Python Basics 2 1.1.1 Installation of Python 3.7 2 1.1.2 Installation and Use of Packages 3 1.1.3 Python Basic Operations 4 1.2 6 Common Data Structures 5 1.2.1 Lists 5 1.2.2 Dictionaries 6 1.2.3 Tuples 6 1.3 Control Statements and Function Writing 6 1.3.1 Control Statements 6 1.3.2 Function Writing 8 Chapter 2 Data Processing Basics 10 2.1 NumPy: Numerical Operations 11 2.1.1 Array Creation 11 2.1.2 Array Indexing and Transformation 12 2.1.3 Array Combinations 13 2.1.4 Array Statistical Functions 14 2.2 Pandas: Table Processing 15 2.2.1 Series data structure 15 2.2.2 Data structure: DataFrame 16 2.2.3 Data type: Categorical 18 2.2.4 Table transformation 19 2.2.5 Variable transformation 20 2.2.6 Table sorting 20 2.2.7 Table concatenation 21 2.2.8 Table fusion 22 2.2.9 Table grouping 23 2.2.10 Data import and export 26 2.2.11 Missing value processing 28 Chapter 3 Data visualization basics 29 3.1 matplotlib 33 3.1.1 Graphic objects and elements 33 3.1.2 Common chart types 36 3.1.3 Sub-chart drawing 38 3.1.4 Coordinate system transformation 41 3.1.5 Chart export. 44 3.2 Seaborn 44 3.2.1 Common chart types. 45 3.2.2 Chart style and color theme. 46 3.2.3 Faceted chart drawing. 48 3.3 plotnine 50 3.3.1 geom_???() and stat_???() 51 3.3.2 Aesthetic parameter mapping. 54 3.3.3 Measurement adjustment. 58 3.3.4 Coordinate system and its measurement. 64 3.3.5 Legend. 69 3.3.6 Theme system. 71 3.3.7 Facet system. 73 3.3.8 Position adjustment. 74 3.4 Principles of color visualization. 76 3.4.1 RGB color mode. 76 3.4.2 HSL color mode. 77 3.4.3 LUV color mode. 79 3.4.4 Principles of color theme matching 80 3.4.5 Picking and using color theme schemes 84 3.4.6 Application examples of color themes 87 3.5 Basic types of charts 91 3.5.1 Category comparison 91 3.5.2 Data relationship 92 3.5.3 Data distribution 93 3.5.4 Time series 94 3.5.5 Partial whole 94 3.5.6 Geographic space 95 Chapter 4 Category comparison charts 96 4.1 Column chart series 97 4.1.1 Single data series column chart 98 4.1.2 Multiple data series column chart 100 4.1.3 Stacked column chart 101 4.1.4 Percentage stacked column chart 102 4.2 Bar chart series 104 4.3 4.4 Cleveland dot chart. 106 4.5 Slope chart. 108 4.6 Nightingale rose chart. 110 4.7 Radial column chart. 114 4.8 Radar chart. 117 4.9 Word cloud chart. 119 Chapter 5 Data relationship chart. 122 5.1 Scatter chart series. 123 5.1.1 Two-dimensional scatter chart for trend display. 123 5.1.2 Two-dimensional scatter chart for distribution display. 131 5.1.3 Bubble chart. 136 5.1.4 Three-dimensional scatter chart. 139 5.2 Surface fitting. 142 5.3 Contour chart. 145 5.4 Scatter curve chart series. 147 5.5 Waterfall chart. 149 5.6 Correlation coefficient chart. 156 Chapter 6 Data Distribution Charts 159 6.1 Statistical Histogram and Kernel Density Estimation Chart 161 6.1.1 Statistical Histogram 161 6.1.2 Kernel Density Estimation Chart 161 6.2 Data Distribution Chart Series 165 6.2.1 Scattered Data Distribution Chart Series 166 6.2.2 Column Distribution Chart Series 168 6.2.3 Box Plot Series 169 6.2.4 Violin Plot 175 6.3 2D Statistical Histogram and Kernel Density Estimation Chart 179 6.3.1 2D Statistical Histogram 179 6.3.2 2D Kernel Density Estimation Chart 180 Chapter 7 Time Series Charts 184 7.1 Line Chart and Area Chart Series 185 7.1.1 Line Chart 185 7.1.2 7.2 Calendar Chart. 192 7.3 Quantitative Waveform Chart. 195 Chapter 8 Local-Overall Charts. 199 8.1 Pie Chart Series. 200 8.1.1 Pie Chart. 200 8.1.2 Donut Chart. 202 8.2 Mosaic Chart. 203 8.3 Waffle Chart. 206 8.4 Block/Point Column Chart Series. 208 Chapter 9 High-Dimensional Data Charts. 213 9.1 Transformation Display of High-Dimensional Data. 215 9.1.1 Principal Component Analysis. 215 9.1.2 t-SNE Algorithm. 217 9.2 Facet Chart. 218 9.3 Matrix Scatter Chart. 221 9.4 Heat Map. 224 9.5 Parallel Coordinates Chart. 227 9.6 RadViz Graph 229 Chapter 10 Geographical Spatial Charts 231 10.1 Maps of Different Levels 232 10.1.1 World Map 232 10.1.2 Country Map 238 10.2 Hierarchical Statistical Map 241 10.3 Pointillism Map 244 10.4 Map with Columns 248 10.5 Equi-Position Map 250 10.6 Dot Map 252 10.7 Simplified Schematic 256 10.8 Postal Code Method 260 Chapter 11 Data Visualization Examples 263 11.1 Business Chart Drawing Examples 264 11.1.1 Business Chart Drawing Basics 264 11.1.2 Business Chart Drawing Example ① 269 11.1.3 Business Chart Drawing Example ② 270 11.2 Examples of Academic Chart Drawing. 273 11.2.1 Basics of Academic Chart Drawing 274 11.2.2 Examples of Academic Chart Drawing 276 11.3 Examples of Data Analysis and Visualization. 278 11.3.1 Drawing of a Schematic Subway Map 278 11.3.2 Drawing of an Actual Subway Map 280 11.3.3 Application of Subway Maps 281 11.4 Demonstration of Dynamic Data Visualization. 286 11.4.1 Making a Dynamic Bar Chart 286 11.4.2 Making a Dynamic Area Chart 291 11.4.3 Production of 3D cylindrical map animation 296 References. 301
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore