Paul Smith wrote: > Dear All > > I would like to be able to produce the graph of certain functions > (say, f(x)=ln(x)) and manipulate it with xfig to get a vectorial > picture to insert, afterwards, in a LyX document. I could use Maple > to produce those graphs, but Maple pictures are bitmaps... and not > vectorial pictures. Any ideas?
Use gnuplot, together with the attached script gnuplot2fig.sh I attach a sample so that you can see what it does. gnuplot commands are stored in with90.gnu and common.gnu. Raw data it stored in the .gnudat files. $ ./gnuplot2fig.sh with90.gnu with90.fig will generate an xfig file that displays the raw data in with90.gnudat as a histogram and which also uses gnuplot non-linear fitting functionality to fit Gaussian curves to the data in with90.gnudata and mercer_crapo.gnudat. Everything is vector graphics. Gnuplot is a bloody excellent tool! -- Angus
clear reset set xtics nomirror set ytics nomirror set xlabel 'Generation number' set ylabel 'Number of paths (\%)' set xrange [0:25] set yrange [0:] set key spacing 2 set style line 1 linetype 1 linewidth 1 pointtype 1 set style line 2 linetype 1 linewidth 2 pointtype 1 set style line 3 linetype 2 linewidth 1 pointtype 1 set style line 4 linetype 15 linewidth 2 pointtype 1 a_mc=100; sigma_mc=3.0; mu_mc=6.0 p_mc(x) = (a_mc/(sigma_mc * sqrt(2.0 * pi))) * exp(-0.5 * ((x-mu_mc)/sigma_mc)**2) fit p_mc(x) "mercer_crapo.gnudat" \ using 1:($2/1.338):($3/1.338) via a_mc,sigma_mc,mu_mc a=100.; sigma=2.; mu=7.0 p(x) = (a/(sigma * sqrt(2.0 * pi))) * exp(-0.5 * ((x-mu)/sigma)**2)
gnuplot2fig.sh
Description: application/shellscript
# Generation ID Number of Ducts Standard deviation # ============= =============== ================== 1 1.0 0.1 2 3.0 0.4 3 6.0 0.9 4 8.0 2.0 5 13.3 3.0 6 18.0 3.0 7 21.0 6.0 8 17.0 6.0 9 14.0 2.0 10 13.0 0.7 11 13.0 2.0 12 4.0 1.0 13 2.5 0.3
load 'common.gnu' fit p(x) 'with90.gnudat' using 1:2:3 via a, sigma, mu plot \ 'with90.gnudat'\ using 1:2 notitle with boxes ls 1, \ 'with90.gnudat'\ using 1:2:2:($2+$3) notitle with errorbars ls 1, \ p(x) title 'Fit to numerical data' ls 2, \ p_mc(x) title 'Fit to Mercer \& Crapo data' ls 4 # 'mercer_crapo.gnudat'\ # using 1:($2/1.338):($3/1.338) with errorlines ls 3,\
2 0.039683 0.177466 3 2.460317 1.119434 4 9.484127 3.019114 5 15.158730 2.795919 6 17.777778 5.048465 7 17.301587 5.261964 8 15.515873 3.525651 9 11.111111 4.377403 10 7.063492 3.631492 11 2.777778 1.793240 12 1.071429 1.732594 13 0.238095 0.581504