Specifying Columns

  • The user can supply a column key (index or name), or a sequence of column keys.
  • Or, the user can supply a scalar, vector, or matrix containing values.
    • These columns are stored in the table using the toyplot: namespace.
    • Unfortunately, it is difficult to tell the two apart.
      • If the user didn't supply a table, then the columns will always be values.
      • If the user did supply a table, then they could be keys or values.
    • We could require that, when supplying a table, all data must already reside within it. However, this seems kludgy for simple one-offs like opacity:
        axes.plot(table, x="x", y=["y1", "y2"], opacity="opacity")
    • Instead of dealing with column keys, we could have the caller always supply data values, and those data values could be columns from the table:
        axes.plot(data=table, x=table["x"], y=[table["y1"], table["y2"]], opacity=0.5)
      
      In this case, the table is more like an annotation - a caller specification of what to embed in the figure. However, this would allow the embedded data and plotted data to be out-of-sync, which is a no-no.
    • Use something other than a string to designate column keys:
        axes.plot(table, x=table.keys.x, y=[table.keys.y1, table.keys.y2], opacity=0.5)
        axes.plot(table, x=table.key("x"), y=[table.key("y1"), table.key("y2")], opacity=0.5)
      
      Ideally, we want to be allow structures other than toyplot.data.Table (such as a Pandas data frame) as input, so there should be some way to specify keys that doesn't assume a table:
        axes.plot(pivot, x=toyplot.key("x"), y=[toyplot.key("y1"), toyplot.key("y2")], opacity=0.5)
    • Another way to disambiguate would be to have separate arguments for keys and data:
        axes.plot(table, xcol="x", ycol=["y1", "y2"], opacity=0.5)

Specifying the Number Of Series

  • We could require that the user explicitly specify the number of series, than validate all the remaining information.
  • Or we could allow the number of series to be implicit:
    • It could be determined by the number of keys provided for a column of special significance.
    • Or it could be the maximum number of keys $n$ provided for any column.
      • Note that the number of keys provided should always be $1$ or $n$ ... values in-between would be ambiguous.
  • Keep in mind that for some marks, $n+1$ boundaries define $n$ series.

Computed Columns

  • There are columns such as fill that get converted to sequences of RGBA values. The converted versions can't overwrite the originals in the table, so they will be stored in the table using the toyplot: namespace.
    • How to distinguish between toyplot:fill (raw data) and toyplot:fill (RGBA data), when the caller supplies fill data, instead of a fill key?

Mark Storage

By the time data is stored in a toyplot.Mark, it must be finalized, which is to say:

  • All data is expanded and stored in the table.
    • If the caller supplied raw data instead of a column key, the data is expanded and stored in table columns.
  • All column keys have been converted to strings.
  • All column keys have been expanded.
    • If there are $n$ series, column $C$ will contain $n$ (or $n+1$, depending on the mark) column keys, even if they're the same key repeated.

In [0]: