# Line join issues in exported figures

**URL:** <https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843>\
**Category:** Graphics and plotting\
**Created:** [February 27, 2025, 2:54pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843 "2025-02-27T14:54:46Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 2:54pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/1 "2025-02-27T14:54:46Z")

</div>

When drawing thick lines, the way lines look like differs between Scilab figure window and graphics exported to a file in vector format, e.g. PDF or SVG.

In the Scilab figure window (left), at each point (marked red) the lines just end.

In the figure exported to PDF (right), line segments are joined by a miter. Since the angle between the central line segments is small, the miter extends far beyond the data point.

 ![Scilab figure vs export](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/45e362b688b92a3356d8e7abe37bce5b8fd952e3.png)

In PDF, SVG and JAVA there is a parameter allowing to change the line join from miter to round or bevel. Is there any possibility in Scilab to change parameters for the figure export?

Thank you,  
Frank

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:07pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/2 "2025-02-27T15:07:17Z")

</div>

Some additional information:  
I searched the Scilab 2025.0.0 source for the word “miter” and found this code snipped in G2DStroke.java :

```auto
public G2DStroke(float lineWidth, float[] dash, float phase) {
super(lineWidth, CAP_BUTT, JOIN_MITER, 10.0f, dash, phase);
}

```

That looks like some hard coded settings for line end (CAP\_BUT) and line join (JOIN\_MITER).

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:13pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/3 "2025-02-27T15:13:33Z")

</div>

And here is some background why I ask:  
I often plot measurement data.  
Data series can be quite large, i.e. spacing in x can be pretty small.  
Since measurement data has noise, data series is wiggling up and down.  
Due to above described effect, visual noise in the exported graphics is a lot higher than real measurement noise.  
Like this exported graphics is useless.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 3:17pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/4 "2025-02-27T15:17:22Z")

</div>

Hello, and welcome to Scilab’s Discourse !

Feel free to create an issue to illustrate the problem you describe in your last message. Please be constructive by comparing exported graph between Scilab and other system that yields more adequate rendering.

S.

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:20pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/5 "2025-02-27T15:20:37Z")

</div>

Hello,  
you mean an issue here?

```auto
https://gitlab.com/scilab/scilab/-/issues

```

Thank you,  
Frank

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 3:30pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/6 "2025-02-27T15:30:09Z")

</div>

Yes. Please include some example code. Likely, the visual effect only occurs when using extreme values of line thickness, right ?

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:37pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/7 "2025-02-27T15:37:33Z")

</div>

O.k., I will do that.

The visual effect depends on line thickness and point spacing (in x).  
If points are close enough, the same problem occurs with normal line thicknesses.  
Making lines thinner is not always a viable solution.

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:42pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/8 "2025-02-27T15:42:56Z")

</div>

To illustrate the different line join styles, I imported the PDF into Inkscape.

 ![Join Styles](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/60c0a5f0684698e2e9cdaf08f063cae368448e66.png)

To describe the problem, I used an artifical case.  
For real life measurement data, miter join is by far the worst.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 3:47pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/9 "2025-02-27T15:47:09Z")

</div>

In fact the problem is easier to solve for exported graphics, but we have also a line joining problem for onscreen rendering, which is not solvable with the same method (allow to customize the line joining method, at the user level). We can create a new setting to control both outputs (onscreen + vectorial export), but I don’t have the solution of the onscreen case.

S.

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:52pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/10 "2025-02-27T15:52:40Z")

</div>

Actually, onscreen is o.k. for me.  
I have not yet found a real life case where onscreen was ugly.  
My problem is with export only.  
And actually it is export to VECTOR graphics only.  
Export to pixel graphics looks like onscreen.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 3:54pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/11 "2025-02-27T15:54:37Z")

</div>

Onscreen output is ugly when using large thickness (see your first post).

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 3:57pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/12 "2025-02-27T15:57:23Z")

</div>

True. But I would not consider this a real life case.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 3:59pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/13 "2025-02-27T15:59:13Z")

</div>

see [Glitches on curves with relatively large thickness (#17017) · Issues · scilab / scilab · GitLab](https://gitlab.com/scilab/scilab/-/issues/17017)

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 4:18pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/14 "2025-02-27T16:18:32Z")

</div>

Sometimes I have seen something like that, too.  
Indeed, this could be linked to the issue I reported.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 4:23pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/15 "2025-02-27T16:23:15Z")

</div>

> [@knarf](#):
>
> this could be linked to the issue I reported.

No, the onscreen rendering of lines is not done by the piece of code you found there : [scilab/modules/scirenderer/src/java/org/scilab/forge/scirenderer/implementation/g2d/motor/G2DStroke.java · minor · scilab / scilab · GitLab](https://gitlab.com/scilab/scilab/-/blob/minor/scilab/modules/scirenderer/src/java/org/scilab/forge/scirenderer/implementation/g2d/motor/G2DStroke.java?ref_type=heads#L33)

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 4:24pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/16 "2025-02-27T16:24:18Z")

</div>

I created an issue:

> **[Line join issues in exported figures (#17393) · Issues · scilab / scilab ·...](https://gitlab.com/scilab/scilab/-/issues/17393)**
>
> Bug Description When drawing (thick) lines, the way lines look like differs between Scilab figure window and graphics exported to a...

---

<div class="post-metadata">

**Author:** ![knarf](https://avatars.discourse-cdn.com/v4/letter/k/53a042/32.png) [@knarf](https://scilab.discourse.group/u/knarf)\
**Post date:** [February 27, 2025, 4:26pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/17 "2025-02-27T16:26:58Z")

</div>

You are right.  
My text was somewhat badly formulated.  
I wanted to say, that it might be linked to the issue of onscreen line segments just stopping at the data points.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2025, 4:39pm UTC](https://scilab.discourse.group/t/line-join-issues-in-exported-figures/843/18 "2025-02-27T16:39:34Z")

</div>

> [@knarf](#):
>
> onscreen line segments just stopping at the data points.

Its is a known problem of openGL ([Drawing Antialiased Lines with OpenGL | by Mapbox | maps for developers](https://blog.mapbox.com/drawing-antialiased-lines-with-opengl-8766f34192dc)), with no correct solution. Under Windows, the problem is somewhat hidden by the anti-aliasing (although still present on macOS).

S.
