vlang / vsl

V library to develop Artificial Intelligence and High-Performance Scientific Computations
https://vlang.github.io/vsl
MIT License
351 stars 44 forks source link

vsl.plot annotations show a downward-sloping arrow #174

Open holder66 opened 11 months ago

holder66 commented 11 months ago

Describe the bug

newplot-3

Expected Behavior

No arrow!

Current Behavior

No errors. Interestingly, the annotation position when running the code is different from its position in the generated png file. screen shot of annotated plot.pdf

Reproduction Steps

module main

import vsl.plot
import vsl.util

fn main() {
    y := [
        0.0,
        1,
        3,
        1,
        0,
        -1,
        -3,
        -1,
        0,
        1,
        3,
        1,
        0,
    ]
    x := util.arange(y.len).map(f64(it))
    mut plt := plot.Plot.new()
    plt.scatter(
        x: x
        y: y
        mode: 'lines+markers'
        marker: plot.Marker{
            size: []f64{len: x.len, init: 10.0}
            color: []string{len: x.len, init: '#FF0000'}
        }
        line: plot.Line{
            color: '#FF0000'
        }
    )
    annotation1 := plot.Annotation{
        text: 'test annotation'
    }
    plt.layout(
        title: 'Scatter plot example'
        annotations: [annotation1]
    )
    plt.show()!
}

Possible Solution

No response

Additional Information/Context

No response

V version

see below

Version used

vsl as of 2023-10-17 13h47 EST

Environment details (OS name and version, etc.)

V full version: V 0.4.2 4bc9a8f.dc6e317 OS: macos, macOS, 14.0, 23A344 Processor: 16 cpus, 64bit, little endian, Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz

getwd: /Users/henryolders vexe: /Users/henryolders/v/v vexe mtime: 2023-10-17 17:36:44

vroot: OK, value: /Users/henryolders/v VMODULES: OK, value: /Users/henryolders/.vmodules VTMP: OK, value: /tmp/v_507

env VFLAGS: "-use-os-system-to-run"

Git version: git version 2.41.0 Git vroot status: weekly.2023.33-368-gdc6e3178-dirty .git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.0.40.1) thirdparty/tcc status: thirdparty-macos-amd64 46662e20