Skip to content

feat: add scatterplot svg library#12

Merged
leohhhn merged 19 commits into
gnoverse:mainfrom
divisio74:feat/scatterplot
Nov 10, 2025
Merged

feat: add scatterplot svg library#12
leohhhn merged 19 commits into
gnoverse:mainfrom
divisio74:feat/scatterplot

Conversation

@divisio74

@divisio74 divisio74 commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

Gno Scatterplot

New Pr for the gnov package with coding style correction and new README.md

The gnov package allows you to render a scatter plot as an SVG image. It takes a list of (x, y) points and draws them as circles on a 2D canvas. You can also apply optional flags to display regression lines or curves.

API references

Testscatter(POINTS, "TITLE", "X_AXIS_TITLE", "Y_AXIS_TITLE", "FLAG")

POINTS strcuture is set with the following arguments :

   type Point struct {
       X, Y  float64 //Coordinate of the point
       Color string // Color of the point
       Label string // Associate a label to the point
   }

TITLE, X_AXIS_TITLE, Y_AXIS_TITLE are strings.

FlagRe is a Boolean value: true to enable and false by default.

Maxticks is an int n used to divide the axis into n graduation marks.

Width and height are int to personalize the size of the scatterplot.

Usage

Usecase

ScatterPlot{
        Points: []Point{
            {X: 100, Y: 00, Label: "A"},
            {X: 101, Y: 20, Label: "B"},
            {X: 102, Y: 40, Label: "C"},
			{X: 103, Y: 60, Label: "D"},
        },
        Title: "Sales Growth",
        XAxis: "Years",
        YAxis: "Sales",
        FlagRe:  true,
        maxticks: 20,
        width: 800,
        height: 800,
    }

Flags

Lineary Regression flag that display the regression line of the scatterplot can be actived by the bool true.
Each flag shows the equation of the regression in the top left of the Scatterplot.

Example

image

@davd-gzl

davd-gzl commented Sep 27, 2025

Copy link
Copy Markdown

Hey, nice idea! 🥳
I recommend you to add images in your PR for visual examples.

Comment thread packages/p/pierre115/gnovisual/scatterplot_test.gno
Comment thread packages/p/pierre115/gnov/README.md Outdated
@@ -0,0 +1,50 @@
# GNOV Scatterplot

The `gnov` package allows you to render a scatter plot as an SVG image. It takes a list of `(x, y)` points and draws them as circles on a 2D canvas. You can also apply optional flags to display regression lines or curves.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What means the name gnov?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gno Visual aha but i thinks we can find a better name for this ...

@davd-gzl davd-gzl Sep 29, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you keep the name (which I think is alright), I think it's always great to highlight what it means, so the reader can better remind of it!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @Davphla said; rename the H1 to the full name, GnoVisual, so that it makes sense to the reader. Then, you can chose to abbreviate it if you want. I get the point of shortening names, but you should ty naming your packages so that they're recognizable from the import path. A good name would be 'p/pierre115/scatterplot` :)

Comment thread packages/p/pierre115/gnovisual/type.gno
Label string
}

// Scatterplot structure

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment thread packages/p/pierre115/gnov/scatterplot.gno Outdated
Comment thread packages/p/pierre115/gnov/scatterplot.gno Outdated
Comment thread packages/p/pierre115/gnov/README.md Outdated
Comment thread packages/p/pierre115/gnov/README.md Outdated
Comment thread packages/p/pierre115/gnov/README.md Outdated
Comment thread packages/p/pierre115/gnov/README.md Outdated

`POINTS` strcuture is set with the following arguments :
```go
X, Y float64

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the type point struct { here to make it easier to read

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its done !

@leohhhn

leohhhn commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

Hey, can you please reply to @Davphla's comments before resolving the conversations?

@davd-gzl

davd-gzl commented Oct 3, 2025

Copy link
Copy Markdown

@divisio74 I recommend you to add the link to the commit when replying to the comment!

@davd-gzl davd-gzl left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall some missing details, but after it's fixed it should be good I think!

Comment thread packages/p/pierre115/gnov/type.gno Outdated
Comment thread packages/p/pierre115/gnov/scatterplot_test.gno Outdated
Comment thread packages/p/pierre115/gnov/type.gno Outdated
Comment thread packages/p/pierre115/gnov/scatterplot.gno Outdated
@davd-gzl

davd-gzl commented Oct 3, 2025

Copy link
Copy Markdown

Also CI don't pass

@leohhhn

leohhhn commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

you can run make fmt in the packages/ folder to fix the CI :)

@leohhhn leohhhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some preliminary comments

Comment thread packages/p/pierre115/gnov/README.md Outdated
@@ -0,0 +1,50 @@
# GNOV Scatterplot

The `gnov` package allows you to render a scatter plot as an SVG image. It takes a list of `(x, y)` points and draws them as circles on a 2D canvas. You can also apply optional flags to display regression lines or curves.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @Davphla said; rename the H1 to the full name, GnoVisual, so that it makes sense to the reader. Then, you can chose to abbreviate it if you want. I get the point of shortening names, but you should ty naming your packages so that they're recognizable from the import path. A good name would be 'p/pierre115/scatterplot` :)

Comment thread packages/p/pierre115/gnov/README.md Outdated
Comment thread packages/p/pierre115/gnov/README.md Outdated
Comment thread packages/p/pierre115/gnov/README.md Outdated
Comment thread packages/p/pierre115/gnov/scatterplot.gno Outdated
Comment thread packages/p/pierre115/gnovisual/scatterplot.gno
Comment thread packages/p/pierre115/gnov/scatterplot.gno Outdated
Comment thread packages/p/pierre115/gnov/scatterplot.gno Outdated
Comment thread packages/p/pierre115/gnovisual/gnomod.toml
Comment thread packages/p/pierre115/gnovisual/README.md Outdated

@leohhhn leohhhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you check out a few more comments by me and @Davphla so we can go ahead with the merge?

@leohhhn

leohhhn commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Can you check why the lint CI is failing? all good, staging was reloading

@leohhhn leohhhn merged commit 9b50eb2 into gnoverse:main Nov 10, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants