1

A while back I found a method to join Axes in a nice way. Now that I revisit the plot-making for a report I find that I'm not satisfied...

The reason for this is the overlap between the labels at the tics of my plot. Since I joined the axes, the last of the left and first of the right plot tics will overlap, shown in the below example with random sin and cos plotted.

Overlapping <code>tics</code> at joining of the axes of multiplots.

How can I circumvent this in a general way. Please note that I will be plotting a lot of figures like these in series, figuring out each of these tics depending on the values of my data is not an option for me.

Thanks in advance!

My plot-file: JointAxes.gp

# Generic gnuPlot script for plotting multiple plots in a single figure

# Resetting all variables. Standard for all plots.
reset

# Setting (terminal) options. 
set terminal pdfcairo color font ",8"
set output 'JointAxes.pdf'

# Option to plot multiple graphs in one picture, note the number of figs here is 4 (2 by 2). 
set multiplot layout 2,2 rowsfirst

# Macro's needed to produce a figure with all plots 'touching'.
set macros
# Small plot labels
LABEL = "at graph 0.9,0.9"
# Axes adjustment
set format x "%.1f"

XAXE = 'set xlabel "Extent"; set xtics -2*pi,pi/3 # N.B. tics should be changed due to conjoined axes.
YAXE = 'set ylabel "Amplitude"; set ytics -1,0.25

NOX = "unset xtics;\
    unset xlabel"
NOY =  "unset ytics;\
    unset ylabel"

# Locking the graphs at fixed points in the figure
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.90; set bmargin at screen 0.55"
BMARGIN = "set tmargin at screen 0.55; set bmargin at screen 0.20"
LMARGIN = "set lmargin at screen 0.10; set rmargin at screen 0.50"
RMARGIN = "set lmargin at screen 0.50; set rmargin at screen 0.90"

# General plot markup
unset key
# Legend/key adjustment
# set key samplen 3 # length of legend colour-bar
# set key spacing 1 # spacing between samples

# Optional: Adjusting range
set yrange [-1:1]
set xrange [-pi:pi]

# Plotting the first of the 'sub'-plot
@YAXE; @NOX 
@TMARGIN; @LMARGIN
set label 1 'a' @LABEL
plot sin(x)

# Plotting the second 'sub'-plot, i.e. a new plot command.
@NOX; @NOY
@TMARGIN; @RMARGIN
set label 1 'b' @LABEL
plot cos(x)

# Plotting 3rd
@YAXE; @XAXE
@BMARGIN; @LMARGIN
set label 1 'c' @LABEL
plot sin(x + 1.57)

#And Fourth
@NOY; @XAXE
@BMARGIN; @RMARGIN
set label 1 'd' @LABEL
plot cos(x + 1.57)

unset multiplot
set terminal wxt
set output

# OEF
Eljee
  • 267
  • 1
  • 3
  • 10
  • 1
    There is no automatic option to do this. If you use gnuplot's automatically choosen tic labels you could have a chance to calculate the tics positions, see [How to get the distance between automatic generated gnuplot tics?](http://stackoverflow.com/a/25989366/2604213), and to overwrite the right most with an empty label. Yes, that requires quite a bit of work to do it right. If you have a close look at your image, you'll also need to set only specific borders for each subplot. In your example some borders overlap and appear thicker because antialiasing changes when plotting lines twice. – Christoph Jan 27 '15 at 07:46
  • Thank you so much @Christoph! Also that you have extra advice regarding the anti-aliasing of the double axes. Would not have figured that out on my own. – Eljee Jan 27 '15 at 10:31
  • @Eljee Did you fully solve this issue? If yes, it would be nice for the community to post your solution here. – David Georg Reichelt Feb 20 '21 at 11:36

0 Answers0