On 17/06/2024 01:29, climn...@providence.edu wrote:
Thanks, Sven. I will try the code you've provided in the console.

Upon further digging, I found the following on stackoverflow re gnuplot:
https://stackoverflow.com/questions/50338019/gnuplot-histogram-chart-with-overlap

Can the code on that stackoverflow page somehow be mapped into something the 
gnuplot under the hood of gretl will understand?

Is this close to what you need?

<hansl>
function void multi_hist(list L)

    n = nelem(L)
    vn = varnames(L)
    mh = ""
    outfile --buffer=mh
        printf "set style fill solid 0.5\n"
        printf "set style data histogram \n"
        printf "set style histogram clustered\n"

        strings names = array(n)

        loop foreach i L
            names[i] = "hist" ~ "$i"
            freq $i --quiet --silent
            f = $result
            cnameset(f, "")
            printf "$%s << EOD\n", names[i]
            printf "%12.4f", f
            printf "EOD\n\n"
        endloop

        printf "plot "
        loop i = 1 .. n
            printf "$%s using 2 t \"%s\"", names[i], vn[i]
            if i == n
                printf "\n"
            else
                printf ", "
            endif
        endloop
    end outfile

    gnuplot --inbuf=mh --output=display
end function

### example

open mroz87.gdt
list L = HE WE
multi_hist(L)
</hansl>


-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucche...@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/

Reply via email to