| 1 | diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py |
| 2 | --- a/lib/matplotlib/__init__.py |
| 3 | +++ b/lib/matplotlib/__init__.py |
| 4 | @@ -1059,6 +1059,8 @@ def rc_context(rc=None, fname=None): |
| 5 | """ |
| 6 | Return a context manager for temporarily changing rcParams. |
| 7 | |
| 8 | + The :rc:`backend` will not be reset by the context manager. |
| 9 | + |
| 10 | Parameters |
| 11 | ---------- |
| 12 | rc : dict |
| 13 | @@ -1087,7 +1089,8 @@ def rc_context(rc=None, fname=None): |
| 14 | plt.plot(x, y) # uses 'print.rc' |
| 15 | |
| 16 | """ |
| 17 | - orig = rcParams.copy() |
| 18 | + orig = dict(rcParams.copy()) |
| 19 | + del orig['backend'] |
| 20 | try: |
| 21 | if fname: |
| 22 | rc_file(fname) |