aya icon indicating copy to clipboard operation
aya copied to clipboard

Plotting Instructions rewrite: Box-Plots, Pie-Charts, Canvas-Rendering

Open BlazingTwist opened this issue 1 year ago • 1 comments

Breaking changes

I have separated the :{plot.plot} subplots option into a separate instruction :{plot.multiplot} My justification for that is: the option was not documented, and mixing single-plots with multiplots in one instruction was too confusing.

The renamed instruction was hidden behind std/plot.aya so unless someone used the instruction directly, they shouldn't notice this change. (!) the option suptitle was renamed to title for consistency with the other instructions.

I've run all of the examples/plot/ examples and they appear to work the same as before.


DictReader changes

I've added 3 methods to the DictReader to make error messages more useful and make nested dictionaries easier to read. getDictReader(Symbol) and getDictReaderEx(Symbol) will use the symbol as part of the error name.

This way error messages should be a bit more useful:

{,
	[
		{, 10.R :values}
		{, 15.R :values}
		10.R
	] :data
} :{plot.box_plot}

results in

plot.box_plot.data[2] must be a dict
   in :{plot.box_plot} .. }

Refactoring

I changed all of the Input classes to use final fields (since writing to them after they're read is generally a mistake)

I've also changed a lot of the code structure, if something doesn't make sense intuitively, feel free to yell at me.


New Features

Box Plots: see examples/plot/box_plot.aya Pie Charts: see examples/plot/pie_chart.aya Canvas-Rendering: see examples/plot/canvas_multiplot.aya

Preview: image

BlazingTwist avatar Sep 15 '24 13:09 BlazingTwist

Oops, looks like my fork was way out of date. Fixed:

{,
	[
		{, 10.R :values}
		{, 15.R :values}
		10.R
	] :data
} :{plot.box_plot}

Now outputs:

plot.box_plot.data[2] must be a dict


> File '<editor>', line 7, col 18:
6 | 	] :data
7 | } :{plot.box_plot}
    ~~~~~~~~~~~~~~~~~^
8 | 

Function call traceback:

And

{,
	[{, 10.R :values}] :data
  "#hhh":bgcolor
} :{plot.box_plot}

outputs:

plot.box_plot.bgcolor: Failed to read color (will use default). Cause: Invalid color specification

BlazingTwist avatar Sep 15 '24 14:09 BlazingTwist

Sorry for taking so long to review this! This is great, I tested everything and it looks good to me!

nick-paul avatar Oct 13 '24 20:10 nick-paul