Vindaar / ggplotnim

A port of ggplot2 for Nim
https://vindaar.github.io/ggplotnim
MIT License
176 stars 15 forks source link

release v0.3.21 (RC for v0.4.0) #98

Closed Vindaar closed 3 years ago

Vindaar commented 3 years ago

This turned from "make a few small changes" into "stupidly big PR".

Thus, this will be considered v0.4.0 in all but name. A few tiny changes have to be made, but that will be done after this PR is merged.

The major highlights of this version (after v0.3.20) are:

The full changelog of everything since the last release of v0.3.0:

* v0.3.21
- 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 the =GgPlot= 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 using =scale_*= 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 to =theme_void= to be able to set different
  background color on empty themes (joyplots anyone?)
- adds asserts to =DataFrame= access (not =doAssert= though, still be
  careful in danger builds!)
- initialize =DataFrame= if trying to assign a column to an
  uninitialized DF
- add missing =alpha= option for =geom_point=
- misc. fixes for ARC support:
- avoid =deepCopy= when cloning a =DataFrame= (leads to segfaults with
  laser based arraymancer tensors, which are =ptr + 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!
- 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 filtering =FormulaNode= 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:
  #+begin_quote
  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.
  #+end_quote
- 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 of =scFillColor=)
- add =map=, =map_inline= for =Column= for simple
  convenience. =map_inline= tries to "determine" the type of the
  operation automatically, but this means we compile a runtime
  exception for branches of =map_inline= that are not supported,
  e.g. a =c.map_inline(a + b)= will raise if =c= 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 have =allRecipes.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 outlines
  - =rRidgeLineGauss=: a simple example of a ridgeline plot as well as
    showcasing that formulas can be applied to each labels of a
    classified geom
  - =rRidgeLineGaussBlack=: the same plot in "prettier"
  - =rJoyplot=: the same plot again, this time as a full "Joyplot"
- =evaluate= can now evaluate a formula of kind =fkScalar=. 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`)}~
Vindaar commented 3 years ago

Ouch, this PR has become way too big... :(

For work I've been adding many small things here and there and didn't want to take the time to fix up all remaining local changes. I hope no one is waiting for this PR.