Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

vgsvg enhancement: avoid transform instructions in svg code

オープン
#518 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go

調査の方向性

まず、グループとテキストの transform 属性を生成する SVG 生成コードを特定し、SVG 出力前にプロット座標がどのように変換されるかを追跡します。transform が繰り返される場合とされない場合で生成された SVG を比較し、該当するレンダリングテストがあれば特定します。冗長な transform 命令を削除したうえで同等のプロットが生成され、SVG 出力が小さくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Suggestion

To make generated svg code more compact, I suggest to make the transform in the Go code instead of the svg code.

The change would allow to change

  1. <g transform="scale(1, -1) translate(0, -216)"> into <g> which occur once in the svg code.
  2. <text x="462.81" y="-0.2002" transform="scale(1, -1)" style=... into <text x="462.81" y="-0.2002" style=... which occur for every text tag in the svg code.

Benefits :

  • reduce the size of the SVG code for plots,
  • execute the transform once at svg code generation, not at each plot rendering.

Disadvantages :

  • make the go code a little more complex by adding the transform instruction

Another optimization could be to use style definition in the svg code to avoid repeating the style in each text tag. This would be more beneficial to the size, but also slightly more complex to implement.

If you agree, I may work on a PR proposal.

The use case I have is that I attach multiple svg plots to mails which has a maximum size limit. Whoever would want to save/archive many plots would be glad that they are small. They are already smaller than PNG plots, but we could do better than that.

主要言語
Go
スター
3k
フォーク
202
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

gonum/plot のほかの issue

gonum/plot の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。