-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Style changes omnibus PR #5774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Style changes omnibus PR #5774
Changes from all commits
14281fd
76c70be
bba003f
86b7a59
d2f6bea
87ba8b0
38d4e31
5317d35
5695389
3e7471a
28c632f
4472125
f45e9bc
4513182
09b29d8
3abcb95
f2ac1bb
318a044
417db2f
82558ee
c5864ce
30b4341
0f4e3a6
c44bd3d
fa4c56e
caa711b
c2580a5
f0e98fa
7718b15
0aae0f0
f21d5cf
31f28bc
b394ae7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
Changes to the default style | ||
---------------------------- | ||
|
||
The most important changes in matplotlib 2.0 are the changes to the | ||
default style. | ||
|
||
While it is impossible to select the best default for all cases, these | ||
are designed to work well in the most common cases. | ||
|
||
These changes include: | ||
|
||
Colors | ||
`````` | ||
|
||
- The default figure background color has changed from grey to white. | ||
Use the rcParam ``figure.facecolor`` to control this. | ||
|
||
- The default cycle of colors to draw lines, markers and other content | ||
has been changed. It is based on the `Vega category10 palette | ||
<https://github.com/vega/vega/wiki/Scales#scale-range-literals>`__. | ||
|
||
- The default color map used for images and pcolor meshes, etc., has | ||
changed from ``jet`` to ``viridis``. | ||
|
||
- For markers, scatter plots, bar charts and pie charts, there is no | ||
longer a black outline around filled markers by default. | ||
|
||
- Grid lines are light grey solid 1pt lines. They are no longer dashed by | ||
default. | ||
|
||
Plot layout | ||
``````````` | ||
|
||
- The default dpi used for on-screen is now 100, which is the same as | ||
the old default for saving files. Due to this, the on-screen | ||
display is now more what-you-see-is-what-you-get. | ||
|
||
- The number of ticks on an axis is now automatically determined based | ||
on the length of the axis. | ||
|
||
- The limits are scaled to exactly the dimensions of the data, plus 5% | ||
padding. The old behavior was to scale to the nearest "round" | ||
numbers. To use the old behavior, set the ``rcParam`` | ||
``axes.autolimit_mode`` to ``round_numbers``. To control the | ||
margins on particular side individually, pass any of the following | ||
to any artist or plotting function: | ||
|
||
- ``top_margin=False`` | ||
- ``bottom_margin=False`` | ||
- ``left_margin=False`` | ||
- ``right_margin=False`` | ||
|
||
- Ticks now point outward by default. To have ticks pointing inward, | ||
use the ``rcParams`` ``xtick.direction`` and ``ytick.direction``. | ||
|
||
- By default, caps on the ends of errorbars are not present. Use the | ||
rcParam ``errorbar.capsize`` to control this. | ||
|
||
Images | ||
`````` | ||
|
||
- The default mode for image interpolation, in the rcParam | ||
``image.interpolation``, is now ``nearest``. | ||
|
||
- The default shading mode for light source shading, in | ||
``matplotlib.colors.LightSource.shade``, is now ``overlay``. | ||
Formerly, it was ``hsv``. | ||
|
||
- The default value for the rcParam ``image.resample`` is now | ||
``True``. This will apply interpolation for both upsampling and | ||
downsampling of an image. | ||
|
||
Fonts | ||
````` | ||
|
||
- The default font has changed from "Bitstream Vera Sans" to "DejaVu | ||
Sans". "DejaVu Sans" is an improvement on "Bistream Vera Sans" that | ||
adds more international and math characters, but otherwise has the | ||
same appearance. | ||
|
||
- The default math font when using the built-in math rendering engine | ||
(mathtext) has changed from "Computer Modern" (i.e. LaTeX-like) to | ||
"DejaVu Sans". To revert to the old behavior, set the ``rcParam`` | ||
``mathtext.fontset`` to ``cm``. This change has no effect if the | ||
TeX backend is used (i.e. ``text.usetex`` is ``True``). | ||
|
||
Dates | ||
````` | ||
|
||
- The default date formats are now all based on ISO format, i.e., with | ||
the slowest-moving value first. The date formatters are still | ||
changeable through the ``date.autoformatter.*`` rcParams. Python's | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not seeing these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's from #5445. I've rebased this on that, so it's here now (but still won't show up in the diff, obviously). |
||
``%x`` and ``%X`` date formats may be of particular interest to | ||
format dates based on the current locale. | ||
|
||
Legends | ||
``````` | ||
|
||
- By default, the number of points displayed in a legend is now 1. | ||
|
||
- The default legend location is ``best``, so the legend will be | ||
automatically placed in a location to obscure the least amount of | ||
data possible. | ||
|
||
- The legend now has rounded corners by default. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,9 +61,11 @@ def filled_hist(ax, edges, values, bottoms=None, orientation='v', | |
values = np.r_[values, values[-1]] | ||
bottoms = np.r_[bottoms, bottoms[-1]] | ||
if orientation == 'h': | ||
return ax.fill_betweenx(edges, values, bottoms, **kwargs) | ||
return ax.fill_betweenx(edges, values, bottoms, left_margin=False, | ||
**kwargs) | ||
elif orientation == 'v': | ||
return ax.fill_between(edges, values, bottoms, **kwargs) | ||
return ax.fill_between(edges, values, bottoms, bottom_margin=False, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like some sort of suggested change that people should make, but it isn't noted in the change list above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point. I'll add this to the existing bullet point about limits. |
||
**kwargs) | ||
else: | ||
raise AssertionError("you should never be here") | ||
|
||
|
@@ -206,3 +208,5 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None, | |
ax1.set_xlabel('counts') | ||
ax1.set_ylabel('x') | ||
ax2.set_ylabel('x') | ||
|
||
plt.show() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ | |
|
||
t = np.arange(0.0, 5.0, 0.01) | ||
s = np.cos(2*np.pi*t) | ||
line, = ax.plot(t, s, lw=3, color='purple') | ||
line, = ax.plot(t, s) | ||
|
||
ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction', | ||
horizontalalignment='center', verticalalignment='center') | ||
|
@@ -97,7 +97,7 @@ | |
ax = fig.add_subplot(111, projection='polar') | ||
r = np.arange(0, 1, 0.001) | ||
theta = 2*2*np.pi*r | ||
line, = ax.plot(theta, r, color='#ee8d18', lw=3) | ||
line, = ax.plot(theta, r) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The linewidth was kept in the previous plot call, why not here, too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should probably take it off in both cases, actually, so it will take the new defaults. (This example isn't about how to change the linewidth). |
||
|
||
ind = 800 | ||
thisr, thistheta = r[ind], theta[ind] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this change in the template, but not in
rcsetup.py
; is it fully implemented? (I assume it'sfigure.facecolor
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. It should be in rcsetup.py as well. Done.