NEWS.md
reverse in position_dodge_keep(), position_dodgenudge() and position_dodgenudge_to().position_dodgenudge_to() and position_dodge2nudge_to() that allow the action of position_nudge_to() to be combined with dodging.position_stacknudge_to() and position_fillnudge_to() that allow the action of position_nudge_to() to be combined with stacking.geom_table(), geom_table_npc() and the table-theme constructors to support transparency with the alpha aesthetic.position_nudge_to() to support expansion and contraction of the range within which to spread the positions.Track changes in ‘ggplot2’ 3.5.0 and 3,5,1. Fix a couple of minor incompatibilities. Add some new features matching those new in ‘ggplot2’. General improvements and bug fixes.
wrap_labels(), useful to insert new lines into characters strings stored in a vector.as_npc(), as_npcx() and as_npcy() helper functions that translate positions given as character strings into numeric values in [0..1] corresponding to NPC (Normalised Parent Coordinates) and validate the range of numeric values if passed directly as arguments. The returned values belong to class AsIs and ready to use in aesthetic mappings.geom_point_s() adding parameter move.point to allow its use to highlight points at the original position with an arrow with its start given by the displacement by a position function.geom_point_s() the end at which the tip of the arrow is drawn, to its most frequently used direction, even if opposite to the default for geom_text_s() and geom_label_s().geom_text_s(), geom_label_s(). geom_text_pairwise() and geom_label_pairwise() adding parameter size.unit tracking change in geom_text() and geom_label() in ‘ggplot2’ >= 3.5.0.geom_text_s(), geom_label_s(). geom_text_pairwise() and geom_label_pairwise() so that graphic elements in the keys match those in the plot, even when using the additional features available in ‘ggplot2’ in >= 3.5.0.geom_text_s(), geom_label_s(). geom_text_pairwise() and geom_label_pairwise() so that they respect the alpha component of color defintions.stat_fmt_table() to allow application of functions to columns.geom_text_s(), geom_label_s(). geom_text_pairwise() and geom_label_pairwise() an infrequent problem with incomplete guides in ‘ggplot2’ >= 3.5.0.geom_point_s(), alpha_target = "point" ignored.geom_label_s(), colour_target = "box.line" ignored.shrink_segments() giving a spureous error with totel shrinkage > 1 mm. Affecting all geometries with formal parameters box.padding and point.padding.stat_density2d_filter().position_dodgenudge(), behaviour like position_dodge2nudge().x or y nudge vectors longer than one but shorter than the number of rows in data by reordering them based on the ordering of the data values to which they are applied.angle aesthetic in geom_label_npc(), geom_label_s() and geom_label_pairwise() matching the upcoming update to ggplot2::geom_label() (with help from teunbrand).linetype aesthetic to geom_label_npc(), for consistency with geom_label_s() and geom_label_pairwise().position_stack_minmax() to correctly position error bars in stacked plots.birch.dfand birch_dw.df with data for 350 birch seedlings.weather_18_june_2019.df with data at 1 min interval for 24 h.quadrant_example.df and volcano_example.df from ‘ggpmisc’ to ‘ggpp’.geom_text_pairwise() and geom_label_pairwise()suitable for annotating/highlighting pairwise comparisons between levels of a factor mapped to the x aesthetic. They can also be used to highlight ranges of values when the variable mapped to x is a continuous numerical vector. The user interfaces are consistent with those of geom_text_s() and geom_label_s().stat_quadrant_counts() and stat_group_counts().stat_group_counts(): mismatch between counts and groups.stat_functions(), a replacement for ggplot2::stat_function() that fully complies with the grammar of graphics, supporting multiple functions per layer, grouping and facets.stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g(): handle elegantly data for which density cannot be estimated (Issue #32 raised by mshubert to report bug).stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g() use type = 8 when computing quantiles, instead of the default type = 7. Type 8 is recommended as better with data that are not normally distributed.exclude.these to stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g() allowing forcing the exclusion of specific observations irrespective of the local density (See issue #19, partly addressing a suggestion by mshubert).stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g() add parameter these.target making it possible to apply a function or vector of values passed through exclude.these or keep.these to any variable in the layer data (See issue #19, partly addressing a suggestion by mshubert)."spread" action in position_nudge_to().colour.target to improve consistency; now segments are never the target of colour by default.color.target and default.colors as synonyms of colour.target and default.colours.aes_string() in ‘ggplot2’ (>= 3.0.0).keep.these to stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g() allowing forcing the inclusion of specific observations irrespective of the local density (See issue #19, partly addressing a suggestion by mshubert).stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g() to allow separate control of kept observations or labels in each tail (1D) or in each quadrant (2D) of the density distribution, still using an estimate of the local density computed from the whole data set.return.density to stat_dens2d_labels(), stat_dens2d_filter(), stat_dens2d_filter_g(), stat_dens1d_labels(), stat_dens1d_filter() and stat_dens1d_filter_g() to request the local density estimate at the position of each observation to be returned in numeric variable density and the outcome of the test in logical variable keep.stat_panel_counts() and stat_group_counts().default.colour and colour.target to geom_label_s(), geom_text_s(), geom_point_s(), geom_plot(), geom_table() and geom_grob().default.alpha and alpha.target to geom_label_s(), geom_text_s(), geom_point_s(), geom_plot(), geom_table() and geom_grob().segment.colour, segment.alpha, and segment.size in geom_label_s(), geom_text_s(), geom_point_s(), geom_plot(), geom_table() and geom_grob(). (Segments are links, and not meant to inform about data values on their own.)dark_or_light().linewidth in geom_quadrant_lines() and geom_vhlines() for compatibility with ‘ggplot2’ (>= 3.3.7).geom_text_s() and geom_label_s() to support justification computed from positions, with hjust = "position" and vjust = "position" as new defaults. (The current, very simple, approach will be further tested and if necessary improved for the next release.)geom_text_s() and geom_label_s() to enable segment.size aesthetic and increase its default value, and add formal parameters point.padding, box.padding and min.segment.length to allow adjusting the length of the segments.position_nudge_center() for compatibility with ‘ggplot2’ (>= 3.3.7) and to ensure that every label gets nudged even if located exactly at the center (focus point of nudging).Multiple grobs and grob trees sharing the same name result in only the first one being rendered. This caused problems when multiple layers created with the same geometry were added to a plot.
Based on issues raised in the GitHub repository of ‘ggrepel’ and the nudge functions added some time ago to package ‘ggpp’ it became obvious that nudging can help in achieving good repulsion outcomes without need of tailored repulsion algorithms for specific cases. Obviously developing new ggplot position functions is much easier than tweaking the repulsion algorithm. It is also clear that not being able to combine nudging with stack, jitter and dodge positions made difficult to produce some types of plots. One case is replacing a key or legend with direct labels to plot elements, which is important in plots aimed at audiences outside academia.
In one of the issues in the GitHub repository of ‘ggrepel’ an answer by M. Krassowski included code that provided an elegant and simple approach to implementing combined position functions without duplicating code already in ‘ggplot2’ by instead calling methods of the parent class. I edited this code and included it in the package.
Except for the position functions with names ending in _keep, for which normal counterparts exist, the keeping of the original position can be disabled by passing kept.origin = "none" when they are called.
The renaming of geom_text_linked() to geom_text_s() is code breaking but I am now fairly confident this shorter name is easy to remember with s for segment.
position_stack_keep(), position_fill_keep(), position_jitter_keep(), position_dodge_keep() and position_dodge2_keep().position_stacknudge(), position_fillnudge(), position_jitternudge(), position_dodgenudge() and position_dodge2nudge() based on code by M. Krassowski for position_stack_and_nudge().position_nudge_to(), position_nudge_center() and position_nudge_line() adding support for disabling keeping of the original positions.geom_point_s() and geom_label_s() and update geom_text_s() renamed from geom_text_linked(). This is a code breaking change with respect to the previous (unstable) version.geom_plot(), geom_table() and geom_grob() to support plotting of segments when positions change, e.g., with nudging.With 12 new and four partly rewritten functions there is quite a lot of new code in this update, so even if tested and checked, it is possible that bugs may have slipped through. Please, do report them if you encounter any.
The initial implementation and user interface of three apply statistics first introduced in ‘ggpmisc’ 0.3.6 has been revised to expand their usefulness and to make them less error-prone, while the fourth one is now defunct. Note: The default argument for geom instat_centroid() is likely to change in the near future. Otherwise, the three statistics can be considered now stable.
Update stat_apply_group() to support summary functions like quantile() that return vectors with more than one value but shorter than the original number of observations.
Update stat_summary_xy() and stat_apply_group() to return NA in x and/or y when .fun.x or .fun.y are not passed an argument. This is a code breaking change with respect to the previous (unstable) version.
Update stat_summary_xy() and stat_centroid() to support functions that return a one row data frame, like those defined in ‘ggplot2’ to be passed as argument to parameter fun.data of ggplot2::stat_summary(), such as mean_se, mean_cl_boot , etc.
Fix bug in stat_centroid(), stat_summary_xy() and stat_apply_group() resulting in the return of a long data frame with NA values instead of a data frame with fewer rows.
Remove stat_apply_panel() , as it was redundant. Grouping can be modified per layer when needed.
Update compute_just2D() and compute_just() to work with any value for the angle aesthetic, as in the accepted version of the pull request in ‘ggplot2’.
Fix bug in geom_table() that would cause text left or right justified to be clipped when the text in a cell was very long (reported by dryguy). (Cell padding still needs improvement.)
This new package is the result of splitting package ‘ggpmisc’ into two packages: ‘ggpp’ containing extensions to the grammar of graphics and ‘ggpmisc’ containing extensions to ‘ggplot2’ related to plot decorations based on model fits, statistical summaries and other descriptors of the data being plotted. Package ‘ggpmisc’ depends on ‘ggpp’ with no visible changes for users. Package ‘ggpp’ can be loaded instead of ‘ggpmisc’ when only the extensions it contains are needed. Package ‘gginnards’ containing tools for editing ggplot objects as well as tools for inspecting them is an earlier spin-off from ‘gpmisc’.
Compared to ‘ggpmisc’ 0.3.9, the following changes have been introduced. New justification styles have being implemented to complement position_nudge_center() . They are supported in geom_text_s(), geom_plot(), geom_table(), geom_grob() and geom_marging_grob(). In the current implementation all rows in data should contain the same hjust or vjust value when using the new types of justification described here, this seems reasonable as they compute the individual justification values from the data. All other justification values, either numeric or character do not have this restriction and can be used as in geoms from ‘ggplot2’. These new features may change in the near future.
geom_linked_text() into geom_text_linked()."outward_mean" , "inward_mean" , "outward_median" and "inward_median" so that outward and inward are with respect to the centroid of the data instead of to the middle of the or scales. This should be useful in combination with position_nudge_center()."outward_nnn" and "inward_nnn" so that outward and inward are with respect to the number resulting from applying as.numeric() to the characters that replace nnn. For example strings like "outward_0.5" , "inward_3e5" or "outward_-3e-2" are supported. This should be useful when manual tweaking is desired. As special cases "outward_0" and "inward_0" apply justification outward and inward with respect to the origin. This should be useful for biplots used for PCA and similar cases with arrows radiating out of the origin. (The "outward" and "inward" justification implemented in ‘ggplot2’ is relative to the middle of the or scales.)compute_npcx() and compute_npcy() to support multiple steps per group (needed in ‘ggpmisc’)."outward" and "inward" justification of text labels when angle aesthetic takes values < -45 or > 45 degrees. This code change alters how old plots are rendered if text labels have been rotated by more than 45 degrees.ggplot2::geom_text() has been submitted and merged. This is now in the ‘ggplot2’ 3.3.4 milestone retaining consistent behaviour between ‘ggplot2’, ‘ggrepel’, ‘ggpp’ and ‘ggpmisc’.