Skip to content

Graphs should have a single grid regardless of how many y axes. #524

@abalter

Description

@abalter

Specific aspect of #523.

Currently, graphs with multiple y axes appear to be separate plots superimposed upon each other, each with their own grid. Sometimes the grids are not synced up and you get oddly placed grid lines. Annotations relating to one y axis will distort only those grid lines, doing very weird things to the plot.

To prevent these inconsistencies, the grid could belong to the paper, not the axes. The values of the tick marks and tick values can be different on the various y axes. They can line up with the grid lines or not. The grids help guide the eye. They are not data.

This causes a conundrum: since it makes sense for a single y axis to have the ticks on that axis define the grid, when there are multiple y axes, what defines the grid spacing?

Proposal:

The grid is a visual element, not a data element. So the grid should by in the layout section. However, you can anchor it to a y axis of your choice, or the paper.

var layout =
{
  grid:
  {
    anchor: ["yaxis#" | "paper"], // if y axis, grid lines at tick values
    scale: ["linear" | "log" | "auto"],
    num_lines: [int],  // if anchored to y axis, choose best n ticks. if paper, space according to scale
    divisions: [int], // if anchored to y axis, number of grid lines between ticks
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions