Skip to content

Commit

Permalink
use svg_width/height arguments for case of static svg
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed Sep 11, 2024
1 parent c9d0d49 commit 340fd56
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 34 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
^README.md$
^working$
^\.github$
^LICENSE.md$
11 changes: 5 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
Package: ggsvg
Type: Package
Title: SVG Glyphs for ggplot
Version: 0.1.12
Author: mikefc
Maintainer: mikefc <[email protected]>
Title: SVG Glyphs for Ggplot
Version: 0.1.13
Authors@R: c(
person("Mike", "FC", , "[email protected]", role = c("aut", "cre"))
person("Mike", "Cheng", role = c("aut", "cre", 'cph'), email = "[email protected]")
)
Maintainer: Mike Cheng <[email protected]>
Description: Use SVG graphics as glyphs when plotting points with ggplot2.
License: MIT + file LICENSE
URL: https://github.com/coolbutuseless/ggsvg
BugReports: https://github.com/coolbutuseless/ggsvg/issues
Encoding: UTF-8
Language: en-US
LazyData: true
RoxygenNote: 7.2.0
RoxygenNote: 7.3.2
Imports:
grid,
ggplot2,
Expand Down
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2021,2022 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
YEAR: 2024
COPYRIGHT HOLDER: Mike Cheng
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

# ggsvg 0.1.13 2024-09-11

* Pass `svg_width` and `svg_height` to `svg_to_rasterGrob()` when
the svg is only rendered once (i.e. `is_static_svg = TRUE`)
* Fixed some minor issues to satisfy current `R CMD CHECK`

# ggsvg 0.1.12 2022-07-31

* Fix issue with `css()` selectors in some `scale_svg_*()` functions
Expand Down
6 changes: 4 additions & 2 deletions R/ggsvg.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ draw_key_PointSVG <- function(data, params, size) {
#' property will have a default value of "black"
#'
#' Set `options(GGSVG_DEBUG = TRUE)` for some verbose debugging which will
#' cause `{ggsvg}` to output (to the console) the final SVG for each and every element
#' cause ggsvg to output (to the console) the final SVG for each and every element
#' in the plot.
#'
#'
Expand Down Expand Up @@ -389,7 +389,9 @@ create_new_GeomPointSVG <- function() {

if (is_static_svg && !has_css_aes) {
# Parse the SVG just once
svg_grob_orig <- svg_to_rasterGrob(coords$svg[[1]])
svg_grob_orig <- svg_to_rasterGrob(coords$svg[[1]],
width = coords$svg_width,
height = coords$svg_height)
}


Expand Down
4 changes: 2 additions & 2 deletions R/scales-defaults.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ scale_svg_default <- function() {

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' S3 method
#' @param object,plot,objectname see ggplot2 docs
#' @param object,plot,object_name see ggplot2 docs
#' @export
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ggplot_add.ScaleSVGDefault <- function(object, plot, objectname) {
ggplot_add.ScaleSVGDefault <- function(object, plot, object_name) {
scale_ggsvg_default(plot)
}

Expand Down
2 changes: 1 addition & 1 deletion man/geom_point_svg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ggplot_add.ScaleSVGDefault.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 340fd56

Please sign in to comment.