Drawing vector graphics using a command line
John D Lamb
J.D.Lamb at johndlamb.net
Sun Sep 20 19:52:17 UTC 2015
On 20/09/15 13:44, Johnny Rosenberg wrote:
> Anyone know of a tool to create SVG files (or similar) using some kind
> of macro or command line?
Two suggestions.
First, if you can tolerate encapsulated postscript, you can use LaTeX.
The following is an example I used recently:
\documentclass{article}
\usepackage{mathptmx}
%% Pictures
\usepackage{pst-pdf,pst-node}
\begin{document}
\begin{pspicture}[showgrid=false](0,0)(2,2)
\psset{arrows=->}
\rput(0.529,0.353){\dotnode{V1}}
\rput(1.470,0.353){\dotnode{V2}}
\rput(1.712,1.247){\dotnode{V3}}
\rput(1.000,1.800){\dotnode{V4}}
\rput(0.239,1.247){\dotnode{V5}}
\ncline[linestyle=dashed]{V1}{V2}
\ncline{V3}{V2}
\ncline{V4}{V3}
\ncline{V5}{V4}
\ncline{V1}{V5}
\end{pspicture}
\end{document}
This draws a pentagon with dashed and solid lines and nodes at the
vertices. To convert to pdf use estopdf.
I used to write raw PostScript. But I rarely do this now that the LaTeX
PSTricks packages do what I want for simple graphics and R can handle
the really complex stuff.
Second, IIRC SVG is a language you can just write. Have a look at some
of these examples: http://www.w3schools.com/svg/svg_examples.asp. I have
written some SVGs several years back, but usually I need pdf or eps
format nowadays.
--
John D Lamb
More information about the ubuntu-users
mailing list