ggpop 1.7.0
This release of ggpop delivers new theming support, expanded icon customization, critical bug fixes, and significant internal refactoring toward a fully ggplot-native architecture. Deprecated functionality has been removed and the package has been finalized.
Bug Fixes
Fixed
stroke_widthhaving no effect ingeom_icon_point()when placed insideaes(). The validatorvalidate_stroke_width_not_aesthetic()was already used ingeom_pop()but missing fromgeom_icon_point(), causing the parameter to be silently bypassed. Both geoms now warn users to movestroke_widthoutsideaes()(#353).Fixed literal and expression alpha values in
aes()(e.g.aes(alpha = 0.5)oraes(alpha = col / 10)) not applying to legend icons. Only column-mapped alpha previously affected the legend; fixed constants and computed expressions are now correctly resolved and applied to both plot icons and legend keys ingeom_pop()andgeom_icon_point()(#353).Fixed false “Facet / grouping caution” warning and incorrect per-group icon positioning triggered when a user-provided data frame happened to contain a column named
group. Both the warning and the auto-facet detection are now gated on whether the data was produced byprocess_data(), so raw data frames work correctly regardless of column names (#346).Fixed icon size inconsistency across different ggplot2 themes and corrected
scale_legend_icon()to properly reflect theme settings (#287).Fixed legend icon ordering for factor variables mapped to
colour, ensuring legend icons follow factor level order rather than data row order (#294).Fixed icon bleed into unrelated legends in
geom_icon_point(). Icons were rendered behind fill legend keys becausegeom_imagelistsfillin its default aesthetics, causing ggplot2 to invokekey_glyph_icon_pointfor fill guide keys. Fixed by settingshow.legend = c(colour = ..., fill = FALSE)to exclude the layer from fill guides, with a fallback guard inkey_glyph_icon_pointreturning a blank grob when no icon label matches (#371).Fixed icon-label mismatch in
geom_icon_point()when using a dummy data frame withinherit.aes = FALSE. Inherited plot-level mappings were overriding the layer’s own mappings incombined_mapping, causing icons to resolve alphabetically by icon name instead of by group label. Fixed by giving layer mappings priority over inherited ones (#371).
Improvements
- Refactored internal geom functions to be fully ggplot-native, using plot-scoped layer computation and removing reliance on
last_plot()during layer construction (#266). - Added
validate_alpha_column()to check all values in a column mapped to alpha at construction time. Values> 1or<= 0abort with a descriptive message and a rescaling hint; values in(0, 0.1)trigger a low-alpha warning (#353). - Added
validate_literal_alpha_in_aes()to validate literal and expression alpha values insideaes(), applying the same range rules as the fixedalphaparameter (#353). - Added robustness unit tests for the
stroke_widthparameter to validate behavior across edge cases (#269). - Expanded unit tests for internal helper functions and incorporated code improvements for reliability and maintainability (#275).
- Cleaned up error and warning messages by removing file-level path details, replacing them with concise, user-facing descriptions (#277).
- Normalized icon size calculation to ensure consistent rendering between
geom_popandgeom_icon_point(#282). - Added unit tests and visual snapshot tests for
scale_legend_iconto validate legend sizing and rendering behavior (#289).
New Features
- Added
stroke_widthparameter togeom_icon_point, allowing users to control icon outline thickness for improved visual contrast (#268). - Introduced personalized ggpop themes (e.g.,
theme_pop) for consistent, opinionated plot styling out of the box (#291). - Added
show.legendsupport togeom_icon_point()andgeom_pop(). Passingshow.legend = FALSEnow correctly suppresses the layer’s legend entries, matching standard ggplot2 behaviour. The fix sets the argument directly on the layer object after construction, bypassingggimage::geom_image()which does not honour this parameter (#337). - Added
fa_icons()to allow users to search and list available Font Awesome icons by name, category, or regex pattern. Results can be returned as a classified tibble or a plain character vector. Icon names are cached session-wide to avoid repeated metadata calls (#340). -
geom_pop()now exposes its internally computed coordinates to downstream layers. Geoms such asgeom_text()andgeom_label()can be added aftergeom_pop()without specifyingxandyexplicitly — they are inherited automatically from the icon grid (#341).
Breaking Changes
- Removed the deprecated
caption_popfunction. Users should migrate to standard ggplot2 annotation approaches (#279). - Finalized public function names and key glyph implementations for
geom_popandgeom_icon_point, standardizing the package. Existing code relying on previous internal names may require updates (#281).
ggpop 1.6.1
This release of ggpop introduces a set of targeted updates addressing multiple reported issues related to icon rendering, size handling, validation logic, and internal refactoring. The changes improve robustness, consistency, and maintainability while preserving expected user-facing behavior.
Bug Fixes
- Fixed icon column mapping in
geom_popandgeom_icon_point, ensuring users can map icons from any custom column name without rendering errors or unexpected behavior (#255). - Fixed aspect ratio preservation in legend icon rendering, ensuring icons scale intelligently within the legend box while maintaining their proportions (#254).
Improvements
- Refactored
process_datafunction with comprehensive input validation, enhanced error handling, and improved calculation of proportions, including proper handling ofNAvalues and filtering of invalid data (#243). - Enhanced legend icon sizing logic to automatically scale icons within the legend box while preserving aspect ratio, with wide icons filling horizontally and tall icons filling vertically (#253).
- Improved error and warning message formatting throughout the package for better readability and consistency, including multi-line formatting and actionable guidance (#253).
- Added comprehensive unit tests for
process_datafunction covering various scenarios including hierarchical grouping, input validation, edge cases, and reproducibility (#242). - Improved code clarity and structure across multiple functions by refactoring argument formatting, removing unnecessary whitespace, and adding thematic sections with comments (#253).
- Enhanced cross-layer validation by moving legend icon consistency checks to the plot-add hook, ensuring all layers are considered when detecting mixed
legend_iconssettings (#258).
New Features
- Added new
ggplot_add.ggpop_icon_point_layermethod to handle addition of icon point layers with consistency checks for legend icon settings and clear error messages (#258).
Breaking Changes
- Changed default
sizeparameter from3to1ingeom_icon_pointandgeom_popto align with new icon scaling logic. This may affect existing plots relying on the previous default value (#254).
ggpop 1.6.0
This release of ggpop introduces significant enhancements including a new geom function for flexible data plotting, improved DPI handling, new customization options for Font Awesome icons, and multiple bug fixes to enhance stability and user experience.
Bug Fixes
- Fixed draw_key function to prefer packaged PNG icons when available and cache icons in temp directory, ensuring CI environment compatibility and avoiding unnecessary regeneration (#189).
- Fixed arrange argument functionality in
geom_pop, ensuring proper icon arrangement behavior (#191). - Fixed legend icon size rendering to ensure consistent display across different scenarios (#199).
- Fixed
facet_wrapbug to ensure proper faceting behavior in plots (#201). - Fixed
geom_popto work properly when aesthetics are specified in the mainaes()call (#214). - Fixed DPI parameter to properly control icon rendering quality (#220).
- Fixed
geom_icon_pointDPI parameter which wasn’t updating quality as expected (#224). - Fixed
scale_legend_iconmargin clipping issue to prevent legend icons from being cut off (#205). - Fixed aspect ratio preservation in icon rendering for both
geom_popanddraw_key_imagefunctions (#230).
Improvements
- Improved internal implementation by removing reliance on
last_plot()from pipeline andgeom_pop, enhancing code reliability and avoiding potential side effects (#195). - Enhanced unit tests to improve code coverage and reliability (#187).
- Improved README with additional examples demonstrating package capabilities and use cases, including faceting and geofacet scenarios (#204).
- Updated unit tests with robustness checks to ensure stable behavior across different use cases (#216).
- Added comprehensive unit tests for
geom_icon_pointto ensure proper functionality (#223).
ggpop 1.5.1
This release of ggpop includes critical bug fixes and improvements to enhance stability, usability, and documentation.
Bug Fixes
- Fixed draw_key function to prefer packaged PNG icons when available and cache icons in temp directory, ensuring CI environment compatibility and avoiding unnecessary regeneration (#189).
- Fixed arrange argument functionality in
geom_pop, ensuring proper icon arrangement behavior (#191). - Fixed legend icon size rendering to ensure consistent display across different scenarios (#199).
- Fixed
facet_wrapbug to ensure proper faceting behavior in plots (#201).
Improvements
- Improved internal implementation by removing reliance on
last_plot()from pipeline andgeom_pop, enhancing code reliability and avoiding potential side effects (#195). - Enhanced
scale_legend_icondocumentation to clarify that it serves as a wrapper forguides, allowing users to specify all options directly (#115). - Added comprehensive unit tests to improve code coverage and reliability (#187).
- Improved README with additional examples demonstrating package capabilities and use cases (#204).
ggpop 1.5.0
This release of ggpop introduces a set of targeted updates to the geom_pop function in R/geom_pop.R, addressing multiple reported issues related to icon rendering, size handling, validation logic, and internal refactoring. The changes improve robustness, consistency, and maintainability while preserving expected user-facing behavior unless explicitly noted.
Bug Fixes
- Fixed legend icon assignment in faceted plots, ensuring correct icon mapping under faceting conditions by introducing dynamic legend icon assignment (#168).
Improvements
- Refactored input validation and user guidance infrastructure by introducing validation and warning functions, improving error messages with actionable fixes (#162).
- Enhanced icon rendering compatibility by adding
rsvgdependency and improving legend customization support (#164). - Refactored facet argument processing to accept both symbol and string inputs (e.g.,
facet = sexorfacet = "sex"), improving flexibility (#166). - Renamed
qualityparameter todpifor clarity, indicating it refers to image pixel height rather than subjective quality (#161). - Enhanced input validation by enforcing maximum of 1000 icons per plot or facet group, changing default
sample_sizefrom 1000 to 100, and renaming internal size variables to avoid collisions (#152). - Improved facet handling with auto-inferred facet variables from
facet_wraporfacet_grid, treating multiple groups as internal facets when no explicit facet is provided (#173). - Enforced mandatory icon specification with clear error messages, added hard stop for
dpivalues below 30 to prevent blurry icons, and enhanced warnings for ambiguous input scenarios (#175). - Improved error messages throughout with actionable fixes and examples, changed icon PNG file writing to use temporary cache directory instead of package directory, and standardized internal column naming conventions (#179).
New Features
- Added support for raw dataframes without requiring
process_data(), with automatic mode detection and type inference for user convenience (#177).
Breaking Changes
- Changed default
iconfrom"default"to"ggmale"and defaultsizefrom1to3ingeom_pop. This may affect existing code relying on previous default values (#162).
ggpop 1.4.1
This ggpop version introduces a small bug fix that made the package not install correctly.
ggpop 1.4.0
This ggpop version introduces significant enhancements to the geom_pop function in R/geom_pop.R, featuring improvements in icon quality and dynamic size mapping. Key updates include refining the code by eliminating redundant statements, allowing for a new quality parameter to control PNG icon height, and managing dynamic size mapping without requiring I(). Additional modifications involve relocating icon downloads for overwriting flexibility, streamlining the code for better readability, ensuring the proper functioning of the size parameter, and improving directory handling for PNG file generation. Overall, these changes aim to enhance the robustness and usability of the function while ensuring accurate file management.
Bug Fixes
- Removed unnecessary lines and ensured proper handling of the
sizeparameter within the function. - Added logic to create directories if needed when generating PNG files, ensuring that the directory structure is in place before attempting to write the files.
Improvements
- Erased the double and if-else statements to make it more compact.
- Removed the multiplication by 100 if the user doesn’t specify a scale icon legend.
- Cleaned up extra lines to improve readability.
New Features
- Added a new parameter
qualityto allow users to change the height of the icon for improved quality or display fewer icons. - Introduced logic to handle dynamic size mapping without requiring the use of
I(), leveraging variable extraction from the quosure and applying scaling to the size column.
ggpop 1.3.1
This version corrects typo sizes regarding how the icons are displayed in the plot, how the paths are define and the margin of the plots when the legend is render.
Bug Fixes
- Corrected a typo in the
draw_key_pop_imagefunction name inR/draw_key.R. - Fixed paths in
geom_popthat made the icons not plot from native icons or fromfontawesomepackage.
Improvements
- Added a
marginparameter to thescale_legend_iconfunction to allow customization of plot margins. - Simplified the
grid::rasterGrobcall within thedraw_key_pop_imagefunction by removing redundant width specification.
- Simplified the
ggpop 1.3.0
This version delivers major enhancements to icon handling and documentation clarity. Most notably, it improves the efficiency of Font Awesome icon rendering—reducing plot rendering time by up to 90%. A dedicated key/ directory has been introduced to organize legend icons, and the README has been significantly refined to guide users more effectively.
Bug Fixes
- Fixed inconsistencies in icon file paths used for legend generation.
- Resolved rendering issues caused by SVG icons by switching to PNG format.
Improvements
- Updated icon handling in
draw_key_pop_image()to use a centralizedkey/directory for consistency. - Changed icon format from SVG to PNG in
geom_pop()to enhance compatibility and performance:- Improved rendering speed by up to 90% for Font Awesome icons.
- Improved README.md:
- Revised package description to better emphasize visual storytelling and usability.
- Added detailed explanation of icon handling.
- Included performance benchmarks comparing Font Awesome icons and native icons.
- Enhanced example code to include the
legend_iconsparameter for a more complete demo.
ggpop 1.2.1
This version brings an update to the documentation. We included Ralitza Soultanova, Fernanado Alarid-Escudero and Carlos Pineda-Antunez as new authors. Finally, we fix some documentation issues related to the ggpop package.
Bug fixes
- We added
fontawesomeas a dependency in theDESCRIPTIONfile. This ensures that the package will work correctly when installed from CRAN or GitHub. -
man/draw_key_pop_image.RdAdded a description and details for the key drawing function for population-based image keys. -
man/ggpop-package.Rd: Added new authors to the documentation.
ggpop 1.2.0
This version brings significant improvements to the ggpop function. We are excited to announce that now we can use icons from fontawesome in the ggpop package. This enhancement allows users to create visually appealing population charts with a wider range of icon options. The “native” icons will stay since they are optimized due to the size of the images. Also, we modified the key_fn function to improve the legend icon display. Finally, we added cancer native icons due to the focus of our research. These changes aim to streamline icon management and functionality in the codebase.
Improvements
-
Legend Key Function Updates:
- The legend key function in
geom_pop.Rhas been updated to increase the dot size for cases whenlegend_icons = FALSE, ensuring better visibility of the icons in the legend.
- The legend key function in
-
SimCRC icons
- Added native icons for cancer types in the SimCRC dataset to enhance the representation of cancer-related data.
New features
-
Integration with
fontawesome:- Icons are now generated using the fontawesome package if their respective files do not exist locally. This ensures that missing icons are replaced reliably and provides access to a broader set of icons.
-
geom_pop.R, the icon assignment has been vectorized to check for SVG file existence and to automatically usefontawesome::faif needed, improving efficiency and robustness. -
draw_key.R, checks verify whether the icon file exists and, if not, generate a replacement icon viafontawesome::fa_png.
Version
- #107 Full Changelog: https://github.com/jurjoroa/ggpop/compare/v1.1.1…v1.2.0
ggpop 1.1.1
This version brings significant improvements to the geom_pop function and introduces scale_legend_icon for enhanced legend customization in ggplot2. By default, legend icons are now enabled (legend_icons = TRUE), and a new key_fn function allows custom icons when legends are activated. The newly added scale_legend_icon function lets you tailor legend icons to specific grouping variables and employ custom icons as legend keys. Documentation has also been refined with updates to NAMESPACE and the removal of redundant @importFrom statements in draw_key.R.
Bug fixes
We fix the bug scale_legend_icon function in the R/scale_legend_icon.R file to improve data retrieval and processing.
- Changed the method of retrieving the plot data by storing the last plot object in
gg_objand then accessing its data throughgg_obj$layers[[1]]$data. This improves clarity and ensures the correct data layer is accessed. - Added a new line at the end of the function to follow best practices for code formatting.
Improvements
We improved dependency management, import statements, function readability, and documentation in the package.
1. Dependency Management
- Updated the
DESCRIPTIONfile:- Moved some packages from
DependstoImportsfor better efficiency. - Added new dependencies:
magick,rlang, andggtext. - Enabled byte compilation with
ByteCompile: true.
- Moved some packages from
2. Import Statements
- Refactored the
NAMESPACEfile:- Used
importFromto import specific functions fromggplot2,ggtext, andmagick, instead of loading entire packages. - Removed unnecessary imports.
- Used
- Updated specific R scripts:
-
caption_pop.R: Replaced@import ggplot2with@importFrom ggtext element_textbox. -
draw_key.R: Added imports frommagickand clarified internal function usage fromggimageandggplot2.
-
3. Function Refinements
-
process_data.R:- Replaced base R functions with
rlangequivalents for handling symbols and quosures. - Used
::notation fortidyrandstatsfunctions for clarity.
- Replaced base R functions with
ggpop 1.1.0
This version brings significant improvements to the geom_pop function and introduces scale_legend_icon for enhanced legend customization in ggplot2. By default, legend icons are now enabled (legend_icons = TRUE), and a new key_fn function allows custom icons when legends are activated. The newly added scale_legend_icon function lets you tailor legend icons to specific grouping variables and employ custom icons as legend keys. Documentation has also been refined with updates to NAMESPACE and the removal of redundant @importFrom statements in draw_key.R.
Bug fixes
- Updated
NAMESPACEto export the newscale_legend_iconfunction. - Removed unnecessary
@importFromstatements indraw_key.Rto clean up the code.
Improvements
- Enabled legend icons by default in
geom_popby settinglegend_icons = TRUE. - Added a key function (
key_fn) to use custom legend icons whenlegend_iconsis enabled.
New features
- Introduced
scale_legend_iconto adjust legend icons based on a grouping variable and apply custom icons as legend keys.
ggplot(data = df_population) +
geom_pop(aes(icon = icon, group = type, color = type)) +
scale_legend_icon(size = 2)ggpop 1.0.1
This version includes several changes to improve data consistency and update file references in the geom_pop function and related files. The most important changes include updating file paths, ensuring consistent data types, and filtering out rows with missing values.
Bug fixes
Typo Correction: Fixed a typo for sample sizes of 300 and 301. (#94)
File Path Updates: Updated the file path and URL for
df_coordinates_final.rdatodf_coordinates_final_10_1000.rdainfetch_df_coordinates.R.Data Consistency Enhancements: - Ensured consistent data types by converting the
sizecolumn to character ingeom_pop.Added a filter to remove rows with
NAvalues in thetypecolumn.
ggpop 1.0.0
This is a major release of ggpop introduces breaking enhancements and bug fixes aimed at improving the handling of faceted and arranged population charts.
Bug fixes
- Fixed a bug that prevented proper arrangement of plots when
facet_wraporfacet_gridwas used. - Addressed issues in the merging process where
x1andy1columns could be missing after mergingdatawithdf_coordinates_final, ensuring consistent behavior. - Resolved a problem where grouping variables in faceted plots could lead to mismatches during the data merge step.
-
Fixed the
fetch_df_coordinatesfunction: Corrected the cache directory assignment by removing the erroneous reference to"yourpackage"and ensuring it correctly points to"ggpop". This ensures that coordinate data is properly cached and retrieved, preventing potential errors related to missing or incorrect coordinate mappings.
-
Fixed the
Improvements
- Improved handling of
facetvariables by dynamically calculatingsample_sizefor each group and ensuring consistent data types during merging. - Reduced redundancy in code by streamlining the recalculation of coordinates (
df_coordinates_final) and filtering (df_coordinates_filtered). - Added robust handling for grouped
facetdata, with support forfacet_wraporfacet_grid. -
Introduced the
legend_iconsparameter ingeom_popto allow users to include custom icons within the legend without hiding the entire legend. This enhancement provides greater flexibility in customizing legends, enabling the display of representative images alongside group labels for more informative and visually appealing plots.
New features
- Added support for joining
datawithsample_sizedynamically to ensure proper alignment of grouped variables in faceted visualizations. - Enhanced compatibility for plots with
arrange = TRUEand non-NULLfacetparameters.
Breaking changes
Modified the
process_datafunction: Theprocess_datafunction no longer generates aposvariable, which was previously used bygeom_popto map coordinates. Users will need to adjust their data processing pipelines accordingly to accommodate this change.Moved figures to the
instfolder: Icon images have been relocated to theinstdirectory to comply with ggplot2’s guidelines and best practices. Users should update file paths accordingly in their projects to ensure proper access to the icon images used bygeom_pop.
Full Changelog: https://github.com/jurjoroa/ggpop/compare/v0.3.1…v1.0.0
ggpop 0.3.1
This release of ggpop rectifies a bug identified in process_data. The bug prevented the addition of a variable with a name different from n. Furthermore, this issue restricted the grouping variable from being utilized without a string.
Bug fixes
- Fixed a bug that prevented the plot from arranging properly when using
facet_wraporfacet_grid.
What’s Changed
- 73 fix issue in process data function by @jurjoroa in https://github.com/jurjoroa/ggpop/pull/74
- Add fix of bugs for the new version by @jurjoroa in https://github.com/jurjoroa/ggpop/pull/75
- Change version by @jurjoroa in https://github.com/jurjoroa/ggpop/pull/76
Full Changelog: https://github.com/jurjoroa/ggpop/compare/v0.3.0…v0.3.1
ggpop 0.3.0
This release of ggpop introduces new features and improvements, including a correction of the icon library. A new facet argument allows users to specify the name of the variable to facet as a string, ensuring proper grouping and plotting. The caption_pop() function has been enhanced to provide greater flexibility for crafting captions with seamlessly integrated icons. Additionally, the README has been improved with detailed examples to help users better leverage the new features and enhancements.
Bug fixes
- Fixed a bug that prevented the plot from arranging properly when using
facet_wraporfacet_grid.
Improvements
This release of ggpop introduces exciting new features and improvements:
- Improved the README with detailed examples to help users better leverage the new features and enhancements.
New features
- Added a new
facetargument that allows users to specify the name of the variable to facet as a string, ensuring proper grouping and plotting.
Breaking changes
No breaking changes have been introduced in this version of ggpop.
Full Changelog: https://github.com/jurjoroa/ggpop/compare/v0.2.0…v0.3.0
ggpop 0.2.0
This release of ggpop introduces exciting new features and improvements. The expanded icon library offers a broader range of options for meaningful and context-specific visualizations. The new process_data() function enables grouping variables under higher-level categories, simplifying hierarchical data representation. Enhancements to caption_pop() provide greater flexibility for crafting captions with seamlessly integrated icons. Additionally, improved support for facet_grid() allows for clearer, more cohesive multi-group plots. These updates make ggpop an even more powerful tool for creating impactful population visualizations.
Bug fixes
- Fixed an issue where the
icon_sizeargument incaption_pop()was not working as expected. The argument now correctly adjusts the size of the icons in the caption.
Improvements
This release of ggpop introduces exciting new features and improvements:
Expanded Icon Library: ggpop now includes a variety of new icons, giving users more options to visually represent their data in a meaningful way.
Group Variables by Higher Categories: The new process_data() function allows users to group variables under a higher-level variable, making it easier to explore and present data hierarchies effectively.
Enhanced caption_pop() Function: The caption_pop() function has been improved for greater flexibility and customization, enabling users to craft descriptive captions that integrate icons seamlessly.
Improved facet_grid() Support: ggpop now provides better support for multi-group plots, allowing users to create facet grids that display multiple groups clearly and cohesively.
New features
Customizable Icon Simulation: This version of the package introduces the ability to simulate population groups originating from different categories using customizable icons. Users can select from a variety of icons or import their own, tailoring the visualization to their specific needs.
Descriptive Icon-Adorned Captions: ggpop now includes tools for adding descriptive captions adorned with icons. These captions not only provide textual information but also incorporate icons to visually represent different population groups, enhancing the overall narrative of the visualization.
Breaking changes
No breaking changes have been introduced in this version of ggpop.
Full Changelog: https://github.com/jurjoroa/ggpop/compare/v0.1.1…v0.2.0
ggpop 0.1.1
This is the initial release of the ggpop package, which includes functions for generating circular population charts, customizing icon representations, and adding icon-adorned captions. Additionally, ggpop offers tools to assess and implement various visualization strategies, providing users with alternative methods to display and interpret population data.
New features
Customizable Icon Simulation: This version of the package introduces the ability to simulate population groups originating from different categories using customizable icons. Users can select from a variety of icons or import their own, tailoring the visualization to their specific needs.
Descriptive Icon-Adorned Captions: ggpop now includes tools for adding descriptive captions adorned with icons. These captions not only provide textual information but also incorporate icons to visually represent different population groups, enhancing the overall narrative of the visualization.
