On 2020-02-07 13:14+0100 Xavier Cardil wrote:

I was wondering how could I remove the white space between plots when using
a grid-like subplot configuration. When I stack plots vertically, there is
a small margin that is negligible for our use, but not when on a grid
scenario ( see picture )

[image: plplot.png]

If you guys could give me a fast tip on how to control the margins between
plots, or just to remove them completely I'd appreciate it

Hi Xavier:

It is interesting you brought up this topic since I have recently
encountered it myself.  Some of my older research plots used the
"yplot" wrapper for PLplot which dealt with this issue by defining the
"plstick" functionality, but yplot is moribund so when recently
attempting to replicate those old research plots I copied the
essentials of plstick to Python so I could use plstick from that
language.  I attach a figure showing the type of results you can get
with this Python version of plstick, and if you like those I suggest
you port the Python version of plstick (which I have also attached) to
whatever language you like to use to generate your plots.

Alan
__________________________
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.org); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

Attachment: coulomb_adjust.pdf
Description: example of plstick result

import numpy
import plplot

# Mimic useful yplot function of the same name.
def plstick(xnum, ynum, currentx, currenty, top, right, bot, left):
    # Sets up a viewport such that xnum X ynum of them fit onto a
    # page.  Make the active viewport the one at column currentx and row
    # currenty, starting at the top left. The "space" parameters (top,
    # right, bot, and left) specify how much space is to be left open at
    # the relevant side for annotations etc.
    
    # N.B. the yplot developer who implemented this extra PLplot
    # functionality used the xspace, yspace, and tsize arrays and four
    # other arbitray factors (below) to interpret top, right, bot, and
    # left as well as symbol and character size.  So we follow his
    # decisions in that regard but have no idea how he derived these
    # numbers.
    
    xspace = (0.38,0.35,0.33,0.28,0.25,0.22,0.2)
    yspace = (0.48,0.45,0.42,0.35,0.3,0.28,0.25)
    tsize = (0.82,0.75,0.7,0.6,0.5,0.45,0.4)
    
    sx = 1./xnum
    sy = 1./ynum
    
    xminp = (currentx-1)*sx
    xmaxp = (currentx)*sx
    yminp = 1-(currenty)*sy
    ymaxp = 1-(currenty-1)*sy  
    x1s = 0.28*xspace[xnum-1]*left
    x2s = 0.07*xspace[xnum-1]*right
    y1s = 0.15*yspace[ynum-1]*bot
    y2s = 0.05*yspace[ynum-1]*top
    plplot.plvpor(xminp+x1s,xmaxp-x2s,yminp+y1s,ymaxp-y2s)
    if (ynum>xnum):
        maxwind = ynum
    else:
        maxwind = xnum
    cscale = 4.0*tsize[maxwind-1]
    plplot.plschr(cscale,1)
    plplot.plssym(cscale,1)
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to