From: Ethan A M. <me...@uw...> - 2020-08-16 06:24:12
|
On Saturday, 15 August 2020 22:06:34 PDT Dima Kogan wrote: > Ethan A Merritt <me...@uw...> writes: > > > > I don't get it. What is it about the shell interface that would prevent you > > from doing exactly what is in violinplot.dem? > > set table $datablock > > plot ... > > unset table > > plot $datablock ... > > Both gnuplotlib and feedgnuplot work as very thin wrappers around > gnuplot, where they pass strings directly to gnuplot without knowing > what the strings mean. This allows those interfaces to support lots and > lots of styles, while containing no code that makes those styles work: > all the logic is inside gnuplot itself. The double-plotting in > violinplot.dem is qualitatively different than pretty much every other > gnuplot style, so I would need to add special-case support for it. I > COULD do that, but I really don't want to: the really simple API of > feedgnuplot and gnuplotlib is a feature, and this special-case path > would dilute that feature. > > In a perfect world we'd be able to make violin plots like all others: > with some "set" commands (that don't have the data in it) and a single > plot/splot command that is given data. That is sounding like a big > project inside gnuplot, though. I guess I still don't get it. Since the wrapper can pass in any necessary set of commands, why not just pass in the commands that do the double plot? Would it help to have a library of helper scripts for gnuplot? Here's one that creates a vertical violin plot from a single gnuplot command. You could obviously add a lot of customization either by passing in additional parameters or defining them globally. gnuplot> set term pngcairo gnuplot> set output 'violin.png' gnuplot> # unit width violin plot centered at x=10., linetype 3 gnuplot> call 'violin.gp' 'filename.dat' 10. 3 violin.gp script follows %%%%%%%%%%%%%%%%%%%%%%%% # # invoke this script from inside gnuplot using # call violin.gp filename xcenter linetype # filename = ARGV[1] xcenter = ARGV[2] LT = ARGV[3] # set xrange [*:*] set table $kdensity plot filename using 2:(1) smooth kdensity with filledcurves above x1 unset table stats $kdensity using 2 noout plot [0:20][0:*]\ $kdensity using (xcenter + column(2)/STATS_max):1 with filledcurves x=xcenter lt LT, \ $kdensity using (xcenter - column(2)/STATS_max):1 with filledcurves x=xcenter lt LT # %%%%%%%%%%%%%%%%%%%%%%%%% |