mirror of
https://github.com/wassname/matplotlibrc.git
synced 2026-09-09 11:26:43 +08:00
Merge pull request #2 from mindriot101/add-screenshots
Add screenshots to the project
This commit is contained in:
+22
@@ -11,3 +11,25 @@ Add a new matplotlibrc file to the `rc` dir, say `myrc`, and use::
|
||||
See the `showstyle.py` file for usage -- for example, note how `hist` and
|
||||
`scatter` grab the first color in `rcParams['axes.color_cycle']` since there's
|
||||
no way to set the default scatter or hist color via rcParams.
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
Some included styles are:
|
||||
|
||||
- default
|
||||
|
||||
.. image:: screenshots/default.png
|
||||
|
||||
- ggplotish
|
||||
|
||||
.. image:: screenshots/ggplotish.png
|
||||
|
||||
- probpro
|
||||
|
||||
.. image:: screenshots/probpro.png
|
||||
|
||||
- rlike
|
||||
|
||||
.. image:: screenshots/rlike.png
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 466 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 513 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 483 KiB |
+12
-11
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
|
||||
from matplotlib import pyplot as plt
|
||||
import matplotlib
|
||||
@@ -12,6 +12,7 @@ ap = argparse.ArgumentParser()
|
||||
ap.add_argument('style', help='Which rc file to use. One of %s' % available)
|
||||
ap.add_argument('--plot', default='all', help='One of [scatter, hist, line, image], or '
|
||||
'a comma-separated list of a subset. Default is all.')
|
||||
ap.add_argument('-o', '--output', required=False, help='Render the plot to a file')
|
||||
args = ap.parse_args()
|
||||
|
||||
matplotlib.rc_file(os.path.join(HERE, 'rc', args.style))
|
||||
@@ -45,29 +46,29 @@ def histogram(ax):
|
||||
ax.set_title('demo plot')
|
||||
ax.legend(loc='best')
|
||||
|
||||
fig = plt.figure(figsize=(11, 8))
|
||||
|
||||
def image(ax):
|
||||
ax.imshow(np.random.random((100, 100)))
|
||||
|
||||
|
||||
if 'line' in args.plot or args.plot == 'all':
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
ax = fig.add_subplot(221)
|
||||
lineplot(ax)
|
||||
|
||||
if 'scatter' in args.plot or args.plot == 'all':
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
ax = fig.add_subplot(222)
|
||||
scatterplot(ax)
|
||||
|
||||
if 'hist' in args.plot or args.plot == 'all':
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
ax = fig.add_subplot(223)
|
||||
histogram(ax)
|
||||
|
||||
if 'image' in args.plot or args.plot == 'all':
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
ax = fig.add_subplot(224)
|
||||
image(ax)
|
||||
|
||||
plt.show()
|
||||
plt.tight_layout()
|
||||
if args.output:
|
||||
plt.savefig(args.output)
|
||||
else:
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user