Learning the Pandas Library: Python Tools for Data Munging, Analysis, and Visualization (Treading on Python Book 3) by Matt Harrison
Author:Matt Harrison [Harrison, Matt]
Language: eng
Format: epub, pdf
Tags: Python Programming Language
Publisher: Matt Harrison
Published: 2016-06-06T21:00:00+00:00
Plot using secondary_y parameter to use different scales on the left and right axis for elevation and distance.
Another way to convey information is to plot with labels along the x axis instead of using a numerical index (which does not mean much to viewers of the graph). By default, pandas plots the index along the x axis. To graph against the name of the station, we need to pass in an explicit value for x, the ELEVATION column. The labels will need to tilted a bit so that they do not overlap. This rotation is done with fig.autofmt_xdate(). The bounding box also needs to be expanded a bit so the labels do not get clipped off at the edges. The bbox_inches='tight' parameter to fig.savefig will help with this:
>>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> df.plot(x='LOCATION', y=['ELEVATION', 'CUMUL'], ax=ax) >>> df.plot(x='LOCATION', y='MILES', secondary_y=True, ax=ax) >>> ax.set_ylabel('Elevation (feet)') >>> ax.right_ax.set_ylabel('Distance (miles)') >>> fig.autofmt_xdate() >>> fig.savefig('/tmp/df-ex4.png', bbox_inches='tight')
Download
Learning the Pandas Library: Python Tools for Data Munging, Analysis, and Visualization (Treading on Python Book 3) by Matt Harrison.pdf
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.
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(7364)
Supercharging Productivity with Trello by Brittany Joiner(6626)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6421)
Mastering Tableau 2023 - Fourth Edition by Marleen Meier(6391)
Inkscape by Example by István Szép(6239)
Visualize Complex Processes with Microsoft Visio by David J Parker & Šenaj Lelić(5938)
Build Stunning Real-time VFX with Unreal Engine 5 by Hrishikesh Andurlekar(4935)
Design Made Easy with Inkscape by Christopher Rogers(4614)
Customizing Microsoft Teams by Gopi Kondameda(4151)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3935)
Extending Microsoft Power Apps with Power Apps Component Framework by Danish Naglekar(3743)
Business Intelligence Career Master Plan by Eduardo Chavez & Danny Moncada(3716)
Salesforce Platform Enterprise Architecture - Fourth Edition by Andrew Fawcett(3621)
Pandas Cookbook by Theodore Petrou(3594)
The Tableau Workshop by Sumit Gupta Sylvester Pinto Shweta Sankhe-Savale JC Gillet and Kenneth Michael Cherven(3397)
TCP IP by Todd Lammle(2988)
Drawing Shortcuts: Developing Quick Drawing Skills Using Today's Technology by Leggitt Jim(2916)
Applied Predictive Modeling by Max Kuhn & Kjell Johnson(2879)
Exploring Microsoft Excel's Hidden Treasures by David Ringstrom(2855)
