Skip to content

Releases: has2k1/plotnine

v0.15.0

15 Jul 21:10
v0.15.0
Compare
Choose a tag to compare

API Changes

  • Themeables axis_ticks_pad, axis_ticks_pad_minor, axis_ticks_pad_major, axis_ticks_pad_minor_x, axis_ticks_pad_minor_y, axis_ticks_pad_major_x and axis_ticks_pad_major_y have been deprecated. Use the margin parameter of element_text with axis_text, axis_text_x or axis_text_y to control the spacing between the axis text and the ticks. (#843)
  • The stat class methods stat.compute_layer, stat.compute_panel and stat.compute_group are now instance methods and they no longer accept **params arguments. Access to the parameters is through self.params.
  • The geom class methods geom.draw_layer and geom.draw_panel do no longer accept **param arguments. Access to the parameters is through self.params.
  • Method geom.draw_group now accepts the params argument as a dictionary and not **params.

New Features

  • Plot Composition is here. Using an intuitive algebra, you can now put combine multiple plots into a single graphic. e.g.
    p1 = ggplot(...)
    p2 = ggplot(...)
    p3 = ggplot(...)
    
    (p1 | p2) / p3
  • Using plot_title_position and plot_caption_position e.g.
    theme(
       plot_title_position="plot",
       plot_caption_position="plot",
    )
    You can now position the plot_title, plot_subtitle and plot_caption by alignment them with respect to the plot. (#838)
  • Gained new label tag to create a tag for a plot. You can set it with labs e.g.
    labs(tag="A")
    and customise it using these themeables plot_tag and plot_tag_position and plot_tag_location e.g.
    theme(
       plot_tag="plot",
       plot_tag_location="plot",
       plot_tag_position="topright",
    )
  • Geoms geom_bar and geom_col have gained new parameter just that controls how the bars align with the axis break point.
  • geom_sina has gained new parameter style just like geom_violin, which make one-sided (half) sina plots.
  • Gained the Anscombe Quartet dataset, anscombe_quartet.
  • Gained new module plotnine.helpers to be a place for some helper functions.
  • Gained new helper function get_aesthetic_limits.
  • geom_point gained the ability to handle shapes of the form Sequence[tuple[float, float]] e.g.
    ((-2, -4), (-2, -1), (0, 1), (2, -1), (2, -4), (-2, -4))
    Which declares the vertices of a polygon shape.

Enhancements

  • Included datasets mpg, msleep and midwest no longer have any of their columns as categoricals. This matches the respective datasets in R. (#913)
  • When the width of the violins in geom_violin is wider than their normal area, they now overlap with those closest to the origin on top. This makes it possible to create overlapping ridge plots using half violins.
  • legend_key now inherits from panel_background and the default themes have been adjusted to rely on this inheritance. So when using the default themes, altering fill parameter of the panel_background will also affect the background of the legend_key.
  • The default value for the guide parameter for the identity scales (scale_*_identity) has been reverted to None. This means by default using these scales will not generate a legend.

Bug Fixes

  • Fixed bug in with the legend_key_height themeable where it wasn’t applied. (#921)
  • Fixed bug where justifying axis_text_x and axis_text_y using horizontal and vertical alignment did not work as expected. (#927)
  • Fixed justifying strip_text within the strip_background. (#867)
  • Fixed bug where faceting along a column with unused categories could raise an error. (#930)
  • Fixed bug where computed aesthetic from after_scale are were not applied to the legend. (#926)
  • Fixed theming of minor x axis ticks.
  • Fixed theming of axis_text, axis_text_x and axis_text_y so when they can be overriden if previously set to element_blank().
  • Fixed strip_text_x_backgrounds to always have equal heights and strip_text_y_backgrounds to have equal widths. This applies to cases where the texts have unequal number of lines or they are rotated but have different lengths.
  • Fixed the empty space below the plot title (or subtitle) when strip_text_x_backgrounds are partly or fully aligned within the panel. This space (hole), was not accounted for by any of the themeables. This affected theme_xkcd and any theme settings that tried to slide the text / background into the panel.
  • Fixed the empty space to the left the right margin when the strip_text_y_backgrounds are partly or fully aligned within the panel. This space (hole), was not accounted for by any of the themeables. This affected theme_xkcd and any theme settings that tried to slide the text / background into the panel.
  • Fixed bug in geom_histogram where mapping to the weight aesthetic lead to an error. (#936)
  • Fixed bug in geom_vline where you could not map the xintercept aesthetic to a discrete variable.
  • Fixed bug in geom_hline where you could not map the yintercept aesthetic to a discrete variable.
  • Fixed bug in all manual scales (scale_*_manual) where if you set values to a dict then setting the breaks would lead to an error. (#949)
  • Fixed using theme_void with facetting so that the strip text are always fully within the figure bounds.
  • Fixed the ordinal color scales scale_color_ordinal, scale_color_cmap_d scale_fill_ordinal and scale_fill_cmap_d to handle missing (NaN or None) values. (#953)

v0.14.6

25 Jun 15:19
v0.14.6
Compare
Choose a tag to compare

This release prevents plotnine from pulling in scipy v1.16.0 because it does not play well with statsmodels.

v0.14.5

02 Jan 11:19
v0.14.5
Compare
Choose a tag to compare

Fixes

Fixed geom_text with adjust_text so that the the arrows are drawn between layers with the text/label on top.

v0.14.4

16 Dec 14:20
v0.14.4
Compare
Choose a tag to compare

Bug Fixes

  • Fixed geom_text with adjust_text so that the the arrows are drawn at the same layer (zorder) as the text.

  • Fixed geom_text with adjust_text for some cases where the text are placed outside the panels. #899

  • The default aesthetics and aesthetic parameters of geoms (and stats) are now transformed. So you can now set date values as aesthetic parameters. e.g.

    geom_point(y=datetime(2024, 12, 11))

    if the y aesthetic is mapped to datetime column in another layer.

  • Fixed bug for matplotlib>3.10 where the axis_ticks_length for the x-axis had no effect.

v0.14.3

26 Nov 15:00
v0.14.3
Compare
Choose a tag to compare

Enhancements

  • Got rid of a logging information about the fontsize that is recorded for all plots that have a legend. (#889)
  • When using geom_text with adjust_text, some sensible default arrow properties will be applied.
  • Changed the threshold number of keys for when the legend is split into multiple columns from 20 to 15. This only applies in the default case when the user does not set the number of rows or columns i.e. guide_legend(nrow=None, ncol=None). (#757)

v0.14.2

21 Nov 14:59
v0.14.2
Compare
Choose a tag to compare

Bug Fixes

  • Fixed bugs that affected geom_dotplot and geom_sina where data with an index that did not include 0 led to a crash. (#888)
  • Fixed v0.14.0 regression that made scale_color_cmap_d unusable. (#890)

v0.14.1

05 Nov 15:43
v0.14.1
Compare
Choose a tag to compare

Bug Fixes

  • Fix expansion of datetime and timedelta scales when using both the lower and upper addition constants.
  • In quarto documents make the output retina even if the fig-format is png.
  • Fixed bug where you could not save as pdf if also specifying the aspect_ratio. (#885)

v0.14.0

29 Oct 11:00
v0.14.0
Compare
Choose a tag to compare

API Changes

  • You cannot call print on a ggplot object to show it. This was deprecated in v0.13.0 and it has now been removed. Use ggplot.show()

  • The color_space parameter of scale_color_hue now accepts the value "hlsuv" instead of "husl". The meaning of has not changed, and "husl" is silently accepted.

  • Themeables axis_ticks_direction, axis_ticks_direction_x and axis_ticks_direction_y have be deprecated. In their place, the direction of the ticks can be controlled by using +ve, -ve or complex values for the axis_ticks_length, axis_ticks_length_major, axis_ticks_length_major_x, axis_ticks_length_major_y, axis_ticks_length_minor, axis_ticks_length_minor_x, or axis_ticks_length_minor_y.

Enhancements

  • The family, fontstyle and fontweight parameters of geom_text are now aesthetics (#790).

  • plotnine now responds to the fig-width, fig-height and fig-format settings in the meta section of a quarto document.

  • ggtitle now accepts title and subtitle as keyword arguments. (#804)

  • Gained the option limitsize that makes it possible to display plots of any size.

    from plotnine.options import set_option
    
    set_option("figure_format", False)
  • For geom_boxplot when the outliers are made invisible by giving them no shape, now they do not affect the limits of the plot. (#814)

  • Made it possile to map an aesthetic value to None. (#791)

  • The signatures for the scale classes now list all the allowed parameters.

New Features

  • geom_text has gained new aesthetics fontvariant and fontstretch.

Bug Fixes

  • Fix layers 3 and above not to overlap the axis lines if there are any (#798).

  • Fixed bug in geom_segment where the lineend parameter was ignored. (#727)

  • Fixed stat_summary_bin to work with continuous x aesthetic when specifying the binwidth or breaks. (#824)

  • Fixed PlotnineAnimation not to draw a second legend at the bottom-left corner. (#816)

  • Fixed bug where setting theme(text=element_blank()) would raise and exception.

  • Fixed datetime and timedelta scales so they can be expanded by
    adding constant timedelta values.

v0.13.6

10 May 08:15
v0.13.6
Compare
Choose a tag to compare

Bug Fixes

  • Fixed geom_label to work with a boxstyle of any following square, circle, darrow, larrow, rarrow, roundtooth or sawtooth.(#779)

Enhancements

  • Stopped spurious warnings of the form PlotnineWarning: Failed to apply after_scale modifications to the legend. when the after_scale mapping is for another aestetic.
  • Added width and height as default aesthetics of geom_tile.

v0.13.5

26 Apr 19:26
v0.13.5
Compare
Choose a tag to compare

Bug Fixes

  • Fixed bug in stat_smooth where you could not set the family when using a glm. (#769)
  • Fixed bug in position_dodge2 the widths of the dodged objects were mixed up. (#772)
  • Fixed geom_text to work better with adjustText v1.0.0 and above.
  • Fixed images generated in quarto so that they have the dimensions (taking the dpi into account) that are specified in theme. (#773)

New

  • Added themeable svg_usefonts. (#756)
  • Enhancements
  • Added palmerpenguins dataset.