@justinholman/

SimpleGraphs

Python

use matplotlib

fork
loading
Files
  • main.py
  • scatter-test.png
  • scatter0.png
  • scatter1.png

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6295589627404878","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG1hdHBsb3RsaWIgYXMgbXBsCiMgdGhpcyB1c2UoJ0FnZycpIHBhcnQgaXMgd2hhdCBhbGxvd3MgdXMgdG8gY3JlYXRlIGdyYXBoaWNzIAptcGwudXNlKCdBZ2cnKQoKaW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdAoKIyBKdXN0IHNvbWUgcmFuZG9tIGRhdGEKeCA9IFsxNDcwLDUyOTIsNzYyMiw2MDgwLDUwNDksOTcwNiwzOTA1LDYyNzMsNDMyXQp5ID0gWzE4NDIsNjE0MCw1MDY5LDUzNTgsNTY4NCwxMTEyMiw0MzI0LDcwNDcsODU1XQoKIyBjcmVhdGUgYSBzY2F0dGVyIHBsb3Qgd2l0aCBsYWJlbHMgYW5kIGEgdGl0bGUKcGx0LnNjYXR0ZXIoeCx5KQpwbHQueGxhYmVsKCJ4IGF4aXMiKQpwbHQueWxhYmVsKCJ5IGF4aXMiKQpwbHQudGl0bGUoIlNjYXR0ZXIgUGxvdCBFeGFtcGxlIikKcGx0LnNob3coKQoKIyB0aGlzIGdlbmVyYXRlcyB0aGUgZmlsZSAtIHlvdSBtYXkgbmVlZCB0byByZWZyZXNoIHRvIHNlZSB0aGUgZmlsZQpwbHQuc2F2ZWZpZygnc2NhdHRlci10ZXN0LnBuZycpCnBsdC5jbGYoKQpwcmludCgiU2hhZG9vYmllIC4uLiBzY2F0dGVyLCBzY2F0dGVyIik="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import matplotlib as mpl
# this use('Agg') part is what allows us to create graphics 
mpl.use('Agg')

import matplotlib.pyplot as plt

# Just some random data
x = [1470,5292,7622,6080,5049,9706,3905,6273,432]
y = [1842,6140,5069,5358,5684,11122,4324,7047,855]

# create a scatter plot with labels and a title
plt.scatter(x,y)
plt.xlabel("x axis")
plt.ylabel("y axis")
plt.title("Scatter Plot Example")
plt.show()

# this generates the file - you may need to refresh to see the file
plt.savefig('scatter-test.png')
plt.clf()
print("Shadoobie ... scatter, scatter")