Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON ASSISTANCE The code below displays a Seaborn Heat Map and I need assistance with the following: 1) All zero values to be masked to

PYTHON ASSISTANCE

The code below displays a Seaborn Heat Map and I need assistance with the following:

1) All zero values to be masked to something else. 2) All data values to display as I have them written in the code: I do not want Seaborn to round them or display large values in scientific notation, and I want the values with four decimal places to HAVE four decimal places.

Can anyone assist?

import seaborn as sns import matplotlib.pyplot as plt plt.rcParams["font.family"] = "serif" w = 65 h = 55 d = 100 x_axis_labels = ['WARD_Multiple_PLFA'' ''(BALSER)_Nov_2017'' ''Wildlife Preserve'' '' ', 'WARD_Multiple_PLFA'' ''(BALSER)_Nov_2017'' ''Turkey Hollow'' '' ', 'WARD Multiple'' ''Soil3_Nov_2017'' ''Wildlife Preserve'' '' ', 'WARD Multiple'' ''Soil3_Nov_2017'' ''Turkey Hollow'' '' ', 'WARD Multiple_HANEY_+_PLFA'' ''WHC_May_2019'' ''Wildlife Preserve'' ', 'WARD Multiple_HANEY_+_PLFA'' ''WHC_May_2019'' ''Turkey Hollow'' ', 'Kroeger_Bamberger'' ''Misc_10-27-2021'' ''Wildlife Preserve', 'Kroeger_Bamberger'' ''Misc_10-27-2021'' ''Turkey Hollow', 'Kroeger_Bamberger'' ''Haney_10-27-21'' ''Wildlife Preserve', 'Kroeger_Bamberger'' ''Haney_10-27-21'' ''Turkey Hollow', 'Kroeger_Bamberger'' ''PLFA_10-29-2021'' ''Wildlife Preserve', 'Kroeger_Bamberger'' ''PLFA_10-29-2021'' ''Turkey Hollow'] # labels for x-axis y_axis_labels = ['SoilpH1Ratio1', 'OrganicMatterPercentLOI', 'SoilRespirationppmCO2C', 'H2OTotalOrgCppmC', 'H2OOrgNppmN', 'H2OOrgCRatioOrgN', 'H2OOrgNRatioH3AInorgN', 'OrganicNReleaseppmN', 'OrganicNReserveppmN', 'H3AOrganicPhosphorusppmP', 'OrganicPReleaseppmP', 'OrganicPReserveppmP', 'SoilHealthScore', 'Tot_Liv_MicrobialBioMPLFAngPerg', 'FungiRatioBacteria', 'ProtozoaRatioBacteria', 'MicroaggregatesP_LT025GT0053mm', 'MacroaggregatesP_GT025mm', 'B_glucosidaseMicroGsPerGsPerHr', 'PermanganateOxidizableCarbonppmC', 'WHC_inchH2OinchPerSoil'] # labels for y-axis plt.figure(figsize=(w, h), dpi=d) data = data = [[0,0,7.9,7.9,8.2,8.3,0,0,8.3,8.2,0,0], [0,0,4.3,4,4.1,3.4,0,0,3.1,5.8,0,0], [0,0,0,0,26,49.6,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,16.7,16.5,0,0,0,0,0,0], [0,0,0,0,18.7,23.8,0,0,0,0,0,0], [0,0,0,0,1.2,1.2,0,0,0,0,0,0], [0,0,0,0,5.6,8.3,0,0,0,0,0,0], [0,0,0,0,11.2,8.2,0,0,0,0,0,0], [0,0,0,0,1.7,2.2,0,0,0,0,0,0], [0,0,0,0,0.4,0.8,0,0,0,0,0,0], [0,0,0,0,1.2,1.3,0,0,0,0,0,0], [0,0,0,0,10.54,14.46,0,0,0,0,0,0], [2000.01,2118.74,0,0,3319.47,3380.34,0,0,0,0,2126.31,4024.43], [0.1511,0.1661,0,0,0.418,0.523,0,0,0,0,0.2151,0.3294], [1,1,0,0,1,0,0,0,0,0,2,0.0079], [0,0,0,0,0,0,16.7,17.7,0,0,0,0], [0,0,0,0,0,0,31.6,39.3,0,0,0,0], [0,0,0,0,0,0,36.4,81.6,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0.21,0.29,0.19,0.22,0,0,0,0]] s = sns.heatmap(data, vmin=None, vmax=None, cbar=False, xticklabels=x_axis_labels, yticklabels=y_axis_labels, annot=True, fmt=".4f", cmap='bone_r', linewidth=5, square=False, center=0, annot_kws={"size":50}) plt.title(' ''Bamberger Ranch: Soil Testing Results', fontsize=105, fontweight="bold") plt.tick_params(which='major', length=25, width=2, direction='out') plt.xticks(rotation = 75, fontsize=30) # x-axis format plt.xlabel(' ''Testings Years:'' ''2017, 2018, 2021', fontsize=75, fontweight="bold") # x-axis title plt.yticks(fontsize=40) # y-axis format plt.ylabel('Analytes', rotation = 0, fontsize=75, fontweight="bold") # y-axis title plt.savefig("Bamberger Soil Testing Results.png")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions