cf-convention / cf-conventions

AsciiDoc Source
http://cfconventions.org/cf-conventions/cf-conventions
Creative Commons Zero v1.0 Universal
89 stars 46 forks source link

Use SVG images for Chapter 7 figures 1 and 2 #551

Closed DocOtak closed 1 month ago

DocOtak commented 1 month ago

This was inspired by the awesome work in #522

I've converted the two remaining png figured into svgs from the PDFs using svg2pdf from the cairo library. This saves about 300kb from the html build and about 100kb in the pdf builds. All while higher quality.

This is actually my first PR to the actual conventions repository, my change is just technical and I feel it does not need the addition of my name to the authors list.

See issue #XXX for discussion of these changes.

Release checklist

For maintainers

After the merge remember to delete the source branch. Tags are set at the conclusion of the annual meeting; until then, main always is a draft for the next version.

neumannd commented 1 month ago

@DocOtak I could re-created the figures directly as svg files (I created these figures in the first place).

DocOtak commented 1 month ago

@neumannd How did you create the figures in the first place? It might it be worth adding the "source" to this repository. The pdf2svg tool does a pretty good job when the input is already a vector of some sort and these PDFs were.

neumannd commented 1 month ago

@DocOtak

How did you create the figures in the first place?

I created them with a small R script.

It might it be worth adding the "source" to this repository.

Sure. Sounds reasonable. To which location should I copy/push the code? Or just as a comment into the document?

The pdf2svg tool does a pretty good job when the input is already a vector of some sort and these PDFs were.

OK. Then, I won't re-create them as SVG.

DocOtak commented 1 month ago

We should open an issue/discussion to ask how and where the sources should be added. Did you make any other figures than these two?

If it is easy to do, I'd like to know if the direct SVG output is smaller/more efficient than this conversion. The SVG output from this is about 60kb each, where the PDFs are 5kb each.

neumannd commented 1 month ago

We should open an issue/discussion to ask how and where the sources should be added. Did you make any other figures than these two?

Only these two -- as far as I remember.

If it is easy to do, I'd like to know if the direct SVG output is smaller/more efficient than this conversion. The SVG output from this is about 60kb each, where the PDFs are 5kb each.

The SVGs are slightly large than the PDFs but not 10x as large:

$ ls -la
...   5554 21. Okt 12:21 order_horizontal_bounds__1D_coord_variables.svg
... 110084 21. Okt 12:21 order_horizontal_bounds__1D_coord_variables.png
...   4751 21. Okt 12:21 order_horizontal_bounds__1D_coord_variables.pdf
...   5107 21. Okt 12:23 order_horizontal_bounds__2D_coord_variables.pdf
...   8944 21. Okt 12:23 order_horizontal_bounds__2D_coord_variables.svg
... 228137 21. Okt 12:23 order_horizontal_bounds__2D_coord_variables.png

I attached them.

order_horizontal_bounds__1D_coord_variables order_horizontal_bounds__2D_coord_variables

cofinoa commented 1 month ago

@neumannd, while we decide what to do with the original scripts, could you please add both R scripts to the images directory and name them as follows:

order_horizontal_bounds__1D_coord_variables.R
order_horizontal_bounds__2D_coord_variables.R

Additionally, could you include a comment or header in each script indicating the R version and any dependencies, if applicable?

neumannd commented 1 month ago

@DocOtak OK. I'll do so tomorrow or later today. As an extra PR refering to this on?

neumannd commented 1 month ago

@DocOtak I created a pull request to your branch DocOtak:svg_figures. Then, we have everything in this on PR to the cf-conventions. I added version requirements to the top of the R code. I am not sure whether the way I did conforms to any standard or not. Maybe, it works with lower version as well.

DocOtak commented 1 month ago

@neumannd merged, it should update this PR automatically

neumannd commented 1 month ago

@DocOtak Worked. But, I forgot to update paths in the code => new PR to your branch. Sorry for that.