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.
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.
ax.plot(x, y)p.plot(('x', 'y'))ax.set_xlabel('Time')p.x_axis.title = 'Time'ax.set_ylabel('Value')p.y_axis.title = 'Value'ax.set_title(title)p.title = titleax.set_xlim((low, high))p.index_range.low_setting = LOWp.index_range.high_setting = HIGHax.set_ylim((low, high))p.value_range.low_setting = LOWp.value_range.high_setting = HIGHax.plot(…, label=label)p.plot(…, name=name)ax.legend()p.legend.visible = Trueax.legend(loc='lower left')p.legend_alignment = 'll'p.bgcolor = 'white'p.border_visible = Trueax.plot(linewidth=lw)p.line_width = 1.1orp.plot(…, linewidth=lw)ax.grid(axis='x')p.x_axis.visible = Trueax.grid(axis='y')p.y_axis.visible = Trueline.y_axis.orientation = "right"It's not 100% "complete" and it may need some context before it to explain what
ax,p, andlineare, but it's a start.