Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
643c74b
Add easy style sheet selection.
tonysyu Jul 21, 2013
3270aa4
Add rc_params_in_file to return partially-filled RcParams
tonysyu Jul 21, 2013
d83a03c
Rename style files to `*.style`
tonysyu Jul 21, 2013
c8cc486
Allow style.use to open URLs
tonysyu Jul 21, 2013
455b54c
Remove pyplot import
tonysyu Jul 21, 2013
7769b29
Add style context manager and tests
tonysyu Jul 23, 2013
3914089
Change style extension to *.mplstyle
tonysyu Jul 23, 2013
c3fae2e
Got a little crazy with the whitespace
tonysyu Jul 23, 2013
a3de231
Add style package and data to setupext.py
tonysyu Jul 25, 2013
d56f73e
Move test so that it actually runs.
tonysyu Sep 19, 2013
ec6ce6b
Use explicit string check
tonysyu Sep 19, 2013
5fdc037
Hide rc_params_in_file from parent namespace
tonysyu Sep 19, 2013
0c7437c
Remove usage of import *
tonysyu Sep 19, 2013
200d2e0
Clarify docstring
tonysyu Sep 19, 2013
7392ce6
added `matplotlib.style` to pyplot import list
tacaswell Sep 27, 2013
ea63c99
fix url rc specification
adrn Sep 17, 2013
eaa23ee
fixed divergent naming scheme
tacaswell Sep 27, 2013
5f80ca1
pep8 clean up
tacaswell Sep 27, 2013
f5ecf5e
Add docs for style package
tonysyu Sep 29, 2013
a8ef5bf
Import style package for easy use.
tonysyu Sep 29, 2013
dc291e0
Use style package from pyplot
tonysyu Sep 29, 2013
c5b5bb4
Fix test
tonysyu Sep 29, 2013
7ac26ee
pep8
tacaswell Oct 18, 2013
46a725b
Clear style settings between tests
mdboom Sep 30, 2013
d372a35
Add note that style sheets are experimental.
tonysyu Oct 19, 2013
e714c77
added python3 emulation code + six + fixed up print calls
tacaswell Oct 27, 2013
512b77c
removed unneeded print statements
tacaswell Oct 31, 2013
17282c8
Attempt to fix python 3 test errors on Travis CI
tonysyu Nov 13, 2013
a6142fc
Remove test from list to test Travis CI failure.
tonysyu Nov 14, 2013
19e7bed
Remove test file to test Travis CI failure
tonysyu Nov 14, 2013
c604498
Revert commits used to test Travis CI test failures.
tonysyu Nov 14, 2013
0b098e2
Fix import for python 3
tonysyu Nov 17, 2013
7e2bffb
Use iteritems from `six` module
tonysyu Nov 17, 2013
1d87f34
Add compatibility layer for Python 3's urlopen
tonysyu Nov 17, 2013
79f83c9
Fix _fix_url on Python 2.6
mdboom Nov 18, 2013
246c348
Merge pull request #6 from mdboom/style/py26-fixes
tonysyu Nov 18, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use style package from pyplot
  • Loading branch information
tonysyu committed Nov 17, 2013
commit dc291e09113181d503554e138184f9d80c897e53
17 changes: 8 additions & 9 deletions doc/users/style_sheets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ example, there's a pre-defined style called "ggplot", which emulates the
aesthetics of ggplot_ (a popular plotting package for R_). To use this style,
just add::

>>> from matplotlib import style
>>> style.use('ggplot')
>>> import matplotlib.pyplot as plt
>>> plt.style.use('ggplot')

To list all available styles, use::

>>> print style.available
>>> print plt.style.available


Defining your own style
Expand All @@ -45,8 +45,8 @@ For example, you might want to create
Then, when you want to adapt a plot designed for a paper to one that looks
good in a presentation, you can just add::

>>> from matplotlib import style
>>> style.use('presentation')
>>> import matplotlib.pyplot as plt
>>> plt.style.use('presentation')


Composing styles
Expand All @@ -57,8 +57,8 @@ sheet that customizes colors and a separate style sheet that alters element
sizes for presentations. These styles can easily be combined by passing
a list of styles::

>>> from matplotlib import style
>>> style.use(['dark_background', 'presentation'])
>>> import matplotlib.pyplot as plt
>>> plt.style.use(['dark_background', 'presentation'])

Note that styles further to the right will overwrite values that are already
defined by styles on the right.
Expand All @@ -75,9 +75,8 @@ changes, you can write something like the following::

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from matplotlib import style
>>>
>>> with style.context(('dark_background')):
>>> with plt.style.context(('dark_background')):
>>> plt.plot(np.sin(np.linspace(0, 2*np.pi)), 'r-o')
>>>
>>> # Some plotting code with the default style
Expand Down
3 changes: 1 addition & 2 deletions examples/style_sheets/plot_dark_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import numpy as np
import matplotlib.pyplot as plt

from matplotlib import style
style.use('dark_background')

plt.style.use('dark_background')

L = 6
x = np.linspace(0, L)
Expand Down
3 changes: 1 addition & 2 deletions examples/style_sheets/plot_ggplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style

style.use('ggplot')
plt.style.use('ggplot')

fig, axes = plt.subplots(ncols=2, nrows=2)
ax1, ax2, ax3, ax4 = axes.ravel()
Expand Down
4 changes: 1 addition & 3 deletions examples/style_sheets/plot_grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import numpy as np
import matplotlib.pyplot as plt

from matplotlib import style


def color_cycle_example(ax):
L = 6
Expand All @@ -24,7 +22,7 @@ def image_and_patch_example(ax):
ax.add_patch(c)


style.use('grayscale')
plt.style.use('grayscale')

fig, (ax1, ax2) = plt.subplots(ncols=2)

Expand Down