Showing posts with label Asymptote Vector Graphics Package. Show all posts
Showing posts with label Asymptote Vector Graphics Package. Show all posts

Tuesday, November 20, 2012

Asymptote Graphics Package - A preliminary 2D plot

Alright, so awhile back, I think this past summer, I was experimenting with Asymptote in order to replace Origin.  Origin is great and probably the best, but I only have access to it through Windows, and I am not a fan at all of Windows and even more Microsoft products especially Office such as Word and PP.  So I am trying to find an alternative to Origin to create high quality publication ready graphs.  I've briefly looked at SciDavis (a free Origin type software), but it is missing a lot of options and just doesn't look as good.  There is also matplotlib for Python, but the images just don't look "right" as well (same can be said for Matlab, Mathematica, Maxima, and Sage plots).  I dunno what it is, but for me they just don't cut it, so far.  Now, Asymptote looks GREAT!  However, it is command line based which may scare some people and there isn't much in the way of help and/or examples like say compared to matplotlib or Matlab which can be quite frustrating, especially if something doesn't work right off the bat and you have to debug and figure it out on your own.  I had a bit of this, but once I got done I was ecstatic!

So for a 2D plot here is my example.  I hope this helps at least one person.  I would like to one day generate many examples if possible.  I will post links later as I forgot where I found some help.

This is preliminary and I will be cleaning it up later.  For the code:


import graph;

size(300, 200, IgnoreAspect);

real L = 2;

real a = 1;

real l = L/a;

real z = 0.5;

real z_ovr_l = z/l;

real sigma = 25;

real kappa = 1/(2*pi*l*sigma);

real u_z(real r) {return 2*pi*z*(cos(pi*(r^2)));}

draw(graph(u_z, 0, 1), "$u_z$");

xaxis("$r$", Bottom, LeftTicks);
yaxis("$u_z$", LeftRight, RightTicks(6,2));


Generates
In order to "run" or compile the Asymptote code, I used the built in terminal, Konsole, in Kile.  I usually have the .asy file saved in a folder called something like Asymptote files.  I then open the .asy file in Kile and click the Konsole button at the bottom.  To run the file type in the terminal (make sure you're in the folder where the file is; it should be already there if you opened the file in Kile):

For an .eps file type: asy -V test or just asy test where test is the name of the file and -V brings the image up in a viewer.

For a .pdf file type: asy -V -f pdf test or asy -f pdf test

More later.

Asymptote, a graphics software « Bubbles Bad; Ripples Good

Asymptote, a graphics software « Bubbles Bad; Ripples Good

A nice, short blog post on Asymptote and also a bit on MetaPost, MetaFont, and PGF/TiKZ.

Friday, July 13, 2012

A Simple Asymptote IDE In Linux Using Inotify - YouTube

A Simple Asymptote IDE In Linux Using Inotify - YouTube

I've done something similar except I am using Kile since it has a built in terminal (Konsole) with normal Kile as the text editor.  Kate has the same feature but since I use Kile anyways for LaTeX no point in using Kate.

Friday, June 22, 2012

Asymptote Vector Graphics Package


Asymptote

I've seen this before in my Ubuntu repository when searching for LaTeX packages.  I want to try this one day.  Asymptote is a vector graphics software, except it is all through its own programming language.  At first, it seems  scary, but in reality, it is the same thing as making a plot in Python, MATLAB, Mathematice, Sage, Maxima, etc.  Asymptote seems nice since it seems very streamlined like LaTeX is for documents.
Asymptote is a powerful descriptive vector graphics language that provides a natural coordinate-based framework for technical drawing. Labels and equations are typeset with LaTeX, for high-quality PostScript output.