uiua-plot

uiua-plot

PlotConfig

PlotConfig module

TODO: Document this more
The following fields can infer their values based on data:



  • Min

  • Max

  • GridlineInterval
    The following fields provide defaults for unspecified series-specific values:

  • DrawDots

  • DotSize

  • DrawLines

  • LineWidth


PlotConfig~ data boxed

Min°2°¤△⟜Num
Max°2°¤△⟜Num
Size°2°¤△⟜Num
BgColor⍣°3°4°¤△⟜Num
AxisWidth°[]△⟜Num
AxisColor⍣°3°4°¤△⟜Num
GridlineWidth°[]△⟜Num
GridlineColor⍣°3°4°¤△⟜Num
GridlineInterval°2°¤△⟜Num
NumberSize°[]△⟜Num
NumberColor⍣°3°4°¤△⟜Num
XLabel°[W]△⟜Char
YLabel°[W]△⟜Char
AxisLabelSize°[]△⟜Num
AxisLabelColor⍣°3°4°¤△⟜Num
PlotLabelSize°[]△⟜Num
PlotLabelColor⍣°3°4°¤△⟜Num
BarWidth°[]△⟜Num
BarLabels°[W]△⟜∵◇Char⟜Box
BarLabelSize°[]△⟜Num
BarLabelColor⍣°3°4°¤△⟜Num
DrawDots°[]△⟜Num
DotSize°[]△⟜Num
DrawLines°[]△⟜Num
LineWidth°[]△⟜Num

PlotConfig~Ppu function

|1

Pixels per unit

Source code
Ppu÷-MinMax Size

PlotConfig~Bounds function

|1
Source code
Bounds([Min Max]|[Min Max]|MaxMin°)

PlotConfig~XBounds function

|1
Source code
XBoundsBounds

PlotConfig~YBounds function

|1
Source code
YBoundsBounds

Data

Data module


Data~ data boxed

Values
Color⍣°3°4°¤△⟜Num
Label°[W]△⟜Char
DrawDots°[]△⟜Num
DotSize°[]△⟜Num
DrawLines°[]△⟜Num
LineWidth°[]△⟜Num

Constants

DefaultColors constant

Literal value╭─ ╷ 0.7803921568627451 0.2666… 0.25098039215686274 1 0.17647058823529413 0.4392156862745098 0.7019607843137254 1 0.2196078431372549 0.5490196078431373 0.27450980392156865 1 0.3764705882352941 0.25882352941176473 0.6509803921568628 1 0.9803921568627451 0.49411764705882355 0.09803921568627451 1 0 0 0 1 ╯

Index macros

Func! index macro

Data?XBounds

Generate a Data instance that plots a given function

Source code
Func!(
/-PC!(Size New)
^0𝄈×/-()÷5÷
Data!(°DrawDots0New))

Monadic functions

Scatter function

|1

Create a Data instance that draws only dots

Source code
ScatterData!(°DrawDots 1 °DrawLines 0 New)

Line function

|1

Create a Data instance that draws only lines

Source code
LineData!(°DrawLines 1 °DrawDots 0 New)

Background function

|1Image?PlotConfig
Source code
Background1 PC!Size BgColor

Axes function

|1Image?PlotConfig
Source code
Axes(
-÷2PC~AxisWidth
×PC!Min Ppu,
(°PC~Size,)°-
(°0)><
0:°PC~Size
C PC~AxisColor:𝄈)

Gridlines function

|1Image?PlotConfig
Source code
Gridlines(
PC!Min Ppu
(×PC~GridlineInterval:
| +:°PC~Size,×)
(+÷2):°
÷2PC~GridlineWidth
C PC~GridlineColor:𝄈)

AxisNums function

|1Image?PlotConfig
Source code
AxisNums(
PC!GridlineIntervalMinMaxPpu Size°
÷:
°°
(
×0-(+1)
×𝄈100@.° # Round values to precision of original factor
(¯.÷8layout) PC~NumberSize°°(×𝄈-)
)
((00:¯+÷2)[])
0PC~Size°
C PC~NumberColor°)

Plot function

|1Image?Data

TODO: Document this more
Create a line/scatter plot with a list of Data
Each Data~Values should be a list of 2D coordinates,
stored as a single rank 2 array.
Use ⬚ fill to provide a custom PlotConfig.

Source code
Plot(
ColorAutoInfer °PC

PC!Infer‼GridlineInterval(AutoRound÷5-///Data~Values)
PC!Infer‼Min(-÷5GridlineInterval,//Data~Values)
PC!Infer‼Max(+÷5GridlineInterval,//Data~Values)
Inherit‼Data~DrawDots PC~DrawDots
Inherit‼Data~DotSize PC~DotSize
Inherit‼Data~DrawLines PC~DrawLines
Inherit‼Data~LineWidth PC~LineWidth

PreChart
/Stack[
/StackSingleSeries¤
(AxisNums|Axes|Gridlines)]
PostChart)

BarChart function

|1Image?Data

TODO: Document this more
Create a bar chart with a list of Data
Each Data~Values should be a list of bar heights.
Use ⬚ fill to provide a custom PlotConfig.

Source code
BarChart(
PC~XBounds1_1 °PC
PC!Infer‼YBounds(0(+÷20)//0Data~Values)
PC!Infer‼(GridlineInterval|AutoRound÷5/-YBounds)
ColorAutoInfer
(PC~GridlineInterval)

PreChart

(""PC~BarLabels/(Data~Values)
÷8layoutPC~BarLabelSize,
×÷,PC~Size,
+÷2-(),
0PC~Size,/0
C PC~BarLabelColor:)
((PC~Size)-,)

:/Stack [::Bars(AxisNums|Axes|Gridlines)]

PostChart)

Histogram function

|1Image?Data

TODO: Document this more
Create a histogram with a single set of Data
Data~Values should be a list of numbers.
Use ⬚ fill to provide a custom PlotConfig.
Histogram bucket intervals can be specified
through the x component of GridlineInterval
in the PlotConfig.

Source code
Histogram(
°PC
PC!Infer‼(GridlineInterval|AutoRound÷10-//Data~Values)
PC!Infer‼XBounds(÷GridlineInterval,//Data~Values)
ColorAutoInfer
Data~Values(
PC!GridlineInterval XBounds,
°÷(-(+1)°)
0:°1:)

¤PreChart

°PC~BarWidth:×PC!Ppu GridlineInterval,
PC!Infer‼YBounds(0×1.04/Data~Values)
PC!Infer‼(GridlineInterval|AutoRound÷5/-YBounds)
/Stack[::SingleBars(AxisNums|Axes|Gridlines)]

PostChart)

Dyadic functions

Stack function

|2

Stack one RGBA image atop another

Source code
Stack° 0÷(+×𝄐¬|+×(×𝄐׬)|𝄐¬×) °°𝄈

Legend function

|2Legend?DataPlotConfig
Source code
Legend(
¤
PC!Data!PlotLabelSizeColor°°LabelPlotLabelColor
((C:0×3/2¬|C:layout)):
PC~PlotLabelSize(PC~Size)0[]()
(𝄈°(-+𝄈-1: < +):)
(0¯÷2+()/()¤4)
(/()4𝄈0𝄈2,)
¯÷2)

Dots function

|2Image?DataPlotConfig
Source code
Dots(
(PointsToPx Data~Values)
0:° PC~Size
CircleKernel Data~DotSize,
¯÷2FFTConvolve
1C Data~Color:)

Lines function

|2Image?DataPlotConfig
Source code
Lines(
(2/PointsToPx Data~Values)
¤/°PC~Size
//(-×01÷(/+×°):-)
¬01-÷10Data~LineWidth,×0.7
C Data~Color:)

SingleSeries function

|2Image?DataPlotConfig

Plot a single series

Source code
SingleSeries/Stack[
DotsData~DrawDots
LinesData~DrawLines]

SingleBars function

|2Bars?DataPlotConfig
Source code
SingleBars(
PC~YBounds𝄈Data~Values
(°)
(0-0|0-0|¯0-0)
×,(PC~Ppu,)
0:01PC~BarWidth,
PC!BarWidth Size,
+÷2-(1×÷,)
0PC~Size:/0
C Data~Color:)

Bars function

|2
Source code
Bars(
0Data~Values
SingleBars¤
PC~BarWidth:
×-÷2-1,
/Stack)

ColorAutoInfer function

|2.2
Source code
ColorAutoInfer(
Data~Color
:Infer‼Data~Color(,,DefaultColors)
)

PreChart function

|2.5
Source code
PreChart(
Background
(±>0(Data~Label)
(°[04]PC~Size)(((PC~Size)-)Legend))
(>0[PC!YLabel XLabel]PC~Size
PC~Size-×++÷4 PC~AxisLabelSize,))

Pentadic functions

PostChart function

|5
Source code
PostChart(
PC!AxisLabelColorAxisLabelSizeXLabel YLabel:
(¯÷4layout)
1:(,)(1×)1
𝄈:1(÷2-0)
Stack𝄈×1_¯1:0,)