Templates for

A few templates and scripts to make schematics, plots, and diagrams kinda matching the theme

Similar projects worth following
I'm starting to develop simple templates for documenting projects that I can use over and over again. These include parts libraries for drawing schematics in xfig, scripts for creating plots with gnuplot, and a simple utility to render PDF diagrams (from whatever source) as reverse-video PNG files that fit right into the theme. I've decided to drop them here in case anyone else finds them useful. It's coming from a linux environment, but with some effort should be usable elsewhere. It's all released under a modifed MIT License (see file), that doesn't require you to distribute the license if you use any of this stuff.

I'll add a project log for each template or script with an example image right at the top and links to the appropriate template/example files to download. Browse the logs to find what's available.

For some reason, I usually don't update logs on other projects unless I find errors, but I'll edit these freely as the templates evolve.


Xfig file with schematic component symbols

application/x-xfig - 11.32 kB - 08/06/2016 at 02:03



Example gnuplot script with color theme

x-compressed-tar - 1.18 kB - 08/06/2016 at 01:38


BASH script to generate inverse-video PNG images from PDF, FIG, or normal PNG files

x-shellscript - 2.00 kB - 08/06/2016 at 01:00



Modified MIT license for all files uploaded here

license - 932.00 bytes - 08/06/2016 at 00:54


  • Message Sequence Charts

    Ted Yapo08/20/2016 at 13:48 0 comments

    I worked for a couple of networking companies back in the day, and used to see these things all the time - it's a great way to display any kind of message protocols, and there's a nice tool to do it (I used to do them by hand). The mscgen program accepts a simple text description and generates diagrams in PNG, SVG, EPS (or image maps). The output, of course, can be run through my inverse video script to render it in the theme. I used the PNG output option then converted the colors for the diagram above.

    Here's the description file for this example diagram:

    msc {
        arcgradient = "8";
        a [label = "Meter"], b [label = "Adapter"], c [label = "Application"];
        a=>b [label = "value1"];
        a=>b [label = "value2"];
        a=>b [label = "value3"];
        c=>b [label = "read"];
        b->b [label = "flush & wait"];
        a=>b [label = "value4"];
        b>>c [label = "value4"];

    There are all sorts of neat formatting options and colors and stuff you can use, too.

    I was able to just 'sudo apt-get install mscgen' to install the program.

  • Timing Diagrams

    Ted Yapo08/06/2016 at 02:22 3 comments

    I did almost no work for this one, but it's really cool. At, they have a really neat timing diagram editor that takes a JSON description file like this:

    {signal: [
      {name: 'discharge_h', wave: '1...0.1....|...'},
      {name: 'discharge_l', wave: '0...1.0....|...'},
      {name: 'charge_h', wave:    '1.0.......1|..0'},
      {name: 'charge_l', wave:    '0.1.......0|..1'},
      {name: 'State', wave: '|...', data: ['C charge', 'guard', 'L charge', 'L discharge', 'guard', 'C charge']},
    and makes an image like this:

    The simple diagram shown here doesn't show all the really cool stuff you can do with the tool. Have a look at the site (or read the SNUG2016 Paper) for more examples and information.

    You can download the application and install it locally, or use it in your browser. I modifed the script discussed in a previous log to deal with the alpha channel generated by the WaveDrom tool - that's what made the white-on-black image at the top of this log.

    I just saw that WaveDrom had been written up on HaD in 2015:

  • Xfig Schematic Symbols

    Ted Yapo08/06/2016 at 02:07 0 comments

    I've been using xfig (on and off) since the early 1990s. It's an old-school X-windows program for drawing vector graphics. I'm not sure how many people still use it, but I find it easy to generate simple "publication-quality" graphics - the crudeness of my figures reflects the craftsman, not the tool :-)

    Xfig comes with a set of libraries, including electronic symbols, but I don't care for them. You may feel the same about these, but you are welcome to use them if you like. The symbols above can be downloaded here.

    To generate a PNG diagram for inclusion on, I draw the figure, then export as a PDF file. The shell script discussed in the other log can then be run to make a white-on-black PNG file.

    I think I have a few other component symbols floating around that didn't make it into this "library". I'll add them and update the file as they turn up (or as more are generated).

    I'm starting to use the new, simpler MOSFET symbols like those in the 3rd edition of The Art of Electronics.

  • Gnuplot Template

    Ted Yapo08/06/2016 at 01:30 0 comments

    Gnuplot is by far my favorite way to generate plots. Here's a simple template you can modify to make similar figures.

    You can download the script here on . It comes with the sample data file required for the plot above. Invoke the script like this:

    gnuplot plot_example.gpt

    You can find lots of examples and documentation for gnuplot on the web; this example is mainly useful to get the colors right.

  • Inverse Video PNGs from PDF, FIG or normal PNG

    Ted Yapo08/06/2016 at 01:23 0 comments

    A while back I had a website with a blacked-out theme like HaD. You're almost certain you never saw it. Anyway, back then, I wrote a shell script for rendering PDF documents into white-on-black PNG images. When I started using, I only had to change the background color slightly to match the theme here. Since then, I've made a few minor modifications. You can find the script here:

    You invoke the script like this:

    tyapo@silicon templates $
    create a white-on-black PNG image from a pdf, fig, or png files
    make_hadio_figure [-r <dpi>] <input_file>
      -r <dpi> : set the output resolution (dots per inch) for pdf or fig

    The script relies on the netpbm suite of utilities and the pdftopnm program, so you'll need to have those installed. You control the size of the resulting PNG image by specifying the rendering resolution in DPI.

    For figures, block diagrams, and "presentation" schematics like the one above, I generate the PDFs with xfig (hence the fig format option). I'll post my schematic component templates in another log, in case anyone wants to go old-school and use xfig.

View all 5 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates