mirror of
				https://github.com/aykhans/AzSuicideDataVisualization.git
				synced 2025-10-30 09:49:57 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			561 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			561 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| """
 | |
| Wilkinson Dot Plot
 | |
| ------------------
 | |
| An example of a `Wilkinson Dot Plot <https://en.wikipedia.org/wiki/Dot_plot_(statistics)>`_
 | |
| """
 | |
| # category: other charts
 | |
| 
 | |
| import altair as alt
 | |
| import pandas as pd
 | |
| 
 | |
| source = pd.DataFrame(
 | |
|     {"data":[1,1,1,1,1,1,1,1,1,1,
 | |
|              2,2,2,
 | |
|              3,3,
 | |
|              4,4,4,4,4,4]
 | |
|     }
 | |
| )
 | |
| 
 | |
| alt.Chart(source).mark_circle(opacity=1).transform_window(
 | |
|     id='rank()', 
 | |
|     groupby=['data']
 | |
| ).encode(
 | |
|     alt.X('data:O'), 
 | |
|     alt.Y('id:O', 
 | |
|           axis=None, 
 | |
|           sort='descending')
 | |
| ).properties(height=100)
 | 
