Closed Vindaar closed 5 years ago
I am fine with this. Seems like soon we need more general documentation now that the feature-set is expanding.
I am fine with this. Seems like soon we need more general documentation now that the feature-set is expanding.
Yes, I agree. I've been meaning to write some more documentation... :|
Sorry for taking so long to get back to this. I just:
(row, col)
coordinate tuplesnumPlotsPerRow
was setshowImpl
to toPlotJson
@LemonBoy: Does this look reasonable for you? :)
I haven't had a look at this. @LemonBoy PTAL?
@Vindaar is this still as you'd like it?
For me this is fine. I think it's ok to support both ways of adding elements to the grid. I've been using it in my own code already without issues. edit: just noticed a problem with the JS backend. Not sure yet if it's a regression on devel or introduced by me in this PR. Will investigate and report back. edit2: Sorry, done. I thought I tested the JS backend after making these changes, but apparently I didn't do that properly.
This PR adds a
Grid
object and correspondingcreateGrid
procedure, which can be used to create subplots using a grid at runtime. It's basically what was proposed in #43.Plots can be assigned to the
Grid
object using[]=
. In addition more plots than defined by thenumPlots
argument ofcreateGrid
can be added by usingadd
. The given object is converted toPlotJson
. A call toshow
on the grid, will calculate the required number of rows and columns (numPlotsPerRow
is an optional argument tocreateGrid
) and make a call tocombine
to get a validPlotJson
object of the subplot.I had to move the implementation from
plotly.nim
to a submodule, to be able to callshow
from withinplotly_subplots
.The
Grid
object has alayout
field, which takes just a normalLayout
object. This can also be given tocreateGrid
, but can be set later if desired.For some reason the
show
proc withfilename
arg for--threads:off
does not compile. It acts as if the proc was called, even it isn't. Not sure what's up there.I'm all ears for other ideas, features of different names for the args / objects.
@timotheecour let me know if this suits your needs. :)