When using the mpost term ("set term mp"), the border is incorrectly created: it should finish with "cycle" (the metapost equivalent of the postscript "closepath"), but it ends by repeating the starting point, leading to an ugly corner. See example file attached: focus on the top left corner of the border.
N.B.: the terms eps and pdf do create correct borders.
I am using gnuplot 5.4 on linux (fedora 40).
I'm not sure what to do about this one. The metapost terminal has not been seriously kept up to date since gnuplot version 4. That was a long time ago. It was never updated to include the terminal API function for explicit newpath/closepath support way back in 2006 (commit db4cb6787 if you care). The metapost terminal is now documented as a "legacy" terminal and is missing support for pretty much everything that was added to the internal terminal API in version 5 with the notable exception of user-specified dash patterns.
That being said, it looks to me that adding newpath/closepath support might be as simple as the attached patch. I don't seem to have the necessary pieces on my machine here to do much with metapost (there must be some macro or prolog package I don't have). But if you can test the patch and report back that the output is satisfactory, I'll consider it for inclusion in the next incremental release package for version 6.
Hi Ethan, I checked the patch: it works, in the sense that the ugly corner is turned into a nice one now. It still has the repetition of the initial point, which is not necessary (in the postscript and pdf terminals this is solved by "re"), but I can imagine that solving that as well in mp is too complicated. Why, by the way, is the border specified twice (halfway and at the end)?
Terminals that care provide a term->path() routine that emits a newpath/closepath pair or whatever so that the line joins are appropriate. Terminals that don't care provide a null routine for this API slot. The core code draws all four sides so that it works in either case. The metapost terminal had only a NULL entry for the path() slot in the terminal API. The patch adds a minimal MP_path() routine for this slot instead.
Whoever designed gnuplot's graph layout originally was insistent that plot elements should never obscure the plot border, so after drawing everything else the program went back to retrace the border. This remains the default. However gnuplot later gained support for attaching a "layer" property to various plot elements, so you can suppress that retrace if you don't want it by saying
set border backorset border behind.Diff: