Python | Horizontal Grid in Box Plot

In this article, we are going to learn and explore the grid type in box plot for better data visualization?
Submitted by Anuj Singh, on August 08, 2020

Following example illustrates the implementation of our Grid Plot.

Python | Horizontal Grid in Box Plot (1)

Python | Horizontal Grid in Box Plot (2)

Python code for horizontal grid in box plot

import numpy as np
import matplotlib.pyplot as plt

# Generating Data
spread = np.random.rand(65) * 82
center = np.ones(36) * 50
flier_high = np.random.rand(12) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low))

plt.figure()
plt.title('Horizontal Grid in Box Plot')
plt.boxplot(data)
plt.ylabel('Variation')
plt.grid(True)
plt.figure()

plt.figure(figsize=(2,6))
plt.title('Horizontal Grid in Box Plot')
plt.boxplot(data)
plt.ylabel('Variation')
plt.grid(True)
plt.figure()

Output:

Output is as Figure





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.