Skip to content

Releases: has2k1/plotnine

v0.13.1

06 Mar 19:17
v0.13.1
Compare
Choose a tag to compare

v0.13.1

Bug Fixes

  • Fixed a bug where a legend with blank title or text could result in a wrong justification.

  • Fixed a bug where setting legend justification to a string i.e one of left, right, top, bottom, center had no effect.

v0.13.0

20 Feb 15:33
v0.13.0
Compare
Choose a tag to compare

API Changes

  • Requires python >= 3.9

  • Using the print or repr functions to draw and show the plot has been deprecated. Use ggplot.show().

  • The name of the calculated aesthetic of stat_function changed from y to fx.

  • stat_ecdf has gained the pad parameter. The default is set to True, which pads the domain with -inf and inf so that the ECDF does not have discontinuities at the extremes. To get the behaviour, set pad to False. (#725)

  • Removed the environment parameter from ggplot.

  • When a ggplot object is the last in a jupyter cell, the output image will not be followed by string meta information about the figure/image.

    This will happen even if the backend is set to an interactive one.

    If you set the backend to an interactive one, use show to draw the plot.

  • The default horizontal alignment for the plot title is center if it there is no subtitle. When there is a subtitle, the default is to have both aligned to the left.

  • Some parameters that control the look and feel of guide_colorbar and guide_legend have been removed. For their place, the theme parameter has been introduced and it gives better control of the look and feel.

  • Themeables legend_entry_spacing, legend_entry_spacing_x and legend_entry_spacing_y have been renamed to legend_key_spacing, legend_key_spacing_x and legend_key_spacing_y respectively

  • facet_grid now accepts two parameters, rows and cols, to specify the variables along the two dimensions of the panels.

    The previous way of using a single parameter will still work if it is a string. For cases where the value was a list, e.g.

    facet_grid(facets=["col1", "col2"])

    can be rewritten as any one of;

    facet_grid("col1", "col2")
    facet_grid(["col1"], ["col2"])
    facet_grid(rows="col1", cols="col2")
    facet_grid(rows=["col1"], cols=["col2"])
  • The facets parameter in facet_wrap has also changed to a more straight forward specification for the column variables. It expects a single string or a list/tuple of strings. (#545)

    However, the R-style formula strings are still silently accepted.

New

  • Added symmetric logarithm transformation scales scale_x_symlog and scale_y_symlog

  • Gained themeables

    to set the plot margin on each side independently.

  • Gained themeables

    to control the x & y axis ticks length.

  • Gained themeables

    to control the x & y tick padding.

  • Some parameters in element_text can now accept lists/tuples to set the values on individual text objects. (#724)

  • Gained the option figure_format to set the format of the inline figures in an interactive session.
    e.g.

    from plotnine.options import set_option
    
    set_option("figure_format", "svg")

    will output all subsequent figures in svg format.

  • Improved support for customizing guides/legends.

    • You can now add a frame to the colobar

    • You can now apply themes to individual guides, e.g.

      + guides(color=guide_colorbar(theme=theme_xkcd()))

      or

      + guides(color=guide_legend(theme=theme_minimal())
    • You can now place legends at more than one position around the panels. e.g.

      + guides(
          color=guide_colorbar(position="left"),
          fill=guide_legend(position="bottom"),
          size=guide_legend(position="bottom")
      )

      Puts the fill and size guides at the bottom, and the color guide on the left.

    • You can easily justify the legend along the four edges of the space around the panel area.

    • You can now place the legend inside the panels with easily control its location.

  • The space parameter of facet_grid now responds to the values free, free_x and free_y to have panels whose relative width and/or height depends on the data range. (#545)

Bug Fixes

  • Fixed handling of minor breaks in scale_continuous to accept numpy arrays and when the scale has a transform, that the minor breaks are supplied in user space and not transform space. Just like the major breaks. (#685)

  • Fixed theming of axis_ticks with the size parameter. (#703)

  • Fixed space handling around axis_label, axis_text and axis_ticks when the ticks are turned off.

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

  • Fixed bug where theme(legend_background=element_blank()) messed up the position of the legend, instead of only removing the background.

  • Fixed using facet_grid with a column named key. (#734)

  • Fixed using legend when using an identity scale and reordering the breaks. (#735)

  • Fixed drawing the upper outline of geom_ribbon. (#728)

  • Fixed issue where the gridlines overlap the panel border. (#638)

Enhancements

  • All __all__ variables are explicitly assigned to help static typecheckers infer module attributes. (#685)

  • You can now pickle the drawn matplotlib figures. (#729)

  • The facet titles in the strip_text are now better aligned are appear more centered withing the strip_background.

v0.12.4

06 Nov 11:06
v0.12.4
Compare
Choose a tag to compare

This is a maintenance release with a few changes, see the changelog.

v0.12.3

01 Sep 18:57
v0.12.3
Compare
Choose a tag to compare

A maintenance release. See changelog.

v0.12.2

21 Jul 09:35
v0.12.2
Compare
Choose a tag to compare

This release is exactly the same as the last one (v0.12.1), except that it requires 0.9.0 <= mizani < 0.10.0, whereas the last one requires 0.9.0 <= mizani.

v0.12.1

10 May 08:30
v0.12.1
Compare
Choose a tag to compare

(2023-05-09)

New Features

  • A layout manager. Now you do not have to adjust spacing parameters to prevent objects around the panels from overlapping. Specifically, you can:

    1. Set the legend position to "top", "left" or "bottom"
    2. Use a large or multiline plot title
    3. Use a large or multiline plot caption
    4. Use facet_wrap with scales="free" scales="free_x" or `scales="free_y"

    You can now also align the plot_title, axis_title_x, axis_title_y and plot_caption with respect to the panels. Set these to "left", "right" & "center" for the horizontal flowing text. And "top", "right" & "center" for the vertical flowing text.

    Also, the size of the figure is exactly determined by the theme setting. For example, this:

    theme(figure_size=(8, 6), dpi=100)

    will create an 800px x 600px image.

  • You can create a subtitle using labs and style it using the plot_subtitle parameter to theme.

theme(plot_subtitle=element_text(size=8))

Enhancements

  • ggplot object gained a new method save_helper(). It gives you access to the matplotlib figure that will be saved to file.

  • When plotting with an ipython interactive backend (e.g. in a jupyter notebook). The default image output is retina. You do not need to run this command.

    %config InlineBackend.figure_format = "retina"

    Plotnine still respects any values set the user.

  • In an interactive setting, after drawing an image. The size of the figure (in pixels) is printed e.g. <Figure Size: (640 x 480)>. Previously, something like <ggplot: (336175301)> was printed.

API Changes

  • __add__() and __iadd__() now accept the same types of objects. In this change __iadd__() has gained the ability to accept a list of objects.
  • draw() no longer accepts the argument return_ggplot and the return value is always a matplolib figure.
  • Themeables strip_margin, strip_margin_x and strip_margin_y have been renamed to strip_align(), strip_align_x() strip_align_y() repectively.
  • subplots_adjust has been deprecated. You no longer need to use theme(subplots_adjust={"right": 0.85}) and the like to make space for the legend or text around the panels. In the future, this will through an error.
  • Changed default font-family (san-serif) from DejaVu Sans to Helvetica.

Bug Fixes

  • Fixed bug where a discrete position scale failed when mapping an empty variable. (#647)
  • Fixed bug where facet_grid with a datetime column run into an exception. (#629)
  • Fixed bug where geom_violin with facetting and "scales = free" did not work. (#655)
  • Fixed bug in position_dodge2 to work with preserve="single" for geom_rect and any other geoms that accept a min-max range along the x-axis.
  • Fixed legend for geom_point to accurately display transparent fill colors that have been manually set. (#665)
  • Fix issue where infinite limits for the x or y scales lead to an exception. (#664)
  • Fixed geom_text and geom_label when used with string formatting so that missing values are removed. (#651)

v0.10.1

29 Sep 12:43
v0.10.1
Compare
Choose a tag to compare

See the changelog.

v0.10.0

29 Sep 12:42
v0.10.0
Compare
Choose a tag to compare

See the changelog.

v0.9.0

29 Sep 12:44
v0.9.0
Compare
Choose a tag to compare

See the changelog.

v0.8.0

25 Mar 12:57
v0.8.0
Compare
Choose a tag to compare

API Changes

  • How you map to calculated aesthetics has changed. Use the
    ~plotnine.aes.after_stat function. The old methods 'stat(name)'
    and '..name..' have been deprecated.

New Features

  • You can now map to aesthetics at three different stages. See
    ~plotnine.aes.aes, ~plotnine.aes.after_stat,
    ~plotnine.aes.after_scale and ~plotnine.aes.stage.
  • ~plotnine.geoms.geom_violin gained the a new parameter style
    with which you can draw half violin (density curve on one side and
    flat on the other).
  • Added ~plotnine.geoms.geom_raster.
  • geoms gained new parameter raster for the
    ~plotnine.layer.Layer. You can use it to rasterize any layer when
    the resulting plot is of vector format e.g. pdf.

Bug Fixes

  • Fixed issue where some plots with a colorbar would fail for specific
    themes. (424)
  • Fixed ~plotnine.geoms.geom_map to plot MultiLineString geom
    types.
  • Fixed ~plotnine.geoms.geom_text to allow any order of mapping
    and data positional arguments.
  • Fixed bug were the plotted image may have ignored theming that
    relied on some Matplotlib rcParams. (451)
  • Fixed the weight aesthetic in ~plotnine.geoms.geom_boxplot,
    previously ignored it is now recognised. (438)
  • Fixed ~plotnine.geoms.annotation_logticks and
    ~plotnine.geoms.annotation_stripes to work without global data and
    aesthetics. (469)
  • Fix ~plotnine.scales.scale_shape_discrete when print many unfilled
    shapes not to assign the same shapes to more than one group. (473)
  • Fixed bug in ~plotnine.stats.stat_ellipse where the center of the
    ellipse assuming a multivariate t-distribution was incorrectly
    calculated. (493)
  • Fixed calculation of ndensity in ~plotnine.stats.stat_bin.
    (494)

Enhancements

  • Manual scales now match the values of the breaks if the breaks are
    given. (445)

  • Using print to show a ggplot object will not show the hash
    (<ggplot: ...>) anymore. There is now a difference between
    repr(p) and str(p). (453)

  • Added option to for the base_family of a theme, now you can set it
    once with and have it be applied to all themes. (436)

    from plotnine.options import set_option
    set_option('base_family', 'Comic Sans MS')
  • You can now add None to a ggplot, doing so returns a copy of the
    the ggplot object. (474)

  • Better handling of multiline facet labels. (484)