Skip to content

In documentation, consider providing a cheatsheet for Chaco users coming from Matplotlib #690

@achabotl

Description

@achabotl

I know Chaco and Matplotlib have different mental models (and object models), but there's a handful of things that users are likely to do and for which they might know the Matplotlib API. I often share the following table with students and think it'd be nice to have something like it be part of the docs.

What matplotlib Chaco
Plot lines ax.plot(x, y) p.plot(('x', 'y'))
x label ax.set_xlabel('Time') p.x_axis.title = 'Time'
y label ax.set_ylabel('Value') p.y_axis.title = 'Value'
Title ax.set_title(title) p.title = title
X limits ax.set_xlim((low, high)) p.index_range.low_setting = LOW p.index_range.high_setting = HIGH
Y limits ax.set_ylim((low, high)) p.value_range.low_setting = LOW p.value_range.high_setting = HIGH
Label lines for legend ax.plot(…, label=label) p.plot(…, name=name)
Add legend ax.legend() p.legend.visible = True
Legend position ax.legend(loc='lower left') p.legend_alignment = 'll'
Background color p.bgcolor = 'white'
Show spines p.border_visible = True
Line width ax.plot(linewidth=lw) p.line_width = 1.1 or p.plot(…, linewidth=lw)
X grid ax.grid(axis='x') p.x_axis.visible = True
Y grid ax.grid(axis='y') p.y_axis.visible = True
Second y ticks line.y_axis.orientation = "right"

It's not 100% "complete" and it may need some context before it to explain what ax, p, and line are, but it's a start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions