Line caps and joins in Plots

I have looked around in the Plots package and am unable to find out how to set the line cap style, and line join style. A simple example is this:

using Plots
pyplot()
plot([0 0.5; 0.5 1], [1 1; 1 1], linewidth=10)

That’s two horizontal lines, one from 0 to 0.5, the other from 0.5 to 1. I do not want rounded line endings, in particular not the overlapping one. Is there a capstyle=:square or similar? Similarly with an angle between the lines, like in:

plot([0 0.5; 0.5 1], [1 1; 1 2], linewidth=10)

Is there a joinstyle=:miter or similar?

3 Likes

Thank you for bringing this up. It has been a while, but I have the same question ( however I am using the gr() backend).

It would be great to have a way to have sharp (square) edges on the lines.

Fyi, in Plots.jl’s, using Shape() and this algorithm, you can create sharp joins like these:

Plots_mitter_joins