@@ -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,28 +82,12 @@ 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
117- ```
118- termgraph data/ex4.dat --color {blue,red}
119- ```
89+ ![ Bar chart with multiple variables] ( /docs/assets/barchart-multivar.svg )
12090
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 " />
12291
12392```
12493termgraph data/ex7.dat --color {yellow,magenta} --stacked --title "Stacked Data"
@@ -192,17 +161,17 @@ All chart types are available as classes:
192161
193162``` python
194163from termgraph import (
195- Data, Args,
164+ Data, Args,
196165 BarChart, StackedChart, VerticalChart, HistogramChart
197166)
198167
199168# Basic setup
200- data = Data([[10 ], [20 ]], [" A" , " B" ])
169+ data = Data([[10 ], [20 ]], [" A" , " B" ])
201170args = Args(title = " My Chart" )
202171
203172# Choose your chart type
204173chart = BarChart(data, args) # Horizontal bars
205- # chart = StackedChart(data, args) # Stacked bars
174+ # chart = StackedChart(data, args) # Stacked bars
206175# chart = VerticalChart(data, args) # Vertical bars
207176# chart = HistogramChart(data, args) # Histogram
208177
@@ -211,7 +180,7 @@ chart.draw()
211180
212181Available Args options:
213182- ` title ` : Chart title
214- - ` width ` : Width in characters (default: 50)
183+ - ` width ` : Width in characters (default: 50)
215184- ` format ` : Number format string (default: "{:<5.2f}")
216185- ` suffix ` : Add suffix to all values
217186- ` no_labels ` : Don't show labels
@@ -230,7 +199,7 @@ All contributions are welcome! For detailed information about the project struct
230199
231200** Quick Start:**
232201- 🐛 ** 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 )
202+ - 🔧 ** Code contributions** : See our [ development workflow] ( CONTRIBUTING.md#development-workflow )
234203- 📚 ** Documentation** : Help improve our guides and examples
235204
236205** Code Quality:** We use ` ruff ` for linting and formatting, ` mypy ` for type checking, and maintain comprehensive test coverage.
0 commit comments