0% found this document useful (0 votes)
14 views4 pages

Blood Sugar Histogram Analysis

The document provides Python code using Matplotlib to create histograms comparing blood sugar levels between men and women. It specifies chart titles, axis labels, colors, and legend placements for the visualizations. Additionally, it includes a modified version of the code to display the histogram horizontally with a different legend position.

Uploaded by

habelanish11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

Blood Sugar Histogram Analysis

The document provides Python code using Matplotlib to create histograms comparing blood sugar levels between men and women. It specifies chart titles, axis labels, colors, and legend placements for the visualizations. Additionally, it includes a modified version of the code to display the histogram horizontally with a different legend position.

Uploaded by

habelanish11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON PROGRAM – XIV

PYPLOT- IV
a) Given below are the sugar levels for men and women in a city. Compare the
sugar
levels among them through a histogram.
MEN=[113,85,90,150,149,88,93,115,135,80,77,82,129]
WOMEN=[67,98,89,120,133,150,84,69,89,79,120,112,100]
Ensure the following specifications in the chart
Title should be Blood Sugar Analysis
X axis label should be Sugar Range
Y axis label should be Total Number Of patients
Color for Men should be Red and for women should be black
Legends MEN and WOMEN should be placed in the upper left corner of your
chart
PROGRAM:
import [Link] as p
MEN=[113,85,90,150,149,88,93,115,135,80,77,82,129]
WOMEN=[67,98,89,120,133,150,84,69,89,79,120,112,100]
[Link]([MEN,WOMEN],bins=[60,80,100,120,140,160],color=['red','black'],label=['
MEN',
'WOMEN'])
[Link]("SUGAR RANGE")
[Link]("TOTAL NUMBER OF PATIENTS")
[Link]("BLOOD SUGAR ANALYSIS")
[Link](loc=1)
[Link]( )
OUTPUT:
b) Modify the above code to display the histogram horizontally and to display the
legend in the lower right corner.
PROGRAM
import [Link] as p
MEN=[113,85,90,150,149,88,93,115,135,80,77,82,129]
WOMEN=[67,98,89,120,133,150,84,69,89,79,120,112,100]
[Link]([MEN,WOMEN],bins=[60,80,100,120,140,160],color=['red','black'],label=['
ME
N','WOMEN'],orientation=’horizontal’)
[Link]("SUGAR RANGE")
[Link]("TOTAL NUMBER OF PATIENTS")
[Link]("BLOOD SUGAR ANLYSIS")
[Link](loc=4)
[Link]( )
OUTPUT:

You might also like