Code to Draw

“Wow! I can do this?” this was my reaction when I was introduced to DOT.

Now the question arises what is DOT ?  Well lets see what Wikipedia says about DOT.

DOT is a plain text graph description language. It is a simple way of describing graphs that both humans and computer programs can use. DOT graphs are typically files that end with the .gv (or .dot) extension. The .gv extension is preferred in cases where there could be confusion with the .dot file extension used by early (pre-2007) versions of Microsoft Word.[1]

Having said that this is a really nifty and an amazing peace of code written to help people like me who can’t draw. I had to draw diagrams for few of the projects I have been involved in and I was looking for a way that I can achieve this without much effort.

DOT came to my rescue , it solved my problem to an extent I will try to give you example of how simple DOT code and expected output

<pre>digraph graphname {
a -> b -> c;
b -> d;
}</pre>

This is how the code looks like in DOT , but the output might astonish you .

dot2

 

This is the magic of DOT. Very less effort required yet you will get all the benefit of making a diagram. This for me is a boon.

The next thing which comes to rescue is ascii art, well lets agree to this that ASCII art is beautiful, you can draw ascii art either on http://asciiflow.com/ or for Vimmers there is a plugin DrawIt . These can be used to draw something which looks like ASCII drawing.

Selection_008

This is how ASCII art with vim looks like , now not only that , this ascii art can be converted into a png file which looks like rather is a image , for that for that we use something called Ditaa, a java library to convert ascii art into png image file. So after  using Ditaa, the art looks like this.

hello

I found it pretty cool, this is how you make txt to png, these tools really come handy when you are preparing some presentation or trying to visualize something or trying to explain something.

Do experiment with it and let me know your experience.

Keep coding!! 🙂

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s