From 55c54f410f34eaf369357edeeb3758301e22efdc Mon Sep 17 00:00:00 2001 From: Sietze van Buuren Date: Tue, 20 Aug 2024 10:12:41 +0200 Subject: [PATCH] feat: Add more festures to full 2D plot example Signed-off-by: Sietze van Buuren --- examples/full.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/full.py b/examples/full.py index f15a45d..a71be90 100644 --- a/examples/full.py +++ b/examples/full.py @@ -20,7 +20,17 @@ def main(): mpg.plot(theta, np.sin(theta + np.pi), style='--', **plot_args) mpg.plot(theta, np.cos(theta + np.pi), style='.-', **plot_args) mpg.plot(theta, 0.5*np.cos(theta), color='k', **plot_args) - mpg.gca().grid = True + axis = mpg.gca() + axis.grid = True + axis.xlabel = 'x' + axis.ylabel = 'y' + axis.xticks = ((0.0, '0'), + (np.pi/2.0, 'π/2'), + (np.pi, 'π'), + (1.5*np.pi, '3π/2'), + (2.0*np.pi, '2π'),) + axis.add_legend('y=cos(x)', 'y=sin(x)', 'y=sin(x+π)', 'y=cos(x+π)', 'y=cos(x)/2') + if __name__ == '__main__': main()