Search code examples
plotwxmaxima

How to increase font size of numbers for each axis in plo2d wxmaxima?


How do I increase the font size for labels and numbers for y and x axis in plot2d function of wxmaxima?

    Kill(All);
    a:1;
    b:1;
    AA:1;
    BB:1;
    c1:(a/b*exp(AA));
    c2:(2*a/b);
    numerical : rk([v,-a*y],[y,v],[AA,BB],[x,0,4,0.01])$;
    analytical:log(sqrt(c1/c2)*(sech(b*x)));
    log((sqrt(%e)*sech(x))/sqrt(2))
    fpprintprec:8$
    yL : makelist([numerical[i][1],numerical[i][2]],i,1,length(numerical))$
    plot2d([[discrete,yL],analytical],[x,0,4,0.1],
    [style, [lines,6,3], [points,1,1,1]],[y,-10,10],[ylabel,"y"],
    [xlabel,"x"],[legend,"solution1","solution2"],[gnuplot_preamble,"set size ratio   -1"]);$
    ["/tmp/maxout3455.gnuplot_pipes"]

I think the following command will do

set tics font ", 30"

However wherever I place this code, the compiler fails to compile that command.


Solution

  • On looking at it again, I see you have gnuplot_preamble already. That's great. You can make a multi-line preamble by simply creating a string with embedded newlines. I find this works:

    my_preamble: "set size ratio -1
    set tics font \", 30\"";
    
    plot2d (sin(x), [x, 0, 10], [gnuplot_preamble, my_preamble]);
    

    Note that I have escaped the double quotes within the preamble via backslash followed by double quote.

    If some Gnuplot stuff doesn't work as expected, you can more easily debug it by saying [plot_format, gnuplot] (instead of gnuplot_pipes) and then plot2d will return the name of the Gnuplot script which was constructed -- you can inspect the file to see what's going on there.