0

I am trying to recreate a 2D impulse plot within a 3D view map splot, but the tic label placement, tic length and automatic margins differ a lot.

The margins might be fixed with appropriate set <x>margin ... commands, but still the ticlabel position and tic lengths will be different (at least for qt, pdfcairo and cairolatex). Is there any way to force the splot tics to be the same as in the plot? Am I missing something, or is this a bug? (The reason for using splot is that in the final picture I will include a pm3d heatmap, which I omitted for this question)

$DATA << EOD
875.8099999999999454        7.031864759051518039
891.4099999999999682        3.625434282447940069
908.8200000000000500        0.6789993790833232460
EOD

set xr [850:930]
set yr [0:10]
set view map

set term pdfcairo
set out "impulses.pdf"
plot $DATA w i lw 5 t "impulses"

set out "vectors.pdf"
splot $DATA u 1:(0):(0):(0):2:(0) w vectors nohead lw 5 t "vectors"
unset out

enter image description here enter image description here

Eldrad
  • 733
  • 3
  • 15
  • I also noticed the "unpredictable" margins and label positions with `set view map`. Instead of `splot w pm3d` wouldn't `plot w image` a possible alternative? (of course depending on your exact heatmap data) – theozh Apr 28 '22 at 14:37
  • @theozh `plot w image` is actually what I used in the end: https://stackoverflow.com/a/71240920/4997051 – Eldrad Apr 28 '22 at 14:45

1 Answers1

0

As you note, the most precise way to fix the plot size to exactly match is to set absolute positions for the margins:

 set lmargin at screen 0.1
 set rmargin at screen 0.9
 set bmargin at screen 0.1
 set tmargin at screen 0.9

I am puzzled by the difference in y tickmark lengths. That may be a bug or possibly it is some peculiarity of the font properties (the tic length is supposed to half the character height). A work-around is to adjust the length manually prior to the splot:

 set ytics scale 0.6

With those changes in place your test case produces the graphs below. plot splot

Ethan
  • 13,715
  • 2
  • 12
  • 21
  • Unfortunately that does not resolve all issues. For testing I put these figures on two consecutive slides of a presentation (e.g. `beamer`) and jumped back and forth: The xticlabels and yticlabels and even the key placement are wobbling and inconsistent, and for me the ytics need to be scaled by approximately 0.55 and the xtics by 0.95 (and this is still not perfect). So I guess this in unexpected behaviour; should I create a bug report? – Eldrad Feb 21 '22 at 19:49
  • There is no claim or expectation that the output from 2D vs 3D plotting will be identical. `plot` and `splot` are different commands, and the code implementing them is mostly not shared. You can control the exact placement of the borders in either case with `set margin`. Beyond that.... no. On the other hand, do you really need to mix 2D and 3D? It is quite possible to create 2D heatmaps with palette coloring. Maybe ask that as a new question? – Ethan Feb 21 '22 at 21:01
  • I see, so in my case I'll need to fiddle around with manual fine tuning of the splot… the actual goal is to have gradient filledcurves, for which there still is no satisfying answer, and I'm adapting this contribution for my needs: https://stackoverflow.com/a/64520979/4997051 – Eldrad Feb 22 '22 at 09:49
  • Gradient-fill curves could perhaps be done using the new "masking" feature in the development version. That is not exactly what it was intended for, but maybe it works? Or could be extended? See http://gnuplot.sourceforge.net/demo_5.5/mask_pm3d.html – Ethan Feb 22 '22 at 17:37