@@ -4,7 +4,7 @@ A command-line tool and Python library that draws basic graphs in the terminal.
44
55Graph types supported:
66- Bar Graphs
7- - Color charts
7+ - Color charts
88- Multi-variable
99- Stacked charts
1010- Histograms
@@ -17,7 +17,7 @@ Graph types supported:
1717### Command Line Usage
1818
1919```
20- termgraph data/ex1.dat
20+ $ termgraph data/ex1.dat
2121
2222# Reading data from data/ex1.dat
2323
@@ -38,7 +38,7 @@ from termgraph import Data, Args, BarChart
3838# Create data
3939data = Data([[10 ], [25 ], [50 ], [40 ]], [" Q1" , " Q2" , " Q3" , " Q4" ])
4040
41- # Configure chart options
41+ # Configure chart options
4242args = Args(
4343 title = " Quarterly Sales" ,
4444 width = 50 ,
@@ -56,26 +56,11 @@ Output:
5656# Quarterly Sales
5757
5858Q1: ▇▇▇▇▇▇▇▇▇▇ 10K
59- Q2: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25K
59+ Q2: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25K
6060Q3: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 50K
6161Q4: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 40K
6262```
6363
64- For stacked charts with categories:
65-
66- ``` python
67- from termgraph import Data, Args, StackedChart
68-
69- # Multi-category data: [Desktop, Mobile] for each quarter
70- data = Data([[20 , 15 ], [25 , 30 ], [35 , 40 ], [30 , 35 ]],
71- [" Q1" , " Q2" , " Q3" , " Q4" ],
72- categories = [" Desktop" , " Mobile" ])
73-
74- args = Args(title = " Sales by Platform" , width = 50 , suffix = " K" )
75- chart = StackedChart(data, args)
76- chart.draw()
77- ```
78-
7964## More Examples
8065
8166### Custom Tick Marks
@@ -97,44 +82,33 @@ termgraph data/ex1.dat --custom-tick "🏃" --width 20 --title "Running Data"
9782
9883```
9984
100-
101- An example using stdin and emoji:
102-
103- ```
104- echo "Label,3,9,1" | termgraph --custom-tick "😀" --no-label
105-
106-
107- 😀😀😀 3.00
108- 😀😀😀😀😀😀😀😀😀 9.00
109- 😀 1.00
110-
111- ```
112-
11385### Color Charts
11486
115- Most results can be copied and pasted wherever you like, since they use standard block characters. However the color charts will not show, since they use terminal escape codes for color. A couple images to show color examples:
87+ Note: Color charts use ANSI escape codes, so may not be able to copy/paste from terminal into other uses.
11688
89+ ``` bash
90+ $ termgraph data/ex4.dat --color {cyan/yellow} --space-between
11791```
118- termgraph data/ex4.dat --color {blue,red}
119- ```
12092
121- <img src =" https://user-images.githubusercontent.com/45363/43405623-1a2cc4d4-93cf-11e8-8c96-b7134d8986a2.png " width =" 655 " alt =" Multi variable bar chart with colors " />
93+ ![ Bar chart with multiple variables] ( /docs/assets/barchart-multivar.svg )
94+
95+ ---
12296
12397```
124- termgraph data/ex7.dat --color {yellow ,magenta} --stacked --title "Stacked Data"
98+ termgraph data/ex7.dat --color {green ,magenta} --stacked
12599```
126100
127- < img src = " https://user-images.githubusercontent.com/45363/43405624-1a4a821c-93cf-11e8-84f3-f45c65b7ca98.png " width = " 686 " alt = " Multi variable stacked bar chart with colors " />
101+ ![ Stacked Bar Chart ] ( /docs/assets/barchart- stacked.svg )
128102
129103### Calendar Heatmap
130104
131105Calendar Heatmap, expects first column to be date in yyyy-mm-dd
132106
133107```
134- termgraph --calendar --start-dt 2017-07-01 data/cal.dat
108+ $ termgraph --calendar --start-dt 2017-07-01 data/cal.dat
135109```
136110
137- < img src = " https://user-images.githubusercontent.com/45363/43405619-1a15998a-93cf-11e8-8a3f-abfd2f6104a5.png " width = " 596 " alt = " Calendar Heatmap " />
111+ ![ Calendar Heatmap ] ( /docs/assets/cal-heatmap.svg )
138112
139113
140114
@@ -192,17 +166,17 @@ All chart types are available as classes:
192166
193167``` python
194168from termgraph import (
195- Data, Args,
169+ Data, Args,
196170 BarChart, StackedChart, VerticalChart, HistogramChart
197171)
198172
199173# Basic setup
200- data = Data([[10 ], [20 ]], [" A" , " B" ])
174+ data = Data([[10 ], [20 ]], [" A" , " B" ])
201175args = Args(title = " My Chart" )
202176
203177# Choose your chart type
204178chart = BarChart(data, args) # Horizontal bars
205- # chart = StackedChart(data, args) # Stacked bars
179+ # chart = StackedChart(data, args) # Stacked bars
206180# chart = VerticalChart(data, args) # Vertical bars
207181# chart = HistogramChart(data, args) # Histogram
208182
@@ -211,7 +185,7 @@ chart.draw()
211185
212186Available Args options:
213187- ` title ` : Chart title
214- - ` width ` : Width in characters (default: 50)
188+ - ` width ` : Width in characters (default: 50)
215189- ` format ` : Number format string (default: "{:<5.2f}")
216190- ` suffix ` : Add suffix to all values
217191- ` no_labels ` : Don't show labels
@@ -230,7 +204,7 @@ All contributions are welcome! For detailed information about the project struct
230204
231205** Quick Start:**
232206- 🐛 ** Bug reports** and 🚀 ** feature requests** : Use [ GitHub Issues] ( https://github.com/mkaz/termgraph/issues )
233- - 🔧 ** Code contributions** : See our [ development workflow] ( CONTRIBUTING.md#development-workflow )
207+ - 🔧 ** Code contributions** : See our [ development workflow] ( CONTRIBUTING.md#development-workflow )
234208- 📚 ** Documentation** : Help improve our guides and examples
235209
236210** Code Quality:** We use ` ruff ` for linting and formatting, ` mypy ` for type checking, and maintain comprehensive test coverage.
0 commit comments