Skip to content

Releases: has2k1/plotnine

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)

v0.7.1

05 Aug 20:10
v0.7.1
Compare
Choose a tag to compare

v0.7.1 is a small bugfix and maintenance release. See the official changelog for details. A copy of the changes is also copied below.


Bug Fixes

  • Fixed issue where a plot has no data and the geoms have no data, but the mappings are valid. (404)
  • Fixed preserve='single' in plotnine.positions.position_dodge and plotnine.positions.position_dodge2 to work for geoms that only
    have x aesthetic and not xmin and xmax e.g plotnine.geoms.geom_text.
  • Fix regression in v0.7.0 where plots with a colorbar would fail if using ~plotnine.themes.theme_matplotlib.

v0.7.0

05 Jun 13:11
v0.7.0
Compare
Choose a tag to compare

This is a large release with many bug fixes and enhancements. See offical changelog. A version of the changes is included below.]


API Changes

  • Changed the default method of caculating bandwidth for all stats that use kernel density estimation. The affected stats are stat_density, stat_ydensity, and stat_sina. These stats can now work with groups that have a single unique value.

  • Changed plotnine.scale.scale_colour_continuous to refer to the same scale as plotnine.scale.scale_color_continuous.

  • Changed plotnine.scale.scale_color_cmap so the parameter cmap_name refers to the name of the color palette and name refers to the name of the scale. (GH371)

New Features

  • aes got an internal function reorder which makes it easy to change the ordering of a discrete variable according to some other variable/column.

  • stat_smooth can now use formulae for linear models.

Bug Fixes

  • Fixed issue where a wrong warning could be issued about changing the transform of a specialised scale. It mostly affected the timedelta scale.

  • Fixed plotnine.geoms.geom_violin and other geoms when used with position='dodge' not to crash when if a layer has an empty group of data.

  • Fixed bug in plotnine.geoms.geom_path for some cases when groups had less than 2 points. (GH319)

  • Fixed all stats that compute kernel density estimates to work when all the data points are the same. (GH317)

  • Fixed issue where setting the group to a string value i.e. group='string' outside aes() failed due to an error.

  • Fixed issue where discrete position scales could not deal with fewer limits than those present in the data. (GH342)

  • Fixed issue with using custom tuple linetypes with plotnine.scales.scale_linetype_manual. (GH352)

  • Fixed plotnine.geoms.geom_map to work with facets. (GH359)

  • Fixed plotnine.position.jitter_dodge to work when color is used as an aesthetic. (GH372)

  • Fixed plotnine.geoms.geom_qq to work with facets (GH379)

  • Fixed skewed head in plotnine.geoms.arrow when drawn on facetted plot (GH388)

  • Fixed issue with plotnine.stats.stat_density where weights could not be used with a gaussian model. (GH392)

  • Fixed bug where guide_colorbar width and height could not be controlled by legend_key_width and legend_key_height. (GH360)

Enhancements

  • You can now set the bandwidth parameter bw of stat_ydensity.

  • Parameters ha and va of geom_text have been converted to aesthetics. You can now map to them. (GH325)

  • All themes (except theme_matplotlib) now do not show minor ticks. (GH348)

v0.6.0

21 Aug 18:19
v0.6.0
Compare
Choose a tag to compare

This release has many changes, check out the changelog. A version of the changes is included below.


API Changes

  • The draw parameter of geom_map has been removed. Shapefiles should contain only one type of geometry and that is the geometry that is drawn.

  • Ordinal (Ordered categorical) columns are now mapped to ordinal scales. This creates different plots.

  • The default mapping for the computed aesthetic size of stat_sum has changed to 'stat(n)'. This also changes the default plot for geom_count.

New Features

  • geom_text gained the adjust_text parameter, and can now repel text.
  • Added annotation_logticks.
  • Added geom_sina
  • Added scales for ordinal (ordered categorical) columns.
  • geom_step gained the option mid for the direction parameter. The steps are taken mid-way between adjacent x values.
  • Added annotation_stripes.

Bug Fixes

  • Fixed bug where facetting would fail if done on a plot with annotation(s) and one of the facetting columns was also a variable in the environment.

  • Fixed bug where coord_flip would not flip geoms created by geom_rug (GH216).

  • Fixed bug where plots with theme_xkcd cannot be saved twice (GH199)

  • Fixed bug that made it impossible to map to columns with the same name as a calculated columns of the stat. (GH234)

  • Fixed bug in geom_smooth that made it difficult to use it with stats other than stat_smooth. (GH242)

  • Fixed bug in position_dodge where by bar plot could get thinner when facetting and useing preserve = 'single'. (GH224)

  • Fixed bug in coord_trans where if the transformation reversed the original limits, the order in which the data was laid out remained unchanged. (GH253)

  • Fixed bug in stat_count where float weights were rounded and lead to a wrong plot. (GH260)

  • Fixed bug where one could not use the British spelling colour to rename a color scale. (GH264)

  • Fixed bug in lims, xlim, and ylim where datetime and timedelta limits resulted in an error.

  • Fixed bug where geom_rect could not be used with coord_trans. (GH256)

  • Fixed bug where using free scales with facetting and flipping the coordinate axes could give unexpected results. (GH286)

  • Fixed unwanted tick along the axis for versions of Matplotlib >= 3.1.0.

  • Fixed geom_text not to error when using hjust and vjust. (GH287)

  • Fixed bug where geom_abline geom_hline and geom_vline could give wrong results when used with coord_trans.

  • Fixed bug where layers with only infinite values would lead to an exception if they were the first layer encountered when choosing a scale.

Enhancements

  • Legends are now plotted in a predictable order which dedends on how the plot is constructed.

  • The spokes drawn by geom_spoke can now have a fixed angle.

  • Aesthetics that share a scale (e.g. color and fill can have the same scale) get different guides if mapped to different columns.

  • When the transform of a specialised (one that is not and identity scale) continuous scale is altered, the user is warned about a possible error in what they expect. (GH254, GH255)

  • The method_args parameter in stat_smooth can now differentiate between arguments for initialising and those for fitting the smoothing model.

  • position_nudge can now deal with more geoms e.g. geom_boxplot.

  • The limits parameter of scale_x_discrete and scale_y_discrete can now be a function.

  • The width of the boxplot can now be set irrespective of the stat.

  • The mid-point color of scale_color_distiller now matches that of the trainned data.

  • The way in which layers are created has been refactored to give packages that that extend plotnine more flexibility in manipulating the layers.

  • You can now specify one sided limits for coordinates. e.g. coord_cartesian(limits=(None, 10)).

  • All the themeables have been lifted into the definition of theme so they can be suggested autocomplete.