Это видео недоступно.
Сожалеем об этом.
Creating Graphs in Troff/Groff with Grap
HTML-код
- Опубликовано: 30 окт 2020
- This is the 11th video in a series of videos taking you from a beginner to a pro at using Troff/Groff.
This tutorial is focused on Grap a preprocessor for drawing graphs
The example file shown in this video: gist.github.com/Gavinok/e06d1...
Ted Faber's grap:
www.lunabase.org/~faber/Vault...
plan9port/PLAN 9 from USER SPACE:
9fans.github.io/plan9port/
Grap User Manual:
doc.cat-v.org/unix/v8/grap.pdf
Let me know what you think and if there is anything specific you would like to learn about.
Github: www.github.com/gavinok
vimrc: github.com/Gavinok/dotvim
Resume: github.com/Gavinok/Groff-resume
Discord: / discord
Brian kernighan is my favorite old school computer scientist
It's simply amazing how much customizability you have with these graphs, and yet you're still just using Troff/Groff.
Grap is amazing and there is still more I wanted to cover. You can even use pic commands within grap for more customizability. If you are using the Ted Faber version you can also add colors.
@@GavinFreeborn I found that using grap I cannot use dotted lines, just solid or dashed... Any idea why??
Man ! I’ve been needing something like this.
You just safe me from fail my subject, love u a lot
Happy to help haha
Man this is great, great tool and great video.
a nice and underrated intro to grap
My new favorite youtube channel.
Good info!
Great video :) Thanks!!
Awesome
Very good video, I'm about ready to ditch markdown.
I would be interested in checking out those
.so /home/gavinok/*.tmac files
At the moment, I don't think they are in any dot-file repositories.
I have not gotten a chance to clean it up so its a bit of a mess. Here is the current version of it .
gist.github.com/Gavinok/0d0f05c6223f1538aec7439f047234dd
@@GavinFreeborn Thanks!
It took me 15 minutes to find a missing "$" sign from markdown debug. Stay away from this kid unless you need to write very advanced math
@@lucapham-trong7718 like you where missing a $ for using eqn?
Also, is there a way to specify lengths and widths using a relative unit like text width, in latex you can use something like 0.5\textwidth for example if you want something to be half the text width. In Geoff I'm not really sure what units it used by default.
Since groff allows for scaling of pic/grap pictures there isn't really a default unit as far as I know. when setting things like indent you can use `u` for a device unit and `i` for an inch `c` for centemeters. I hope that helps. here is an example of what I mean.
```
.in 1i
this is at a 1 inch indent
```
feel free to join the discord and ask more questions there.
When i want to draw a line plot. I would like to know if it is possible to set the horizontal coordinates of the scientific notation. Is it possible to do this in grap when the data distribution is relatively large?
Sadly I don't know of a built in way to use scientific notation sorry.
Awesome! I've started taking notes in my statistics class with groff and at the first lesson i encountered a problem, how can i make pie charts in grap? I looked up a couple documentation pdf's but i couldn't find any way to do that.
Off the top of my head you would want to either use copy thru or define a macro in grap using pic inside of it. this would probably require you to do some trigonometry. Here is another option that you could use if you want to use groff's postscript driver. Feel free to join the discord I could probably help more there.
```
.sp 3c
.de YY
ps: def
/wedg
{ gsave currentpoint translate 1 -1 scale
newpath 0 0 moveto 0 0 5 2 roll 3.6 mul exch
3.6 mul dup 3 1 roll add arc closepath
gsave fill grestore 0 setgray stroke
grestore }
def
..
.ds wedg \m[\\$2]\Z'\N'32''\
\X'ps: exec \
[pieradius] \
[pieangle] \\$1 wedg'\
\R'pieangle +\\$1'\m[]
\Y[YY]\c
.eo
.de pie
This is a line with \D'l 5p 0'\h'
[pieradius]p'\h'1p'\
\*[wedg 10 red]\
\*[wedg 20 green]\
\*[wedg 30 blue]\
\*[wedg 2 purple]\
\*[wedg 38 yellow]\
\h'1p'\h'
[pieradius]p'\D'l 5p 0' in the middle of it.
..
.ec
.nr pieangle 0
.nr pieradius 35
.pie
.nr pieradius 10
.nr pieangle 20 \" 20% is 72 degrees
.pie
```
on the topic of stats notes this may interest you github.com/Gavinok/stat260
@@GavinFreeborn Thanks a lot!
I took a look at your macro and i couldn't understand much, so I studied GRAP a bit and found a way to do it without PIC commands
@@lucabaldassi6024 that's great to hear! Any chance I could see an example? Just interested
@@GavinFreeborn
.G1
ticks off
frame invis ht 2.5 wid 2.5
coord x -1.25,1.25 y -1.25,1.25
define slice X # (relative frequency, cumulative frequency, label)
fr = $1
fc = $2
# Draw labels outside the circle in the middle of the slice
class = fc - fr / 2
classangle = class * 2 * pi
classx = cos( classangle ) * 1.1
classy = sin( classangle ) * 1.1
if class
@@lucabaldassi6024 wow great job!
What about other kinds of graphics like gantt plots (which I've done using tbl before), heatmaps, or dendrograms?
I don't see any reason you wouldn't be able to make those types of graphs. Really grap is an additional front end for pic and pic is just a front end to Troff/Groff. Those would definitely take some work but it can be done. I have a video in pic that should help get you started. I'd use the Ted Faber version since it supports Groff's colors. Which all of these graphs appear to require.
Hey there! Do you have a tutorial on how to embed images ?
edit: never mind, I just checked your g/t roff playlist and there's a vid 'bout it. thanks
for Groff? Why yes I do ruclips.net/video/m1WC0Ww_S2E/видео.html
Is there a way to preprocess with gnuplot?
I believe there is a program called plot2dev can be used to create pic from gnuplot but I have never tried it.
What about 3d graphics?
1:05 that's the wrong jon bentley. I only know cos I'm from England, and the jon bentley you found a picture of is an English tv presenter.
Haha ya I messed up big time on that one 🤣
lol wrong jon bentley. that guy presented fith gear in the uk
Haha that makes alot of sense. Think I mixed around my Wikipedia links when I was making this. I had a feeling it may be wrong... 😅
Graphs ≠ plots