e85620ec5084ec81a5ecce6e9c78332365a18ddd
python/pandas/x, y\350\273\270\343\201\2141:1\343\201\256\346\225\243\345\270\203\345\233\263\343\202\222\344\275\234\346\210\220\343\201\231\343\202\213.md
... | ... | @@ -0,0 +1,19 @@ |
1 | +[python - How do I make a matplotlib scatter plot square? - Stack Overflow](https://stackoverflow.com/questions/28122013/how-do-i-make-a-matplotlib-scatter-plot-square) |
|
2 | + |
|
3 | +```python |
|
4 | +import matplotlib |
|
5 | +matplotlib.use('Agg') |
|
6 | +import matplotlib.pyplot as plt |
|
7 | +plt.rcParams['backend'] = 'TkAgg' |
|
8 | +x = [0, 0.2, 0.4, 0.6, 0.8] |
|
9 | +y = [0, 0.5, 1, 1.5, 2.0] |
|
10 | +colors = ['k']*len(x) |
|
11 | +plt.scatter(x, y, c=colors, alpha=0.5) |
|
12 | +plt.axes().set_aspect('equal', adjustable='datalim') |
|
13 | +plt.xlim((0,2)) |
|
14 | +plt.ylim((0,2)) |
|
15 | +plt.grid(b=True, which='major', color='k', linestyle='--') |
|
16 | +plt.savefig('{}.png'.format(rsID), dpi=600) |
|
17 | +plt.close() |
|
18 | +plt.clf() |
|
19 | +``` |
|
... | ... | \ No newline at end of file |