- fix
scale_x/y_log2/10
when using it on scales that ‘appear’ to be discrete based on their data. It was missing the boolean to indicate that a fixed discreteness is set
- update datamancer dependency for the fix of
arrange
in SciNim/Datamancer#68 for issue #180 - make sure to set black font as default for TOML theme customization
- make ggplotnim compile with
--styleCheck:error
(PR #182 by @c-blake) - add a
{.booldefine.}
variable to quiet ggplotnim when converting integers to floats,const ggPlotDebugTypeInfer {.booldefine.} = false
. Compile with-d:ggPlotDebugTypeInfer=true
to enable the info messages (old behavior) (PR #179 by @c-blake)
This release is a rather big one. The majority of features added
relates to customization of plots.
Theme
related improvements:
baseLabelMargin
field to adjust the default range between tick labels and labels in cm.- allow adjustment of plot size via
Theme
- adjustment of annotation font via
Theme
- scale grid lines via
Theme
- add
themeLatex
, a very useful helper when producing PDF plots via TikZ where the actual target is a TeX file. Its argumentfWidth
combined withwidth
(in pixel),textWidth
(in pt of the actual\textwidth
of the LaTeX document to be inserted) it allows to exactly specify font sizes of plots such that they match a given size in the resulting PDF. E.g. a plot to be inserted at0.9\textwidth
usingfWidth = 0.9
, a plot size of e.g.width = 600
pixel (for the standalone plot) and atextWidth
of450 pt
(LaTeX pt) produces a resulting PDF after inserting the plot at the0.9\textwidth
that matches exactly the font sizes given byggplotnim
. ThebaseTheme
is an argument of a procedure that returns the desiredTheme
to be used as a base.singlePlot
andsideBySide
are twobaseTheme
procedures that produce nice looking graphs when inserting as a single or 2 side-by-side setup in a TeX file.
- add
coord_fixed
option that creates the actual data portion of the plot in fixed ratio. E.g. an argument of1.0
creates a plot of user givenwidth
where the height is computed precisely such that the data portion is of ratio 1:1. Useful for physical coordinates in a plot to correspond to the desired ratio. - allow setting
useTeX
argument viaTheme
(to enable/disable TikZ backend) - allow hiding x or y labels individually
- adjust styling of ridgeline plots
- add
cool
colormap - fields
discrete/continuousLegendWidth/Height
fields toTheme
to adjust the size of continuous / discrete legends - add helper to add two
Themes
via+
- respect user set margins in facet plots
- add
tomlTheme
to set a theme at runtime from a TOML file. Example given in PR description (PR #176) - draw histograms as lines in discrete legends
- add
hideTitle
to disable title (among otherhide
procedures) - add
dataAsBitmap
feature for Cairo, TikZ backend. In a vector graphic target will draw all the actual data as a PNG, similar to in a raster plot. This makes plots with large amounts of data as a vector graphic feasible. - make
aes
arguments to initialggplot
call optional. This of course implies arguments togeom_*
calls are mandatory. There is a chance this is a breaking change in some contexts and decreases CT safety to some extent. But it can be very useful when combining different geoms that don’t share column names as well as using different aesthetics. - add experimental (CT + RT) option
WritePlotCsv
. If compiled with-d:WritePlotCsv
and then aWRITE_PLOT_CSV=true
environment variable set,ggplotnim
will write CSV files for every plot produced. The filename is the filename of the plot with.csv
suffix. For each geom that has a separate dataframe an extra CSV file is produced. This allows for easy sharing of data that is used to produce a plot. - add
TEXT_PRECISION
environment variable check forgeom_text
to adjust the precision used for floating point numbers. - allow assignment of facets in user given order by
order
argument tofacet_wrap
- add option
gradient
opposite tofactor
to force an aesthetic argument to be continuous - adjust data scale in
scale_fill/color_continuous/gradient
procs - allow annotations to be placed at
top/right
positions in addition toleft/bottom
- fixes to raster plots with other geoms resulting in bad data ranges
- better support for histograms with minimal values != 0
- use
expandTilde
inggsave
- improve logic detecting discreteness of arguments
- better exception message when color parsing fails
- refactoring of facet logic
- fixes to legend heights in some setups
- better date logic for non facet plots
- allow adjustment of title position in relative coordinates using
titlePosition
- allow adjustment of tick style using
tickLength
,tickWidth
,tickColor
andtickKind
- adds
tickLength
argument tox/ylab
- adds
- allow adjustment of legend title font and legend tick label font
using
legendFont
- allow adjustment of font and placement of text in facet header using
facetHeaderText
- add experimental
theme_scale
to scale up/down all fonts / tick sizes etc. by a factor. Useful to effectively change the DPI of the figure. - add experimental
theme_font_scale
which acts liketheme_scale
, but does not adjust the base scale (related to scaling the margins) - allow to assign custom order in
facet_wrap
based on aorder: seq[Value]
argument - add new feature helping with reproducibility of plots:
If compiled with
-d:WritePlotCsv
ggplotnim
now provides the option to automatically write out CSV files for input DF for each plot that is created (if enabled via environment variableWRITE_PLOT_CSV=true
). Also all DFs associated with individual geoms will be written with a geom specific suffix. - fix
geom_raster
when used in conjunction with another geom that has a larger data range - allow adjustment of margin used by default between the tick labels
and the labels. Default is 0.3 cm, can be changed using
baseLabelMargin
proc /Theme
field - improve logic for histograms in the case where the minimum viewport
is not 0, which can happen for custom
ylim
calls (for example for manual log10 histograms viastat = "identity"
)
- handle geom calls with constant values better. Previously we
sometimes ended up drawing the same e.g. text multiple times, once
for each input DF row. We now deduplicate for cases where
x
andy
are constant.
- do not change the top margin of a plot based on a legend being added anymore. That’s kind of jarring.
- add
scale_fill_log10
for log10 raster scales x/ylim
now ignore input range values if the values are the same. This is to support code that takes the ranges from a variable to support the case of a default e.g.(0, 0)
argument
- make SDL2 backend a full submodule that can be imported using
import ggplotnim/ggplot_sdl2
-d:experimentalSDL2
is still supported and imports/exports the module for you- allow to also save a plot at the same time as showing it, by handing
a filename argument to
ggshow
- update
ginger
dependency tov0.5.0
. This fixes our previously still not quite correct placement of text which relied on string width/height information. Now it is also correct on the TikZ backend
- do not crash SDL2 viewer when resizing the window too much
- implement panning (left mouse button), mouse wheel zooming. Zooming to a rectangle moved to the right mouse button
- allow resizing of the SDL2 window
- create the plot using the sizes given to
ggshow
- handle resizes of the SDL2 window
This adds a very experimental and basic SDL2 interactive backend.
Simply compile your program with `-d:experimentalSDL2`. It makes `ggshow` available (which takes the size of the SDL2 window as optional arguments).
It creates an SDL2 window of the plot (and pauses the main thread). The only interactivity supported at the moment is zooming using the mouse. Click and hold on a rectangle zooms to that rectangle and a single click reverts the zoom.
Note: we do not catch exceptions due to invalid data ranges etc at the moment. Experiment at your own risk. :)
- add support for
geom_density
via arraymancer’s KDE implementation - add
timeZone
option toscale_*_date
This adds aTimeZone
field to the date scales and uses it to set the labels for them. Further, it fixes a few small issues with the date algorithms and how they assign the formatting to the correct dates. - make legend markers reflect usage of markers beyond
geom_point
. Also supports lines and tiles now. - fixes an issue with facet plots containing a discrete scale causing a runtime error trying to compute margin ranges
- add
alignKind
toAnnotation
, allowing the text to be aligned accordingly - allow alpha channel in
geom_raster
- allow
nnkPrefix
inaes
macro - update
ginger
dependence tov0.4.3
- update
seqmath
dependency tov0.1.16
, ref issue #163
- support
weights
ingeom_bar
, previously it was ignored
- give all
GeomKind
fields a name representing thegeom_*
procedure used to create them (lossy though, not allgeom_*
procedures haveGeomKinds
- throw exception if no
y
scale given when needed and when given if not needed - fix issue with Vega backend where we tried to look up internal scale
- fixes discrete stacked plots on the Vega-Lite backend
- avoids showing the internal naming scheme of DF columns in Vega-Lite
plots & makes sure any user defined axis label via
xlab
/ylab
are used
- minor improvements to the Vega-Lite backend:
- adds a docstring to
ggvega
- cleans up the write file implementation to be more safe & useful
- allows to not show a plot even if an HTML file is generated
- allows to specify pretty JSON output even for HTML files
- raises an exception if neither HTML or JSON is desired
- allows to change the backend to using a browser.
- adds a
toVegaHtml
which can either generate only the Vega body or vega in a full HTML. In the former case it can be embedded later usingembedVegaBody
. - further adds options to change the version & CDN settings.
- adds a docstring to
- make
ggplotnim
work withstrictEffects
, PR #151
- update to Datamancer
v0.3.0
, which adds experimental support for “generic” types. This only makesggplotnim
compatible with it, but does not allow generic types inggplotnim
yet! - cleans up
SecondaryAxis
logic as a side effect by introducingPossibleSecondaryAxis
- add missing
scale_y_discrete
that takes explicit labels
- allows to customize the margin between tick labels and their ticks
via the
tickMargin
argument tox/ylab
- further fixes for missing color scales when using
scale_fill/color_continuous
- fixes an issue with reference semantics messing up plots in certain cases when user given formulas modified the input DF in a certain way between different geoms
- add
backend
argument toggsave
to allow choice of backend, e.g. to use pixie backend - replace usages of
seqsToDf
bytoDf
- let
backgroundColor
,canvasColor
,gridLineColor
take aPossibleColor
to support string based colors - add
onlyAxes
argument togridLines
&Theme
object to allow to only draw axes instead of the full grid (needs gingerv0.3.13
)
(as is usual, a hotfix is always coming quickly....)
- fixes a regression for continuous color scales, where if
scale_color/fill_continuous
was used, we ended up without a color scale indrawCb
- makes sure the indexing of the color scale for raster plots actually uses the number of available colors instead of 256 values
- add support for custom (and customized) colormaps
- add additional
inferno
,magma
,plasma
colormap - add two recipes about colormaps:
rColormaps.nim
: a comparison about the available colormapsrCustomColormap.nim
: a recipe showing how to modify an existing colormap / provide a custom one
- add
scale_fill/color_gradient
function to assign such color maps to a plot - allow to customize layout in
ggmulti
plot (subplots of fully separate plots):- allow so set custom widths and heights for the rows / columns
- allow to prefer columns over rows and vice versa for the layouting
(by adding a
prefer_columns()
orprefer_rows()
call to the plotting chain)
ggplot
call now allows widths and heights not only asfloat
value, but any number- add
alpha
as a validScale
(allows setting & mapping alpha) - add the following scale functions:
scale_size/alpha_discrete/continuous
: force given size / alpha scales to be discrete / continuousscale_color/fill/size/alpha_identity
: force the given correspondingaes
scale to be treated as containing values to set the scale, i.e.:import ggplotnim let df = toDf({ "x" : @[1, 2, 3, 4], "y" : @[1, 2, 3, 4], "colors" : @["red", "green", "blue", "#FF00FF"]}) ggplot(df, aes("x", "y")) + geom_point(aes = aes(color = "colors"), size = 12.3) + scale_color_identity() + ggsave("/tmp/colors_manual.pdf")
i.e.:
aes
thecolor
scale, then say that givencolor
is actually a scale to set values based on the column directly, instead of performing automatic mapping based on the number of distinct labels.
- major change in how
geom_*
procedures deal with setting scales: see the description of PR #143 for what this implies. Short version: one can now hand arguments for e.g.size
,alpha
,color
, … as nonOption[T]
values (e.g. see thesize
argument in the code snippet above). Also explicitstring/int
values are now supported for colors. - add
-d:nolapack
compilation option to remove LAPACK dependency. This disables support forgeom_smooth
- add option to draw minor grid lines (thinner lines between major ones that have a tick & tick label associated)
- add customization options for grid lines, enable / disable, width and color of (minor) gridlines
- add
scale_fill_discrete
to force a fill scale to be discrete - replace
numX/YTicks
logic fromggplot
procedure by better handling as a field of aScale
object - add
breaks
arguments to multiplescale_x/y_*
procedures to specify either the number of desired ticks along the axis or specific tick locations. Supports any continuous scale and date scales. - update dependency of datamancer to v0.1.11 due to CSV change relevant for periodic table recipe.
- update ginger dependency to
v0.3.10
- improve text placement of x labels (in particular of relevance for TikZ)
- the
ggplot
procedure now takes an optionalbackend
argument for use cases when not usingggsave
(e.g. for testing or when creating multiple plots in a single viewport). Due to makingginger
less backend dependent - adds a
generateAll
nimble task to generate all data required for tests & CI
- add support for more shapes when using
geom_point
(9 shapes in total now)
- add
ggvega_tex
, a saving helper that generates the same plot both as a TikZ LaTeX native file (as a.tex
) as well as a Vega-Lite plot in form of a.json
file - add a LaTeX theme (mainly different font sizes than default).
- fix performance regression when plotting stacked histogram (default, also applies to non mapped histograms) in particular for large input DFs
- fix
geom_smooth
internal handling when filling smoothedFilledGeom
objects to raise if input data is considered discrete. This is incompatible with smoothing statistics. - improved the info messages for automatic determination of discreteness of the input data based on @haxscramper’s input.
- add
backgroundColor
to change the color of the plotting area manually - add
gridLineColor
to change the color of the grid lines manually
- adds support for generation of native LaTeX plots using
ginger's
TikZ backend - adds a recipe showcasing the TikZ backend:
rTikZLandau.nim
- combining
stat = "count"
with a continuous classification now yields a runtime exception, explaining that it’s not well defined. - allow to rotate annotations. Note: if combined with a non transparent background, the background and text are not correctly aligned at the moment (rotation happens around different points for each object).
- add
scale_x/y_date
to create ticks and labels according to sensible date time values. - add
geom_smooth
to smooth noisy data. Two smoothers are currently implemented:- Savitzky-Golay filter (often also called “LOESS” or local regression)
- polynomial fit.
With Levenberg-Marquardt fits to be implemented soon (possibly via a C dependency on
mpfit
in the beginning though) - add
geom_smooth
reciperGeomSmooth.nim
- add
geom_smooth
reciperLinearFit.nim
showcasing how to use polynomial smoothing of order 1 for linear fits to the data. - add recipe showing how to create date time based custom ticks and
labels
rScaleXDate.nim
.
- add
ggmulti
helper that takes multipleggplot
calls and puts them onto a grid of plots (not as a facet etc. but simply multiple, unrelated plots) - remove datamancer leftover (hashes of
FormulaNode
) - fixes error bar issue #94 by upstream fix in ginger
- fixes error bar plots drawing to 0 value if min / max missing, fixes #122
- avoids drawing multiple constant lines in
geom_linerange
by filtering to unique row pairs, fixes #124
- make shallow copies of all input data frames
- fix issue #99 by doing a rewrite of the stacking logic. Handled in post processing stage now and data is stored in DF (same as for counts)
- fix issue that last bin edge showed up as points etc. if using points together with a histogram
- fix drawing of frequency polygon lines, now take into account bin width to close of the final lines on each site
- hdOutline histograms can now be drawn correctly as stacked histograms (but if using alpha they are still visible behind the other bars!)
- removal of the internal dataframe. This has been made a standalone package: Datamancer
- runtime errors regarding empty columns, determination of discreteness and DF columns with object like data have been improved significantly. Added info messages for auto determination of types.
- floating point columns are now always treated as continuous columns
by default (which is a breaking change). To overwrite use
scale_x/y/..._discrete
or simplyfactor(col)
inaes
. Fixes issue #91. - changes the default background color from transparent to white (ref #117). Thanks @pietroppeter for the feedback!
- major rewrite of the formula macro. Behavior is essentially the same, but more robust, generalizes better and fully working index / column specification and much better automatic type deduction.
filter
can now take a scalar (reducing) formula returning a bool. Useful in combination with agroup_by
call- fixed stacking of histograms in case of
hdOutline
(“lowest” element was ignored) readCsvTyped
is now the default CSV parser
- fix issue #110; facets now support multiple geoms in one facet plot
- add classifying using shapes (marker kind & line shape). However, only 2 marker kinds are implemented at this point. Multiple line shapes exist at least.
- build foundation to support arbitrarily scaled secondary axes. This feature is not working for most transformations yet, due to the implementation of how transformed ticks are computed.
- better handling of ticks
- secondary axes can now be a transformed version of the primary axes
unique
has akeepAll
option, which keeps all column in the resulting DF and not only those for which the unique check is performed- fix bug in
readCsvTyped
for CSV files without an empty line at the end - allow
nnkBracketExpr
,nnkCurly
in formulas - fix issue in
gather
when gathering a DF with multiple column types. Type of the gathered columns took all DF columns into account, even those not gathered. readCsvTyped
now handles rows with more,
than in the header. In that case all columns after the number of columns from the header have been parsed are simply skipped.- add
fillColor
togeom_histogram
. Previously thecolor
argument was used to set both the color (outline) as well as fill color of the drawn histogram. Now those are separate. This is a breaking change though! Makes it easy to set e.g. the outline to transparent by assigning a transparent color tocolor
, but still have a filled body. - change default tick label margin to be based on font height (by default 1.25 / 1.75 for y / x labels)
- fix drawing first bin when histogram using outlines
numX/Y
are now ignored forgeom_raster
and are computed internally- raise an exception if no fill scale present for
geom_raster
- support column to string tensor conversion
This version was accidentally skipped, oops.
- to use
ggvega
importgglotnim/ggplot_vega
(not imported by default anymore) - add a simple Vega-Lite recipe:
rSimpleVegaLite.nim
(this recipe is not part of the CI yet)
- show tick labels for log plots if no full power of 10 visible
- facet_wrap fixes:
- apply tick rotations to tick labels
- use
numXTicks
for x ticks of theGgPlot
object instead of a default of 10 ticks - fix bug affecting range computation in facet wraps if the scales are set to free and an additional global classification was applied
- apply reversal of scales in facet wrap
- allow changing the number of desired ticks in
ggplot
call (differs from ggplot2 where this is done usingscale_*
functions) - apply reversal of x/y scales to discrete axes correctly
- do not ignore number of ticks for log10 scales
- fix issues with
aes
macro for certain ways to call it - add
hideLegend
proc to hide legends even if otherwise drawn - add
color
argument totheme_void
to be able to set different background color on empty themes (joyplots anyone?) - adds asserts to
DataFrame
access (notdoAssert
though, still be careful in danger builds!) - initialize
DataFrame
if trying to assign a column to an uninitialized DF - add missing
alpha
option forgeom_point
- misc. fixes for ARC support:
- avoid
deepCopy
when cloning aDataFrame
(leads to segfaults with laser based arraymancer tensors, which areptr + len
pairs) - allow
column.add
for first argument uninitialized - massively improve raster performance by bypassing almost all slow
code branches for dataframes / large number of different styles
- currently breaks
position
argument for raster plots!
- currently breaks
- export
asgn
proc, which bypasses the length check of the DF one assignes a column to. Can be handy to have outside of the main code base for optimization purposes. - add
[]=
taking a filteringFormulaNode
and key and assigning a constant value to each matching row, e.g.df[f{`colA` > x and `colB` < y, "colC"] = z
- add
add
proc taking a tuple to add a single row to a DF. Warning, this reallocates every tensor in the DF with length + 1. Only use this for very few adds. - misc style fixes
- adds new drawing option for histogram, by drawing histograms as
outlines:
Adds the option to draw histograms either as individual bars, which sit right next to each other (hdBars) or as a line showing the outline (hdOutline).
The latter is useful if one wants to avoid aliasing / moiré like effects of individual bars (some white visible between touching bars).
Also if one wishes to draw histograms using some alpha (or without any fill at all) not seeing the individual bars might be desirable.
The default remains drawing individual bars for now.
- histogram: line width of the outline is now customizable
- add
scale_*_log2
- make transformed data more general by adding inverse transformation, which allows for arbitrary user definable data transformations
- add
scale_color_continuous
to control value range of continuous color (scColor
instead ofscFillColor
) - add
map
,map_inline
forColumn
for simple convenience.map_inline
tries to “determine” the type of the operation automatically, but this means we compile a runtime exception for branches ofmap_inline
that are not supported, e.g. ac.map_inline(a + b)
will raise ifc
is actually a string column - add
showVega
webview viewer: ggvega now works in the following way:- no argument given: open the file as webview with the HTML stored in the tmp directory as `vega_lite_plot.html`
- filename given:
- if filename ends with `json`: store json in given filename, do not
open a vega view
- if filename does not end with `json`: store HTML in given filename
and open webview
- add
facetMargin
proc to control the used margin in a facet plot - make
mutate/transmute
work on grouped dataframes by acting on each group with each formula instead of the whole DF - miscellaneous code reorderings and refactoring
runRecipes.nim
is partially deprecated. Instead of compiling and running each recipe individually, we now haveallRecipes.nim
, which simply imports all recipe files and thus replaces N compilations by 1.- replace Travis CI by Github Actions
- we now run CI on Linux, OSX and Windows. Note that OSX and Windows result in slightly different plots due to differences in fonts. Thus, some tests are not as stringent (or disabled) on these platforms
- docs are now autogenerated
- added new recipes:
rHistogramOutline
: showases drawing histograms as outlinesrRidgeLineGauss
: a simple example of a ridgeline plot as well as showcasing that formulas can be applied to each labels of a classified geomrRidgeLineGaussBlack
: the same plot in “prettier”rJoyplot
: the same plot again, this time as a full “Joyplot”
evaluate
can now evaluate a formula of kindfkScalar
. This is useful to get a Column with a single element from a reduce operation and comes into play when using a reduce operation for an aesthetic, e.g.x = f{mean(`someCol`)}
- fix a bug that causes the
arrange
proc to mess up sorting if more than one key is used. The last row of the DF was not sorted before and thus remained in unsorted order at the end of the sorted result. geom_errorbar
now takes anerrorBarKind
field to set the kind of errorbar to drawebLinesT
,ebLines
are the only two options atm
- add
scale_fill_continuous
to force the fill scale to be interpreted as continuous values ggsave
will now create the directories contained in the path given to it instead of silently not creating a plot if the path to the given file does not exist yet.- attempt to get rid of duplicate legends in case of certain ggplot calls
- fix bug causing accessing
labs
sequence for log10 tick values, in case the tick labels were hidden (e.g. log10 facet_wrap). - add experimental
legendOrder
proc to reorder the elements in a legend by a permutation of the “correct” order. Not the most user friendly and untested. - add automatic wrapping of long lines in the title of a plot
- support manual wrapping in the title of a plot
- allow
nnkCommand
nodes foraes
macro
- allow setting custom margin of the plot using
margin
- add recipe for custom margins:
rCustomMargins.nim
- add
scale_fill/color/size_manual
to provide custom colors / sizes for such mappings - add a recipe showing custom fillings,
rCustomFill.nim
- add
drop_null
to dropVNull
values from a single or multiple columns in a data frame - add
toNativeColumn
, which attempts to convert an object column to a native column
- add geom raster for efficient drawing of evenly spaced tile maps (e.g. many pixel heatmaps)
- make code ready for
--gc:arc
by removingdeepCopy
calls - allow real constant columns in data frame (only store a single value), which behave like real columns
- slight code clean up
- data frame meta information now returned by pretty instead of being echoed
- data frame now uses
OrderedTable
to properly keep order of keys - fix setting custom limits on facet wrapped plots
- add 3 new recipes:
rPointInPolygons.nim
: a random recipe that came up as an idea during a discussion. Calculates whether points are in a polygon and draws them with a color depending on thatrSimpleRaster.nim
: a simple example of a 256x256 pixel rasterrFacetRaster.nim
: an example of plotting two 256x256 pixel rasters in a facet
- hotfix release to unbreak Nim CI
-> fixes a regression due to an additional field in ginger, for
which by default no
%
is provided in json.nim
- make
aes
a macro- allows for named / unnamed arguments
- raw identifiers will be interpreted as strings, if not symbol is declared with the identifiers name
factor
can be applied to an argument to force this scale to be discrete. For every scale that is not x/y this wasn’t possible (for x/y viascale_x/y_discrete
)
- provide better error messages for some mixtures of geoms + continuous scales
GgPlot
is not a generic anylonger. Originally the idea was to provide support for multiple data types, but nowadays the code base is too intertwined with theDataFrame
that this doesn’t make sense anylonger and in fact produces problems (e.g. “undeclared identifier” when combining implicit generic + template)- fix for Nim devel regarding change of named / not named tuples
- avoid usage of
random
which is now removed on devel
Hotfix for Nim devel by @timotheecour. Fixes issues regarding lent iterators.
- fix bug in
add
for data frames if first argument was stillnil
- allow multiple types in
innerJoin
, requirement is that columns to be combined are compatible (mainly means int + float -> float) - add some tests for
innerJoin
- add support for weighted bin count statistics (
weight
field for e.g.geom_histogram
) - add suport for
density
computation when using bin count statistics (density
argument togeom_*
procedures) - add two recipes:
rWeightedHistogram.nim
: histogram of carat of diamonds weighted by pricerHistogramDensity.nim
: histogram of carat of diamonds as a density instead of counts
Hotfix for broken CI, due to one recipe rFormatDatesPlot.nim
being
dependent on time recipe is being run.
- tick labels can now be provided to
scale_x/y_discrete/continuous
via a callback, PR #70 by @cooldome - adds two recipes:
rFormatDecimalsPlot
: example to provide custom formatting for decimals in tick labelsrFormatDatesPlot
: example to provide custom formatting for dates as tick labels
- hot fix for
nimIdentNormalize
usage in1.2.x
by accident (only available from1.3.x
)
facet_wrap
is finally back! Now finally allows to fix / not fix the scale of each subplot and wrap by multiple columns.- fix pretty printing of
VObject Value
- add
toObject
overload forValue
taking(string, Value)
- add
contains
for Value in Value, which checks whether oneVObject
contained in another yieldData
ofFilledGeom
is now keyed only by thelabel (VObject Value)
comprising the discrete values of N columns for the given object, instead of baseStyle + label. This allows to access a specific style / data frame for a given label (ridgeline plots + facet need this).handleTicks
now still creates ticks and labels ifhideTickLabels
is true, but doesn’t assign them to the viewport. This way they can still be accessed to e.g. draw grid lines.handleTicks
now handles custom marginsfacet_wrap
now also takes raw strings and ascales
argument, which is used to fix the scales of all plots in a facet_wrap to the same scale or leave them free.Theme
now hasx/yTickLabelMargin
fields to customize margin for x and y tick labels (currently not exposed, used internally for facet plots, create Theme manually and set them if required).- add
BinByKind
/binBy
field forstatKind="bin"
to allow binning to happen only on the current subset of data that is actually considered. Useful if the data is in multiple different ranges and binning should happen according to those ranges. - the count column after a histogram call is now not always an object column. The last value contains the right most bin edge, the count column is now filled with a 0.
gather
can now again gather columns of different data types again (int + float is merged to float, other combinations to object colunms)fn {}
formula syntax can now deal withnnkTableConstr
(effectively allows type hints)- now only a single list of recipes to test / run in
recipes/recipeFiles.nim
, which is used in comparison test andrunRecipes.nim
ggjson
helper with same signature asggsave
to allow dumping final plot viewport to JSON file (used for CI)- all recipes are now compared as JSON files!
- add two more recipes:
rSimpleFacet.nim
: simple facetting example using mpg datasetrFacetTpa.nim
: facetting example using TimepixAnalysis data
- allow creation of colunms from other int and float types (other than
int64
andfloat64
) viatoColumn
- allow access of DF columns with mutability (
[]=
returnsvar Column
)
- allow negative values in
geom_bar
andgeom_histogram
if identity statistics is used- add recipe
rNegativeBarPlot.nim
to showcase this
- add recipe
- updates ginger dependency, due to a ginger bug which under some circumstances could cause bugged drawings (e.g. for error bars with “T” like shape)
- fixes #61, by forcing the minimum y value to be 0 for
geom_bar
if identity statistics is being used.
aes
now not only accespts strings, but also numbers, which will also be wrapped in aFormulaNode
of kindfkVariable
. No need to manually create such a formula.- add new recipes:
rAutoColoredNeuralSpikes.nim
: example on how to create neural raster spike plotrCustomColoredNeuralSpikes.nim
: same
- add
scale_x/y_reverse
to reverse the x or y scales. Done by addingFilledScales
fieldsreversedX/Y
, which are set incollectScales
. If any scale is reversed, the plot will be reversed.
summarize
now works reliably on data frames, which have been grouped by multiple columns- fixes a few bugs regarding wrong length scales used
- fixed a possible assertion error, due to unsafe access of an `Option[T]` (wrong field checked in if)
- introduce
StyleLabel
to retain information about styles for discrete labels inFilledGeom.yieldData
. Allows to know which style belongs to which label of a discrete scale. - fix
assignBinFields
to actually use given argument instead ofresult
from caling scope - add theme fields to hide labels, ticks and tick labels
- add
theme_void
, an empty theme. No labels, ticks, tickLabels, grid lines, white background. - use
pretty(Value ...)
for children ofVObject
- do not collect text scales anymore. They’re not used in the post processing stage. Only care about column (note: this may change, if we want to incorporate the string widths / heights into the plot scales!)
- do not crash if no label is present in
handleLabels
yet - add ScaleKind for text:
scText
to not confuse text with x or y axes - plot layout now differs for themes without labels and ticks. Only 0.2 cm on LHS of plot instead of 2.5 cm
handleDiscreteTicks
now takes only labels instead of a fullScale
handleTicks
respectshideLabels
and allows custom number of ticks (to call it from elsewhere, e.g. gradients)handleTicks
can take a custom boundScale. Allows to call it for other uses.- only yield scales that show up as legends by
enumerateScalesByIds
iterator addIdentityData
during collection now preallocates space for data- add ridgeline plots; accessed by applying
ggridges
to a plot. Ridges are not really a geom, but rather a specific feature similar to facets. Essentially an aestheticyRidges
is added, by which is classified. Each labels gets its own ridge. In that ridge every normal kind of plot is allowed (including more classical ridgeline plots) - progress towards supporting –gc:arc. No more
deepCopy
in use. - add (not working yet)
scale_*_reverse
to reverse x and y scales. In principle it does work, but how to hand information to where its needed unclear (add toFilledScales
,GgPlot
, … ?) - add more recipes:
rAnnotatedHeatmap.nim
: example of a heatmap overlaid with textrMultiSubplots.nim
: an example on how to useginger
to combine two plots to one subplotrPeriodicTable.nim
: creating a periodic table as a plot!
- move
font
helper toggplot_utils
- remove spacing between multiple legends. Previously there was 1 cm of space if multiple legends were shown. That took too much space and wasn’t required imo.
- fix classification by multiple discrete scales
- fix issue for discrete scales, which caused index error in
getView
, when a position was moved viabinPosition
- add
width
,height
to scales, which are collected. This was simply missing. - add
geom_text
- add
font
field toGgStyle
object - update
rMultipleLegends
due to spacing between two legends - add recipes:
rSimpleGeomText.nim
rClassifiedGeomText.nim
rAnnotateUsingGeomText.nim
rAnnotateMaxValues.nim
- update
ginger
dependency tov0.1.17
Hotfix release for small regressions introduced in v0.2.18
- fixes the layout of plots discrete axes. Due to recent ginger changes the position of the ticks and tick labels was wrong.
- fixes the placement of
geom_tile
for discrete cases. - updates all plots with discrete axes
- finally fixes multiple legends. Now automatically evenly spaced and centered
- distances of legends / labels to legend are now fixed in absolute
units (thanks to fix in ginger
v0.1.15
) - fix distance of tick labels to ticks, now also in fixed absolute distances (that’s why every plot is updated)
- add
geom_tile
- update all plots due to ginger fixes / placement of tick labels
- most geoms now take an
alpha
argument to override the alpha offillColor
- if a fill color of a line is set, the line is now continued down to the x axis
geom_point
withpositoin = "stack"
now draw points aty = 0
geom_histogram/bar
now draw “empty” elements forposition = "stack"
(setlineWidth
to 0 to make them disappear)- y axes may now be discrete (previously only the x axis could be discrete)
- rewrites drawing code to have less duplication. For some kinds of plots this might (!) incur a tiny performance regression.
- refactors out code related to
- collection and filling of scales: ./src/ggplotnim/collect_and_scales.nim
- postprocessing of scales: ./src/ggplotnim/postprocess_scales.nim
- (most) drawing code: ./src/ggplotnim/ggplot_drawing.nim
- IMPORTANT: there was a bug in
seqmath.histogram
, which is used ingeom_histogram
/ ifstat = "bin"
is used. The bug caused wrong histogram calculations if and only if unequal bin widths were used. Equal bin widhts were fine. This was fixed inseqmath
v0.1.7
- add
geom_errorbar
for plots with error bars in x / y direction - add
geom_linerange
, which are either error bars without an orthogonal line at the end (not “T” shaped, “|” like) or just, well, line ranges. - slight performance increase for large datasets, due to avoiding running over data twice to determine min / max values.
- starts a changelog :)
formula.evaluate[T](node: FormulaNode, data: T): Value
is nowformula.reduce(node: FormulaNode, data: DataFrame): Value
. Generic usage is just clutter.reduce
makes the intent clearer and opens up the name for anevaluate
that returns a full vector- adds
formula.evaluate(node: FormulaNode, data: DataFrame): PersistentVector[Value]
. - The
Scale.col
field is nowFormulaNode
instead ofstring
. This allows for calculations on the DF to use for scales instead of only columns. aes()
is now generic and takes a mix ofstring | FormulaNode
to allow to apply formulas to the DF w/o intermediate calculations on the DF manually. E.g.aes(y = f{"yCol" * 2})
is now valid- improve performance for certain plots with many geoms
- add inplace variants for
select
,mutate
,transmute
(*Inplace
).