Skip to content

Adding multiple Y axes.

Sebastien Binet requested to merge yohcop:multi-axis into master

Created by: yohcop

The same thing could be made with the X axis, but it's far less common, so I didn't do it.

The interface stays mostly the same. Instead of accessign plt.Y, plt.Ys[0] (or any other index) must be used.

plt.AddYAxis() adds a new Y axis, and plt.AddWithAxis adds a plotter with the given axis.

Tests have been updated. but only the svg and pdf golden files changed. The differences are only in the order things are painted. The Y axis is now painted before the x axis.

plotter/main has been updated with an example using 2 Y axes. More than two axes are also possible of course.

There is one possibly awkward thing: I had to change the Plotter and GlyphBoxer interfaces to take the x and y axis to paint with. This makes sense for plotters, but it is slightly weird for the Axis struct since they are not painted within another axis. Maybe Axis and Plot don't really need to implement GlyphBoxer and Plotter?

Suggestions and comments welcome!

Merge request reports