Crate poloto[][src]

poloto - A very simple plotter

The rise of SVG has made the need to an intermediate representatin of a graph not necessary. Instead of using .gplot files, just render to SVG graph directly using this crate.

poloto is meant to be used to graph fairly 'obvious/general' trends in the data. The user is not meant to be able to extract data or notice subtle differences in data. The desired use case is to allow inserting a nice graph into a webpage generated via mdBook.

For this reason, a lot of options that are normally provided in a plotting library aren't provided. For example, you can't change the thickness of the lines. Instead the user is encouraged, to pick a good set of data points to "zoom in" on a trend they want to show.

How do I change the color of the plots?

You can doing it by overriding the css. If you embed the generated svg into a html file, then you can add this example:

.poloto{
   --poloto_bg_color:"black";
   --poloto_fg_color:"white;
   --poloto_color0:"red";
   --poloto_color1:"green";
   --poloto_color2:"yellow";
   --poloto_color3:"orange";
   --poloto_color4:"purple";
   --poloto_color5:"pink";
   --poloto_color6:"aqua";
   --poloto_color7:"red";
   --poloto_color8:"blue";
}

By default these variables are not defined, so the svg falls back on some default colors. With this, it will change the colors. You can also add different styling to make dotted lines, change the stroke width, etc. Depending on whether you are adding a new style attribute or overriding an existing one, you might have to increase the specificty of your css clause to make sure it overrides the svg css clause.

Can I change the styling of the plots?

Yes! To override the existing style, just use the class specifier twice. See the examples.

Usage

  • Plots containing NaN or Infinity are ignored.
  • After 6 plots, the colors cycle back and are repeated.

Why use scientific notation?

Its the most dense and consistent formatting. Also easiest to implement.

Why not scale the intervals to end nicely with the ends of the axis lines?

Doing this you would have to either have more dead space, or exclude plots that the user would expect to get plotted. Neither of these sounded better than the option of just having the intervals stop not necessarily at the end of the axis lines.

How do I do I make the histogram corners rounded?

You can't right now, but with SVG2 with Geometry Properties, you'll be able to do.

.poloto2stroke{rx:5;ry:5}

Example

See the graphs in this report: broccoli_book

Structs

Plotter

Keeps track of plots. User supplies iterators that will be iterated on when render is called.

Functions

plot

Shorthand constructor.