Skip to content

Commit

Permalink
simpleplot:0.1.0 (#1802)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobs2007 authored Feb 24, 2025
1 parent abacc2d commit 7bcab54
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/preview/simpleplot/0.1.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.png
.pdf
21 changes: 21 additions & 0 deletions packages/preview/simpleplot/0.1.0/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Tobs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions packages/preview/simpleplot/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
a simple package to quickly add simple graphs into your document.

# instructions:
- connect multiple points with a line:
- add((dots)) example: add(((1,5),(4,6)))
- scale the graph:
- xsize: horizontal size
- ysize: vertical size
- position the graph:
- vertikal: top, bottom, horizon
- horizontal: left, right, center
- specify axis style:
- axis-style: [scientific, scientific-auto, school-book]
- full example:
```
#simpleplot(
xsize: 5,
ysize: 5,
alignment: center+horizon,
axis-style: "school-book",
{
add(((0, 0), (4, 6)))
add(((-5, -3), (4, 6),(5,4)))
}
)
```
- will look like this:
<img src="graph_bright.png#gh-light-mode-only">
<img src="graph_dark.png#gh-dark-mode-only">

- to display this text, add the ``help()`` function to your document.
- this is using cetz and cetz-plot. so if you are familiar, you can add more to the body of the function.
Binary file added packages/preview/simpleplot/0.1.0/graph.pdf
Binary file not shown.
Binary file added packages/preview/simpleplot/0.1.0/graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/preview/simpleplot/0.1.0/graph_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions packages/preview/simpleplot/0.1.0/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#import "@preview/cetz:0.3.2": *
#import "@preview/cetz-plot:0.1.1": *
#import draw: *
#import plot: *


#let simpleplot(xsize: 5,
ysize: 5,
alignment: center + horizon,
axis-style: "school-book",
body
) = align(
alignment,
canvas(
plot(axis-style: axis-style,
size: (xsize, ysize),
body
)
)
)



#let help(lan: "en") = if lan == "de" {
"
Mehrere Punkte mit einer Linie verbinden:
add((Punkte)) z.B. add(((1,5),(4,6)))
Position:
vertikal: top, bottom, horizon
horizontal: left, right, center
Grösse ändern:
xsize: horizontale Grösse
ysize: vertikale Grösse
Axen Style spezifizieren:
axis-style: [scientific, scientific-auto, school-book]
Volles Beispiel:
#simpleplot(
xsize: 5,
ysize: 5,
alignment: center+horizon,
axis-style: \"school-book\",
{
add(((0, 0), (4, 6)))
add(((-5, -3), (4, 6),(5,4)))
}
)
Wird so aussehen:"
} else if lan == "en" {
"
connect multiple points with a line:
add((dots)) example: add(((1,5),(4,6)))
position the graph:
vertikal: top, bottom, horizon
horizontal: left, right, center
scale the graph:
xsize: horizontal size
ysize: vertical size
specify axis style:
axis-style: [scientific, scientific-auto, school-book]
full example:
#simpleplot(
xsize: 5,
ysize: 5,
alignment: center+horizon,
axis-style: \"school-book\",
{
add(((0, 0), (4, 6)))
add(((-5, -3), (4, 6),(5,4)))
}
)
will look like this:"
}+simpleplot(
xsize: 5,
ysize: 5,
alignment: top+left,
axis-style: "school-book",
{
add(((0, 0), (4, 6)))
add(((-5, -3), (4, 6),(5,4)))
}
)

7 changes: 7 additions & 0 deletions packages/preview/simpleplot/0.1.0/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "simpleplot"
version = "0.1.0"
entrypoint = "lib.typ"
authors = ["Tobs"]
license = "MIT"
description = "A super simple Package to make graphs as simple as possible"

0 comments on commit 7bcab54

Please sign in to comment.