Skip to content

Commit 73bef80

Browse files
committed
Add SVGs to README
1 parent da550a2 commit 73bef80

File tree

6 files changed

+214
-59
lines changed

6 files changed

+214
-59
lines changed

.gitignore

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
.DS_Store
44

55
# Python
6-
*.pyc
7-
venv/
86
.coverage
7+
dist/
98
htmlcov/
10-
uv.lock
11-
termgraph.egg-info/
9+
*.pyc
1210
.python-version
1311
.ropeproject/
12+
termgraph.egg-info/
13+
uv.lock
14+
venv/
1415

1516
# Editors
17+
.claude/
18+
CLAUDE.md
19+
.gemini/
1620
.vim/
1721
.vimrc
1822
.vscode/
19-
.claude/
20-
.gemini/
21-
CLAUDE.md
2223

README.md

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A command-line tool and Python library that draws basic graphs in the terminal.
44

55
Graph 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
3939
data = Data([[10], [25], [50], [40]], ["Q1", "Q2", "Q3", "Q4"])
4040

41-
# Configure chart options
41+
# Configure chart options
4242
args = Args(
4343
title="Quarterly Sales",
4444
width=50,
@@ -56,26 +56,11 @@ Output:
5656
# Quarterly Sales
5757
5858
Q1: ▇▇▇▇▇▇▇▇▇▇ 10K
59-
Q2: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25K
59+
Q2: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25K
6060
Q3: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 50K
6161
Q4: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 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

131105
Calendar 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
194168
from 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"])
201175
args = Args(title="My Chart")
202176

203177
# Choose your chart type
204178
chart = 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

212186
Available 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.

data/ex4.dat

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Example Data Set 4 with 2 Categories
22
@ Boys,Girls
3-
2007,183.32,190.52
4-
2008,231.23,5.0
5-
2009,16.43,53.1
6-
2010,50.21,7
7-
2011,508.97,10.45
8-
2012,212.05,20.2
9-
2014,30.0,20.0
3+
Math,78,82
4+
Reading,84,79
5+
Science,81,77
6+
Art,89,65
7+
PE,83,96
8+
Music,71,88

docs/assets/barchart-multivar.svg

Lines changed: 59 additions & 0 deletions
Loading

docs/assets/barchart-stacked.svg

Lines changed: 49 additions & 0 deletions
Loading

docs/assets/cal-heatmap.svg

Lines changed: 73 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)