SlideShare a Scribd company logo
1 of 28
Visualization
UW CSE 190p
Summer 2012
BARE BONES VISUALIZATION IN
PYTHON WITH MATPLOTLIB
matplotlib
• A major design limitation is that it stives to
emulate MATLAB
– More on this in the next lecture
• One important function for HW6:
plot(xvalues, yvalues)
Plot
import matplotlib.pyplot as plt
xs = [1,2,3,4,5]
ys = [x**2 for x in xs]
plt.plot(xs, ys)
no return value?
• We are operating on a “hidden” variable representing the figure.
• This is a terrible, terrible trick.
• Its only purpose is to pander to MATLAB users.
• I’ll show you how this works in the next lecture
import matplotlib.pyplot as plt
xs = range(-100,100,10)
x2 = [x**2 for x in xs]
negx2 = [-x**2 for x in xs]
plt.plot(xs, x2)
plt.plot(xs, negx2)
plt.xlabel("x”)
plt.ylabel("y”)
plt.ylim(-2000, 2000)
plt.axhline(0) # horiz line
plt.axvline(0) # vert line
plt.savefig(“quad.png”)
plt.show()
Incrementally
modify the figure.
Show it on the screen
Save your figure to a file
We can group these options into functions as usual, but remember that they
are operating on a global, hidden variable
WHY VISUALIZE DATA?
Review
Bill Howe, eScience Institute
John Snow
Location of deaths in the 1854 London Cholera Epidemic.
X marks the locations of the water pumps
Dr. John Snow
Anscombe’s Quartet
x y x y x y x y
10 8.04 10 9.14 10 7.46 8 6.58
8 6.95 8 8.14 8 6.77 8 5.76
13 7.58 13 8.74 13 12.74 8 7.71
9 8.81 9 8.77 9 7.11 8 8.84
11 8.33 11 9.26 11 7.81 8 8.47
14 9.96 14 8.1 14 8.84 8 7.04
6 7.24 6 6.13 6 6.08 8 5.25
4 4.26 4 3.1 4 5.39 19 12.5
12 10.84 12 9.13 12 8.15 8 5.56
7 4.82 7 7.26 7 6.42 8 7.91
5 5.68 5 4.74 5 5.73 8 6.89
I II III IV
Anscombe’s Quartet (2)
• mean of the x values = 9.0
• mean of the y values = 7.5
• equation of the least-squared regression line:
y = 3 + 0.5x
• sums of squared errors (about the mean) = 110.0
• regression sums of squared errors
(variance accounted for by x) = 27.5
• residual sums of squared errors
(about the regression line) = 13.75
• correlation coefficient = 0.82
• coefficient of determination = 0.67
Anscombe’s Quartet (3)
Another example: Pearson Correlation
Other reasons?
• Visualization is the highest bandwidth channel
into the human brain [Palmer 99]
• The visual cortex is the largest system in the
human brain; it’s wasteful not to make use of it.
• As data volumes grow, visualization becomes a
necessity rather than a luxury.
– “A picture is worth a thousand words”
Time
Amount
of
data
in
the
world
Time
Processing
power
What is the rate-limiting step in data understanding?
Processing power:
Moore’s Law
Amount of data in
the world
slide src: Cecilia Aragon, UW HCDE
Processing
power
Time
What is the rate-limiting step in data understanding?
Processing power:
Moore’s Law
Human cognitive capacity
Idea adapted from “Less is More” by Bill Buxton (2001)
Amount of data in
the world
slide src: Cecilia Aragon, UW HCDE
What makes a good visualization?
Edward Tufte: Minimize the Lie Factor
Lie Factor =
Size of effect in the visualization
Size of effect in the data
Example
Tufte 1997
What makes a good visualization?
• Edward Tufte: Maximize the data-ink ratio
Example: High or Low Data Ink ratio?
Example: High or Low Data Ink ratio?
Bateman et al: The Effects of Visual Embellishment on
Comprehension and Memorability of Charts
• There was no significant difference between plain and
image charts for interactive interpretation accuracy (i.e.,
when the charts were visible).
• There was also no significant difference in recall accuracy
after a five-minute gap.
• After a long-term gap (2-3 weeks), recall of both the chart
topic and the details (categories and trend) was
significantly better for Holmes charts.
• Participants saw value messages in the Holmes charts
significantly more often than in the plain charts.
• Participants found the Holmes charts more attractive, most
enjoyed them, and found that they were easiest and fastest
to remember.
What makes a good visualization?
• Edward Tufte: Small multiples
What makes a good visualization?
• Jock Mackinlay: Use the appropriate visual element for the
relationship and data being analyzed
Conjectured rank effectiveness of each visualization method by data type
What makes a good visualization?
Tufte again: Small multiples
Lloyd Treinish, IBM Research, http://www.research.ibm.com/people/l/lloydt/
What makes a good visualization?
Lloyd Treinish: Color Matters
Color Matters (2)
Lloyd Treinish, IBM
Research,
http://www.research.
ibm.com/people/l/llo
ydt/
A Nice Example
Bergstrom, Rosvall, 2011

More Related Content

Similar to 15-visualization.pptx

Language Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAILanguage Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAI
SamuelButler15
 
!Business statistics tekst
!Business statistics tekst!Business statistics tekst
!Business statistics tekst
King Nisar
 
Programming in python
Programming in pythonProgramming in python
Programming in python
Ivan Rojas
 
Final_Report_Rohit-Neha
Final_Report_Rohit-NehaFinal_Report_Rohit-Neha
Final_Report_Rohit-Neha
neha agarwal
 

Similar to 15-visualization.pptx (20)

6 data envelopment_analysis
6 data envelopment_analysis6 data envelopment_analysis
6 data envelopment_analysis
 
2. filtering basics
2. filtering basics2. filtering basics
2. filtering basics
 
Language Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAILanguage Language Models (in 2023) - OpenAI
Language Language Models (in 2023) - OpenAI
 
04 numerical
04 numerical04 numerical
04 numerical
 
Map-Reduce for Machine Learning on Multicore
Map-Reduce for Machine Learning on MulticoreMap-Reduce for Machine Learning on Multicore
Map-Reduce for Machine Learning on Multicore
 
Regression
RegressionRegression
Regression
 
Fa19_P1.pptx
Fa19_P1.pptxFa19_P1.pptx
Fa19_P1.pptx
 
Predict saturated thickness using tensor board visualization
Predict saturated thickness using tensor board visualizationPredict saturated thickness using tensor board visualization
Predict saturated thickness using tensor board visualization
 
Chapter3_Visualizations2.pdf
Chapter3_Visualizations2.pdfChapter3_Visualizations2.pdf
Chapter3_Visualizations2.pdf
 
Engineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdfEngineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdf
 
1
11
1
 
!Business statistics tekst
!Business statistics tekst!Business statistics tekst
!Business statistics tekst
 
06-01 Machine Learning and Linear Regression.pptx
06-01 Machine Learning and Linear Regression.pptx06-01 Machine Learning and Linear Regression.pptx
06-01 Machine Learning and Linear Regression.pptx
 
Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
 
Diving into Deep Learning (Silicon Valley Code Camp 2017)
Diving into Deep Learning (Silicon Valley Code Camp 2017)Diving into Deep Learning (Silicon Valley Code Camp 2017)
Diving into Deep Learning (Silicon Valley Code Camp 2017)
 
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
Optimization for Neural Network Training - Veronica Vilaplana - UPC Barcelona...
 
07 dimensionality reduction
07 dimensionality reduction07 dimensionality reduction
07 dimensionality reduction
 
Programming in python
Programming in pythonProgramming in python
Programming in python
 
Final_Report_Rohit-Neha
Final_Report_Rohit-NehaFinal_Report_Rohit-Neha
Final_Report_Rohit-Neha
 
The Concurrent Constraint Programming Research Programmes -- Redux (part2)
The Concurrent Constraint Programming Research Programmes -- Redux (part2)The Concurrent Constraint Programming Research Programmes -- Redux (part2)
The Concurrent Constraint Programming Research Programmes -- Redux (part2)
 

Recently uploaded

Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...
Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...
Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...
mikehavy0
 
Evaluating natural frequencies and mode shapes.pptx
Evaluating natural frequencies and mode shapes.pptxEvaluating natural frequencies and mode shapes.pptx
Evaluating natural frequencies and mode shapes.pptx
joshuaclack73
 
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
ugzga
 
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
ugzga
 
Design-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora AgencyDesign-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora Agency
Isadora Agency
 
如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证
ugzga
 
NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...
NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...
NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...
Amil baba
 
挂科办理天主教大学毕业证成绩单一模一样品质
挂科办理天主教大学毕业证成绩单一模一样品质挂科办理天主教大学毕业证成绩单一模一样品质
挂科办理天主教大学毕业证成绩单一模一样品质
yzeoq
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
210303105569
 
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
thubko
 
ECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdf
ECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdfECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdf
ECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdf
Sarbjit Bahga
 
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjjWeek 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
joshuaclack73
 

Recently uploaded (20)

Bit Dhrumi shah Graphic Designer portfolio
Bit Dhrumi shah Graphic Designer portfolioBit Dhrumi shah Graphic Designer portfolio
Bit Dhrumi shah Graphic Designer portfolio
 
Latest Trends in Home and Building Design
Latest Trends in Home and Building DesignLatest Trends in Home and Building Design
Latest Trends in Home and Building Design
 
Spring Summer 26 Colors Trend Book Peclers Paris
Spring Summer 26 Colors Trend Book Peclers ParisSpring Summer 26 Colors Trend Book Peclers Paris
Spring Summer 26 Colors Trend Book Peclers Paris
 
Digital Marketing Company in Bangalore.pdf
Digital Marketing Company in Bangalore.pdfDigital Marketing Company in Bangalore.pdf
Digital Marketing Company in Bangalore.pdf
 
Top 10 Website Designing Hacks for Beginners.pptx.pptx
Top 10 Website Designing Hacks for Beginners.pptx.pptxTop 10 Website Designing Hacks for Beginners.pptx.pptx
Top 10 Website Designing Hacks for Beginners.pptx.pptx
 
CADD 141 - Puzzle Cube Project - Product Photos
CADD 141 - Puzzle Cube Project - Product PhotosCADD 141 - Puzzle Cube Project - Product Photos
CADD 141 - Puzzle Cube Project - Product Photos
 
Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...
Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...
Abortion Clinic in Springs +27791653574 Springs WhatsApp Abortion Clinic Serv...
 
Evaluating natural frequencies and mode shapes.pptx
Evaluating natural frequencies and mode shapes.pptxEvaluating natural frequencies and mode shapes.pptx
Evaluating natural frequencies and mode shapes.pptx
 
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
 
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
 
Design-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora AgencyDesign-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora Agency
 
如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(RUG毕业证书)格罗宁根大学毕业证成绩单本科硕士学位证留信学历认证
 
The concept of motion graphics and its applications.
The concept of motion graphics and its applications.The concept of motion graphics and its applications.
The concept of motion graphics and its applications.
 
NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...
NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...
NO1 Best Vashikaran Specialist in Uk Black Magic Specialist in Uk Black Magic...
 
挂科办理天主教大学毕业证成绩单一模一样品质
挂科办理天主教大学毕业证成绩单一模一样品质挂科办理天主教大学毕业证成绩单一模一样品质
挂科办理天主教大学毕业证成绩单一模一样品质
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
 
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
 
ECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdf
ECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdfECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdf
ECHOES OF GENIUS - A Tribute to Nari Gandhi's Architectural Legacy. .pdf
 
Webhost NVME Cloud VPS Hosting1234455678
Webhost NVME Cloud VPS Hosting1234455678Webhost NVME Cloud VPS Hosting1234455678
Webhost NVME Cloud VPS Hosting1234455678
 
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjjWeek 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
 

15-visualization.pptx

  • 2. BARE BONES VISUALIZATION IN PYTHON WITH MATPLOTLIB
  • 3. matplotlib • A major design limitation is that it stives to emulate MATLAB – More on this in the next lecture • One important function for HW6: plot(xvalues, yvalues)
  • 4. Plot import matplotlib.pyplot as plt xs = [1,2,3,4,5] ys = [x**2 for x in xs] plt.plot(xs, ys) no return value? • We are operating on a “hidden” variable representing the figure. • This is a terrible, terrible trick. • Its only purpose is to pander to MATLAB users. • I’ll show you how this works in the next lecture
  • 5. import matplotlib.pyplot as plt xs = range(-100,100,10) x2 = [x**2 for x in xs] negx2 = [-x**2 for x in xs] plt.plot(xs, x2) plt.plot(xs, negx2) plt.xlabel("x”) plt.ylabel("y”) plt.ylim(-2000, 2000) plt.axhline(0) # horiz line plt.axvline(0) # vert line plt.savefig(“quad.png”) plt.show() Incrementally modify the figure. Show it on the screen Save your figure to a file
  • 6. We can group these options into functions as usual, but remember that they are operating on a global, hidden variable
  • 7. WHY VISUALIZE DATA? Review Bill Howe, eScience Institute
  • 8. John Snow Location of deaths in the 1854 London Cholera Epidemic. X marks the locations of the water pumps Dr. John Snow
  • 9. Anscombe’s Quartet x y x y x y x y 10 8.04 10 9.14 10 7.46 8 6.58 8 6.95 8 8.14 8 6.77 8 5.76 13 7.58 13 8.74 13 12.74 8 7.71 9 8.81 9 8.77 9 7.11 8 8.84 11 8.33 11 9.26 11 7.81 8 8.47 14 9.96 14 8.1 14 8.84 8 7.04 6 7.24 6 6.13 6 6.08 8 5.25 4 4.26 4 3.1 4 5.39 19 12.5 12 10.84 12 9.13 12 8.15 8 5.56 7 4.82 7 7.26 7 6.42 8 7.91 5 5.68 5 4.74 5 5.73 8 6.89 I II III IV
  • 10. Anscombe’s Quartet (2) • mean of the x values = 9.0 • mean of the y values = 7.5 • equation of the least-squared regression line: y = 3 + 0.5x • sums of squared errors (about the mean) = 110.0 • regression sums of squared errors (variance accounted for by x) = 27.5 • residual sums of squared errors (about the regression line) = 13.75 • correlation coefficient = 0.82 • coefficient of determination = 0.67
  • 13. Other reasons? • Visualization is the highest bandwidth channel into the human brain [Palmer 99] • The visual cortex is the largest system in the human brain; it’s wasteful not to make use of it. • As data volumes grow, visualization becomes a necessity rather than a luxury. – “A picture is worth a thousand words”
  • 14. Time Amount of data in the world Time Processing power What is the rate-limiting step in data understanding? Processing power: Moore’s Law Amount of data in the world slide src: Cecilia Aragon, UW HCDE
  • 15. Processing power Time What is the rate-limiting step in data understanding? Processing power: Moore’s Law Human cognitive capacity Idea adapted from “Less is More” by Bill Buxton (2001) Amount of data in the world slide src: Cecilia Aragon, UW HCDE
  • 16. What makes a good visualization? Edward Tufte: Minimize the Lie Factor Lie Factor = Size of effect in the visualization Size of effect in the data
  • 18. What makes a good visualization? • Edward Tufte: Maximize the data-ink ratio
  • 19. Example: High or Low Data Ink ratio?
  • 20. Example: High or Low Data Ink ratio?
  • 21.
  • 22. Bateman et al: The Effects of Visual Embellishment on Comprehension and Memorability of Charts • There was no significant difference between plain and image charts for interactive interpretation accuracy (i.e., when the charts were visible). • There was also no significant difference in recall accuracy after a five-minute gap. • After a long-term gap (2-3 weeks), recall of both the chart topic and the details (categories and trend) was significantly better for Holmes charts. • Participants saw value messages in the Holmes charts significantly more often than in the plain charts. • Participants found the Holmes charts more attractive, most enjoyed them, and found that they were easiest and fastest to remember.
  • 23. What makes a good visualization? • Edward Tufte: Small multiples
  • 24. What makes a good visualization? • Jock Mackinlay: Use the appropriate visual element for the relationship and data being analyzed Conjectured rank effectiveness of each visualization method by data type
  • 25. What makes a good visualization? Tufte again: Small multiples
  • 26. Lloyd Treinish, IBM Research, http://www.research.ibm.com/people/l/lloydt/ What makes a good visualization? Lloyd Treinish: Color Matters
  • 27. Color Matters (2) Lloyd Treinish, IBM Research, http://www.research. ibm.com/people/l/llo ydt/
  • 28. A Nice Example Bergstrom, Rosvall, 2011