Hi I'm trying to draw something like http://en.wikipedia.org/wiki/File:Cartesian-coordinate-system.svg
Below is my current attempt. Four questions: 1. The y-axis label is vertical: how do I make it horizontal? 2. How can I move the axis numbering to be in the centre of the graph, rather than around the outside? 3. Most of the mess below is to try to get the arrow heads not to be stretched. Is there a better way to draw those in "screen space" rather than "graph space"? 4. The axis label positioning is ugly too, is there a better way to align that text's midpoint? Answers to any of these will be greatfully received. :) Or, if I'm going about this all wrong and I missed an easy helper function, that'd be even better! thanks, scott ------------- from __future__ import division import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np def cartesian(w,h): fig = plt.figure(figsize=(5,5)) ax = plt.axes() arrowExtraW = w/6 arrowExtraH = h/6 box = dict(edgecolor='white', facecolor='white', pad=5) plt.xlabel("$x$", bbox=box) ax.xaxis.set_label_coords(1.03, 0.515) plt.ylabel("$y$", bbox=box) ax.yaxis.set_label_coords(0.515, 1.03) plt.axis([-w-arrowExtraW, w+arrowExtraW, -h-arrowExtraH, h+arrowExtraH]) plt.arrow(-w, 0, w*2, 0, head_width=arrowExtraH/1.5, head_length=arrowExtraW, edgecolor="black", facecolor="black", label="$x$") plt.arrow(w, 0, -w*2, 0, head_width=arrowExtraH/1.5, head_length=arrowExtraW, edgecolor="black", facecolor="black") plt.arrow(0, -h, 0, h*2, head_width=arrowExtraW/1.5, head_length=arrowExtraH, edgecolor="black", facecolor="black", label="$y$") plt.arrow(0, h, 0, -h*2, head_width=arrowExtraW/1.5, head_length=arrowExtraH, edgecolor="black", facecolor="black") plt.grid(True) plt.savefig("a.png") cartesian(20, 6) -- View this message in context: http://www.nabble.com/plotting-cartesian-%22high-school%22-style-axes-tp22217764p22217764.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users