Data Visualization
Data visualization is a vital part of analyzing data and extracting meaning from patterns
that are displayed. Displaying various types of graphs to visualize a high level view of
that data provides better insight than looking through the details of each individual
data point.
These graphs can provide a quick view of the aggregation of a period via pie charts or
trends via line charts.
By leveraging various shapes and colors data visualization can provide an impactful
view of a story that the data can tell the user.
Below is a list of visualizations and uses.
Line Charts show trends like stock performance over a period of time.
Bar Charts can visualize differences in results like surveys of people who like or
dislike a product.
Scatter Plots show correlations and relationships.
Heat Maps can show density of data in a geographical area.
Pie chart a representation of a whole 100% view of results of categorized data.sents
a specific category, and the size of that slice (its arc length, central angle, and area)
is proportional to the quantity it represents.
Tableau is a leading Data visualization tool used by companies today. Helps companies
to build all major graphs by pulling in their collected private data from sales,
manufacturing, personnel, etc. Basically all departments in the organization have a use
for Tableau dashboards.
These dashboards provide users the ability to access company data and build their
own charts and graphs.
Some of the important features of Tableau
Drag and drop fields help build visualization without the need of a developer.
Ability to pull in large volumes of data without degradation.
Users can customize chart details.
Data visualization purposes
Idea Generation - Showing data may help in product selection or problem solutions.
Visual Discovery - Helps users with trends and patterns in the data. Buying patterns
of consumers.
Story telling - Presentations often have visualization to help visually get points across.
Set Context: Show data comparisons so results can be easily viewed as good or bad.
Know the Audience: Data should be known and understood to the audience viewing it.
Keep it Simple: Make sure charts are clear, easy to read and not cluttered.
Matplotlib
In python we use the matplotlib to build visualizations
Again we need to have the libraries installed in the system.
We will use cloud storage modules to copy the graph image to a Google cloud bucket
for it can be viewed properly.
john_iacovacci1@cloudshell:~/yf (cloud-project-examples)$ pip3 install matplotlib
======================================================
import matplotlib.pyplot as plt
from google.cloud import storage
# use your project ID from Google cloud
PROJECT_ID = 'cloud-project-examples'
bucket_name = "cloud-storage-exam"
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
# 1. Prepare the data
msdate = ['Mon 2/23', 'Tue 2/24', 'Wed 2/25', 'Thu 2/26', 'Fri 2/27']
msprice = [384, 389, 400, 401, 392]
# 2. Create the plot
plt.figure(figsize=(8, 5)) # Sets the window size
plt.plot(msdate, msprice, color='green', marker='o', linestyle='-', linewidth=2)
# 3. Add "Context" (Best Practice)
plt.title('MSFT prices last week', fontsize=14)
plt.xlabel('Date')
plt.ylabel('Price')
plt.grid(True, linestyle='--', alpha=0.6) # Adds a light grid for readability
# 4. Show the chart
plt.show()
plt.savefig('msft_price.png')
# send plot file to your bucket
plot_filename = 'msft_price.png'
destination_blob_name = f'{plot_filename}'
source_file_name = 'msft_price.png'
blob = bucket.blob(destination_blob_name)
blob.upload_from_filename(source_file_name) #upload file to specified destination
print(f'File {source_file_name} uploaded to {destination_blob_name}.')
===================================================
Results
john_iacovacci1@cloudshell:~/yf (cloud-project-examples)$ python3 matplot.py
File msft_price.png uploaded to msft_price.png.
Data visualization and big data
The “age of Big Data” kicks into high gear.
As data becomes more important in today's society, visualization is an important
tool to help make sense of these vast datasets.
No comments:
Post a Comment