Very cool! I really like what you’ve done so far.
Here are some thoughts on ways you could make it even easier to use.
According to the README, here’s how you create create a line graph:
var lineGraph: LineGraph = LineGraph()
lineGraph.addSeries(x, y, label: “Plot 1”, color: .lightBlue)
plotTitle.title = “SINGLE SERIES”
lineGraph.plotTitle = plotTitle
Then, to save it in a file:
lineGraph.drawGraphAndOutput(fileName: “lineChartMultipleSeries”, renderer: agg_renderer)
Or to display it in a Jupyter notebook:
lineGraph.drawGraph(renderer: agg_renderer)
display(base64EncodedPNG: agg_renderer.base64Png())
Given that a lot of the time folks will be producing a bunch of plots, it might be worth making these changes if they aren’t too much of a pain to do:
First, instead of or in addition to creating the title and then adding it to the plot, could you add a method so you can do it in one shot— eg, lineGraph.addPlotTitle(“SINGLE SERIES”)
Second, most of the time, users are going to want to use just one renderer etc in a script, so why have to specify it for every plot you have in a script? And given how wonderfully clear and straightforward everything else is for creating a line plot, for beginners, having to add "renderer: agg_renderer” or “base64EncodedPNG: agg_renderer.base64Png())” is going to look a little weird and a little intimidating.
-
Can you set it up so users can define it just once at the beginning of the script?
-
Can you add a method so instead of needing 2 lines to display the graph in a notebook, you can do it w one— eg, lineGraph.draw() or lineGraph.display()?
All small stuff, but if you succeed and this library turns into a tool that a ton of people are using, little tweaks like this could make using it even easier to use and teach than it already is.
So glad you’re working on this! Looking forward to seeing what you produce.