Skip to content

Commit 2e6a23d

Browse files
committed
Add SVGs to README
1 parent da550a2 commit 2e6a23d

File tree

4 files changed

+84
-56
lines changed

4 files changed

+84
-56
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: 11 additions & 42 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,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
```
12493
termgraph data/ex7.dat --color {yellow,magenta} --stacked --title "Stacked Data"
@@ -192,17 +161,17 @@ All chart types are available as classes:
192161

193162
```python
194163
from 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"])
201170
args = Args(title="My Chart")
202171

203172
# Choose your chart type
204173
chart = 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

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

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

0 commit comments

Comments
 (0)