Releases: has2k1/plotnine
Releases · has2k1/plotnine
v0.15.3
v0.15.2
v0.15.1
What's Changed
- Do not overwrite labels set with labs by @has2k1 in #958
- Fix changing composition figure size when plot_spacer is the last plot by @has2k1 in #961
- Fix stat_quantile to handle formula that use environment variables by @has2k1 in #964
- Add missing scale_stroke_identity by @has2k1 in #965
- Prefer
_repr_mimebundle_for notebook display by @manzt in #969
New Contributors
Full Changelog: v0.15.0...v0.15.1
v0.15.0
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_xandaxis_ticks_pad_major_yhave been deprecated. Use themarginparameter ofelement_textwithaxis_text,axis_text_xoraxis_text_yto control the spacing between the axis text and the ticks. (#843) - The
statclass methodsstat.compute_layer,stat.compute_panelandstat.compute_groupare now instance methods and they no longer accept**paramsarguments. Access to the parameters is throughself.params. - The
geomclass methodsgeom.draw_layerandgeom.draw_paneldo no longer accept**paramarguments. Access to the parameters is throughself.params. - Method
geom.draw_groupnow accepts theparamsargument 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_positionandplot_caption_positione.g.You can now position thetheme( plot_title_position="plot", plot_caption_position="plot", )
plot_title,plot_subtitleandplot_captionby alignment them with respect to the plot. (#838) - Gained new label
tagto create a tag for a plot. You can set it withlabse.g.and customise it using these themeableslabs(tag="A")
plot_tagandplot_tag_positionandplot_tag_locatione.g.theme( plot_tag="plot", plot_tag_location="plot", plot_tag_position="topright", )
- Geoms
geom_barandgeom_colhave gained new parameterjustthat controls how the bars align with the axis break point. geom_sinahas gained new parameterstylejust likegeom_violin, which make one-sided (half) sina plots.- Gained the Anscombe Quartet dataset,
anscombe_quartet. - Gained new module
plotnine.helpersto be a place for some helper functions. - Gained new helper function
get_aesthetic_limits. geom_pointgained the ability to handle shapes of the formSequence[tuple[float, float]]e.g.Which declares the vertices of a polygon shape.((-2, -4), (-2, -1), (0, 1), (2, -1), (2, -4), (-2, -4))
Enhancements
- Included datasets
mpg,msleepandmidwestno longer have any of their columns as categoricals. This matches the respective datasets in R. (#913) - When the
widthof the violins ingeom_violinis 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_keynow inherits frompanel_backgroundand the default themes have been adjusted to rely on this inheritance. So when using the default themes, alteringfillparameter of thepanel_backgroundwill also affect the background of thelegend_key.- The default value for the
guideparameter for the identity scales (scale_*_identity) has been reverted toNone. This means by default using these scales will not generate a legend.
Bug Fixes
- Fixed bug in with the
legend_key_heightthemeable where it wasn’t applied. (#921) - Fixed bug where justifying
axis_text_xandaxis_text_yusing 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_scaleare were not applied to the legend. (#926) - Fixed theming of minor x axis ticks.
- Fixed theming of
axis_text,axis_text_xandaxis_text_yso when they can be overriden if previously set toelement_blank(). - Fixed
strip_text_x_backgrounds to always have equal heights andstrip_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 affectedtheme_xkcdand anythemesettings 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 affectedtheme_xkcdand anythemesettings that tried to slide the text / background into the panel. - Fixed bug in
geom_histogramwhere mapping to theweightaesthetic lead to an error. (#936) - Fixed bug in
geom_vlinewhere you could not map thexinterceptaesthetic to a discrete variable. - Fixed bug in
geom_hlinewhere you could not map theyinterceptaesthetic to a discrete variable. - Fixed bug in all manual scales (
scale_*_manual) where if you setvaluesto adictthen setting the breaks would lead to an error. (#949) - Fixed using
theme_voidwith facetting so that the strip text are always fully within the figure bounds. - Fixed the ordinal color scales
scale_color_ordinal,scale_color_cmap_dscale_fill_ordinalandscale_fill_cmap_dto handle missing (NaNorNone) values. (#953)
v0.14.6
This release prevents plotnine from pulling in scipy v1.16.0 because it does not play well with statsmodels.
v0.14.5
v0.14.4
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_lengthfor the x-axis had no effect.
v0.14.3
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)