# How I can get cartesian coordinate system in matplotlib?

### Question

I am new to plotting with Python and can't really find an answer to the question: How can I get Cartesian coordinate plane in matplotlib? By this I mean perpendicular reference lines (coordinate axis) ended up with arrows, intersecting at the origin, (0,0), with the origin at the center of the plot.

Think about a a plane for doing high school geomtery, the following is a perfect example of what I need to achieve: 1
14
2/8/2017 2:38:26 PM

If you just want to plot some dots, scatter is what you want

``````from pylab import *

x = [0,2,-3,-1.5]
y = [0,3,1,-2.5]
color=['m','g','r','b']

scatter(x,y, s=100 ,marker='o', c=color)

show()
``````

For pretty printing ( with arrows and dashed lines ) :

``````from pylab import *
import matplotlib.pyplot as plt

x = [0,2,-3,-1.5]
y = [0,3,1,-2.5]
color=['m','g','r','b']

fig = plt.figure()

scatter(x,y, s=100 ,marker='o', c=color)

[ plot( [dot_x,dot_x] ,[0,dot_y], '-', linewidth = 3 ) for dot_x,dot_y in zip(x,y) ]
[ plot( [0,dot_x] ,[dot_y,dot_y], '-', linewidth = 3 ) for dot_x,dot_y in zip(x,y) ]

left,right = ax.get_xlim()
low,high = ax.get_ylim()
arrow( left, 0, right -left, 0, length_includes_head = True, head_width = 0.15 )
arrow( 0, low, 0, high-low, length_includes_head = True, head_width = 0.15 )

grid()

show()
``````

There is still some work to do, but it is not far from the result : 8
11/17/2012 12:55:24 PM
{"ft_lang_label":"__label__en","ft_lang_prob":0.7974086,"math_prob":0.9810865,"size":1318,"snap":"2020-34-2020-40","text_gpt3_token_len":408,"char_repetition_ratio":0.0890411,"word_repetition_ratio":0.11320755,"special_character_ratio":0.3596358,"punctuation_ratio":0.23602484,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99652106,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,null,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-19T12:41:58Z\",\"WARC-Record-ID\":\"<urn:uuid:1b8c5a8e-03c8-4169-98b3-6c12cd245f2a>\",\"Content-Length\":\"15401\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:39942402-51cd-4d6a-9d00-6d8eb2fca8ac>\",\"WARC-Concurrent-To\":\"<urn:uuid:a091e6b4-9c61-48c8-a06b-2e5a3ce4bae4>\",\"WARC-IP-Address\":\"40.83.160.29\",\"WARC-Target-URI\":\"https://pythonpedia.com/en/knowledge-base/13430231/how-i-can-get-cartesian-coordinate-system-in-matplotlib-\",\"WARC-Payload-Digest\":\"sha1:PSXC2H2B4LU2HTRAEBMHQXPMKIE7QTO6\",\"WARC-Block-Digest\":\"sha1:FUAYBIONPFZ6SKSUQG2AMJIN3LWUL4QE\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400191780.21_warc_CC-MAIN-20200919110805-20200919140805-00104.warc.gz\"}"}