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

Skip to content

Commit 43a36c2

Browse files
authored
Merge pull request #15 from efiring/doc_v2_rel_notes2_EF
Various edits to dflt_style_changes.rst
2 parents 7eefff0 + df7e82f commit 43a36c2

1 file changed

Lines changed: 74 additions & 74 deletions

File tree

doc/users/dflt_style_changes.rst

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ persistently and selectively revert many of these changes.
2525

2626

2727

28-
colors, color cycles, and color maps
28+
Colors, color cycles, and color maps
2929
====================================
3030

3131
Colors in default property cycle
3232
--------------------------------
3333

34-
The colors in the default proprety cycle have been changed from
34+
The colors in the default property cycle have been changed from
3535
``['b', 'g', 'r', 'c', 'm', 'y', 'k']`` to the `Vega category10 palette
3636
<https://github.com/vega/vega/wiki/Scales#scale-range-literals>`__
3737

@@ -74,15 +74,17 @@ The colors in the default proprety cycle have been changed from
7474
color_demo(ax1, old_colors, 'classic')
7575
color_demo(ax2, new_colors, 'v2.0')
7676

77-
fig.subplots_adjust(**{'bottom': 0.0, 'left': 0.059, 'right': 0.869, 'top': 0.895})
77+
fig.subplots_adjust(**{'bottom': 0.0, 'left': 0.059,
78+
'right': 0.869, 'top': 0.895})
7879
7980
In addition to changing the colors, an additional method to specify
8081
colors was added. Previously, the default colors were the single
8182
character short-hand notations for red, green, blue, cyan, magenta,
8283
yellow, and black. This made them easy to type and usable in the
8384
abbreviated style string in ``plot``, however the new default colors
8485
are only specified via hex values. To access these colors outside of
85-
the property cycling the notation for colors ``'CN'`` was added to
86+
the property cycling the notation for colors ``'CN'``, where ``N``
87+
takes values 0-9, was added to
8688
denote the first 10 colors in ``mpl.rcParams['axes.prop_cycle']`` See
8789
:ref:`colors` for more details.
8890

@@ -93,7 +95,7 @@ To restore the old color cycle use
9395
from cycler import cycler
9496
mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk')
9597
96-
or setting
98+
or set
9799

98100
.. code::
99101
@@ -130,7 +132,7 @@ For an introduction to color theory and how 'viridis' was generated
130132
watch Nathaniel Smith and Stéfan van der Walt's talk from SciPy2015.
131133
See `here for many more details <https://bids.github.io/colormap/>`__
132134
about the other alternatives and the tools used to create the color
133-
map. For details on all of color maps available in matplotlib see
135+
map. For details on all of the color maps available in matplotlib see
134136
:ref:`colormaps`.
135137

136138
.. raw:: html
@@ -162,7 +164,7 @@ The previous defaults can be restored by ::
162164

163165
mpl.rcParams['figure.facecolor'] = '0.75'
164166

165-
or setting ::
167+
or by setting ::
166168

167169

168170
figure.facecolor : '0.75'
@@ -173,7 +175,7 @@ in your :file:`matplotlibrc` file.
173175
Grid lines
174176
----------
175177

176-
The default style of grid lines was changed from, black dashed lines to thicker
178+
The default style of grid lines was changed from black dashed lines to thicker
177179
solid light grey lines.
178180

179181
.. plot::
@@ -192,7 +194,7 @@ The previous default can be restored by using::
192194
mpl.rcParams['grid.linestyle'] = ':'
193195
mpl.rcParams['grid.linewidth'] = 0.5
194196

195-
or setting::
197+
or by setting::
196198

197199
grid.color : k # grid color
198200
grid.linestyle : : # dotted
@@ -204,12 +206,12 @@ in your :file:`matplotlibrc` file.
204206
Figure size, font size, and screen dpi
205207
======================================
206208

207-
The default dpi used for on-screen display was changed from 80dpi to
208-
100dpi, the same as the default dpi for saving files. Due to this
209+
The default dpi used for on-screen display was changed from 80 dpi to
210+
100 dpi, the same as the default dpi for saving files. Due to this
209211
change, the on-screen display is now more what-you-see-is-what-you-get
210-
for saved files. To keep figure the same size in terms of pixels, in
212+
for saved files. To keep the figure the same size in terms of pixels, in
211213
order to maintain approximately the same size on the screen, the
212-
default figure size was reduced from 8in by 6in to 6.4in by 4.8in. As
214+
default figure size was reduced from 8x6 inches to 6.4x4.8 inches. As
213215
a consequence of this the default font sizes used for the title, tick
214216
labels, and axes labels were reduced to maintain their size relative
215217
to the overall size of the figure. By default the dpi of the saved
@@ -230,7 +232,7 @@ The previous defaults can be restored by ::
230232
mpl.rcParams['legend.fontsize'] = 'large'
231233
mpl.rcParams['figure.titlesize'] = 'medium'
232234

233-
or set::
235+
or by setting::
234236

235237
figure.figsize : [8.0, 6.0]
236238
figure.dpi : 80
@@ -249,14 +251,15 @@ Plotting functions
249251
``scatter``
250252
-----------
251253

252-
The following changes were made to the default behavior of `~matplotlib.axes.Axes.scatter`
254+
The following changes were made to the default behavior of
255+
`~matplotlib.axes.Axes.scatter`
253256

254257
- The default size of the elements in a scatter plot is now based on
255258
the rcParam ``lines.markersize`` so it is consistent with ``plot(X,
256259
Y, 'o')``. The old value was 20, and the new value is 36 (6^2).
257260
- scatter markers no longer have a black edge.
258-
- if the color of the markers is not specified it will follow the property cycle
259-
pulling from the 'patches' cycle on the ``Axes``.
261+
- if the color of the markers is not specified it will follow the
262+
property cycle, pulling from the 'patches' cycle on the ``Axes``.
260263

261264
.. plot::
262265

@@ -296,7 +299,7 @@ a per-call basis pass the following kwargs::
296299
The following changes were made to the default behavior of
297300
`~matplotlib.axes.Axes.plot`
298301

299-
- the default linewidth change from 1 to 1.5
302+
- the default linewidth increased from 1 to 1.5
300303
- the dash patterns associated with ``'--'``, ``':'``, and ``'-.'`` have
301304
changed
302305
- the dash patterns now scale with line width
@@ -405,7 +408,7 @@ in your :file:`matplotlibrc` file.
405408
Patch edges and color
406409
---------------------
407410

408-
Artists drawn with a patch (``~matplotlib.axes.Axes.bar``,
411+
Most artists drawn with a patch (``~matplotlib.axes.Axes.bar``,
409412
``~matplotlib.axes.Axes.pie``, etc) no longer have a black edge by
410413
default. The default face color is now ``'C0'`` instead of ``'b'``.
411414

@@ -435,7 +438,8 @@ default. The default face color is now ``'C0'`` instead of ``'b'``.
435438

436439
ax_bottom.set_xlim(0, .75)
437440
ax_bottom.set_ylim(0, .75)
438-
ax_bottom.add_artist(mpatches.Rectangle(grid[1] - [0.025, 0.05], 0.05, 0.1))
441+
ax_bottom.add_artist(mpatches.Rectangle(grid[1] - [0.025, 0.05],
442+
0.05, 0.1))
439443
ax_bottom.add_artist(mpatches.RegularPolygon(grid[3], 5, 0.1))
440444
ax_bottom.add_artist(mpatches.Ellipse(grid[4], 0.2, 0.1))
441445
ax_bottom.add_artist(mpatches.Circle(grid[0], 0.1))
@@ -496,13 +500,12 @@ Normal text
496500
-----------
497501

498502
The default font has changed from "Bitstream Vera Sans" to "DejaVu
499-
Sans". "DejaVu Sans" is an improvement on "Bistream Vera Sans" that
500-
adds more international and math characters, but otherwise has the
501-
same appearance. Latin, Greek, Cyrillic, Armenian, Georgian, Hebrew,
502-
and Arabic are `all supported
503-
<http://dejavu-fonts.org/wiki/Main_Page>`__ (but right-to-left rendering
504-
is still not handled by matplotlib). In addition , DejaVu contains a
505-
sub-set of emoji symbols.
503+
Sans". DejaVu Sans has additional international and math characters,
504+
but otherwise has the same appearance as Bitstream Vera Sans.
505+
Latin, Greek, Cyrillic, Armenian, Georgian, Hebrew, and Arabic are
506+
`all supported <http://dejavu-fonts.org/wiki/Main_Page>`__
507+
(but right-to-left rendering is still not handled by matplotlib).
508+
In addition, DejaVu contains a sub-set of emoji symbols.
506509

507510
.. plot::
508511

@@ -569,7 +572,7 @@ To revert to the old behavior set the::
569572
mpl.rcParams['mathtext.fontset'] = 'cm'
570573
mpl.rcParams['mathtext.rm'] = 'serif'
571574

572-
or by setting::
575+
or set::
573576

574577
mathtext.fontset: cm
575578
mathtext.rm : serif
@@ -587,9 +590,7 @@ Legends
587590

588591
- By default, the number of points displayed in a legend is now 1.
589592
- The default legend location is ``best``, so the legend will be
590-
automatically placed in a location to obscure the least amount of
591-
data possible.
592-
- The legend now has rounded corners by default.
593+
automatically placed in a location to minimize overlap with data.
593594
- The legend defaults now include rounded corners, a lighter
594595
boundary, and partially transparent boundary and background.
595596

@@ -645,7 +646,8 @@ or by setting::
645646
legend.fontsize : large
646647
legend.framealpha : None # opacity of legend frame
647648
legend.scatterpoints : 3 # number of scatter points
648-
legend.edgecolor : inherit # legend edge color (when 'inherit' uses axes.edgecolor)
649+
legend.edgecolor : inherit # legend edge color ('inherit'
650+
# means it uses axes.edgecolor)
649651

650652
in your :file:`matplotlibrc` file.
651653

@@ -656,7 +658,7 @@ Interpolation
656658
-------------
657659

658660
The default interpolation method for `~matplotlib.axes.Axes.imshow` is
659-
now ``'nearest'`` and by default resamples the data (both up and down
661+
now ``'nearest'`` and by default it resamples the data (both up and down
660662
sampling) before color mapping.
661663

662664

@@ -702,15 +704,15 @@ Colormapping pipeline
702704
Previously, the input data was normalized, then color mapped, and then
703705
resampled to the resolution required for the screen. This meant that
704706
the final resampling was being done in color space. Because the color
705-
maps are not generally linear in RGB space colors not in the color map
707+
maps are not generally linear in RGB space, colors not in the color map
706708
may appear in the final image. This bug was addressed by an almost
707-
complete overhaul of how the image handling code works.
709+
complete overhaul of the image handling code.
708710

709711
The input data is now normalized, then resampled to the correct
710-
resolution (in normalized dataspace), and then finally color mapped to
711-
RGB space. This ensures only colors actually in the color map appear
712-
in the final image (if your viewer subsequently resamples the image
713-
the artifact may reappear).
712+
resolution (in normalized dataspace), and then color mapped to
713+
RGB space. This ensures that only colors from the color map appear
714+
in the final image. (If your viewer subsequently resamples the image,
715+
the artifact may reappear.)
714716

715717
The previous behavior can not be restored.
716718

@@ -733,9 +735,9 @@ Direction
733735
~~~~~~~~~
734736

735737
To reduce the collision of tick marks with data, the default ticks now
736-
point outward by default. In addition, ticks are now only drawn on
737-
the bottom and left spines to reduce the plot looking like a
738-
porcupine.
738+
point outward by default. In addition, ticks are now drawn only on
739+
the bottom and left spines to prevent a porcupine appearance, and for
740+
a cleaner separation between subplots.
739741

740742

741743
.. plot::
@@ -796,9 +798,10 @@ Number of ticks
796798

797799
The default `~matplotlib.ticker.Locator` used for the x and y axis is
798800
`~matplotlib.ticker.AutoLocator` which tries to find, up to some
799-
maximum number, 'nicely' spaced ticks. In earlier version of matplotlib
800-
this computation did not take into account the space available for the
801-
tick label, which could result in overlapping text.
801+
maximum number, 'nicely' spaced ticks. The locator now includes
802+
an algorithm to estimate the maximum number of ticks that will leave
803+
room for the tick labels. By default it also ensures that there are at least
804+
two ticks visible.
802805

803806
.. plot::
804807

@@ -815,13 +818,9 @@ tick label, which could result in overlapping text.
815818
ax1.set_title('classic')
816819
ax2.set_title('v2.0')
817820

818-
819-
By default, the algorithm will also ensure that there are at least two
820-
ticks visible.
821-
822-
There is no way, other than using ``mpl.style.use('classic')`` to restore the
821+
There is no way, other than using ``mpl.style.use('classic')``, to restore the
823822
previous behavior as the default. On an axis-by-axis basis you may either
824-
mutate the existing locator via: ::
823+
control the existing locator via: ::
825824

826825
ax.xaxis.get_major_locator().set_params(nbins=9, steps=[1, 2, 5, 10])
827826

@@ -835,10 +834,10 @@ Auto limits
835834
-----------
836835

837836
The previous auto-scaling behavior was to find 'nice' round numbers
838-
that enclosed the data limits, however this could produce
839-
pathologically bad plots if the data happened to fall on a vertical or
840-
horizontal line near a 'round number'. The new default sets the
841-
view limits to 5% wider than the data range
837+
as view limits that enclosed the data limits, but this could produce
838+
bad plots if the data happened to fall on a vertical or
839+
horizontal line near the chosen 'round number' limit. The new default
840+
sets the view limits to 5% wider than the data range.
842841

843842
.. plot::
844843

@@ -865,13 +864,14 @@ view limits to 5% wider than the data range
865864
The size of the padding in the x and y directions is controlled by the
866865
``'axes.xmargin'`` and ``'axes.ymargin'`` rcParams respectively. Whether
867866
the view limits should be 'round numbers' is controlled by the
868-
``'axes.autolimit_mode'`` rcParam. The default value, ``'data'``,
869-
does not guaranteed that tick at the end of the view where as
870-
``'round_number'`` will. Also see `~matplotlib.axes.Axes.margins`.
871-
872-
Not all `~matplotlib.artist.Artist` classes make sense to add a margin to
873-
(for example a margin should not be added for a `~matplotlib.image.AxesImage`
874-
created with `~matplotlib.axes.Axes.imshow`). To control the applications of
867+
``'axes.autolimit_mode'`` rcParam. In the original ``'round_number'`` mode,
868+
the view limits coincide with ticks. With the new default value, ``'data'``,
869+
the outermost ticks will usually be inside the view limits, not at the ends.
870+
Also see `~matplotlib.axes.Axes.margins`.
871+
872+
For a few `~matplotlib.artist.Artist` classes, margins are undesirable.
873+
For example, a margin should not be added for a `~matplotlib.image.AxesImage`
874+
created with `~matplotlib.axes.Axes.imshow`. To control the application of
875875
the margins, the `~matplotlib.artist.Artist` class has gained the properties :
876876

877877
- `~matplotlib.artist.Artist.top_margin`
@@ -881,12 +881,12 @@ the margins, the `~matplotlib.artist.Artist` class has gained the properties :
881881
- `~matplotlib.artist.Artist.margins`
882882

883883
along with the complimentary ``get_*`` and ``set_*`` methods. When
884-
computing the view limits, each `~matplotlib.artist.Artist` that is
885-
considered is asked if it should have a margin applied on each side.
886-
If *any* artists does not want to have a margin added to a given side.
884+
computing the view limits, each `~matplotlib.artist.Artist` is checked.
885+
If *any* artist does not call for a margin on a given side, the margin
886+
will be omitted there.
887887
Some plotting methods and artists have margins disabled by default
888-
(for example `~matplotlib.axes.Axes.bar` disables the bottom margin). To cancel
889-
the margins by a specific artist, pass the kwargs :
888+
(for example `~matplotlib.axes.Axes.bar` disables the bottom margin).
889+
To cancel the margins for a specific artist, pass the kwargs :
890890

891891
- ``top_margin=False``
892892
- ``bottom_margin=False``
@@ -932,21 +932,21 @@ configurable through the ``date.autoformatter.*`` rcParams.
932932

933933

934934
+--------------------------------------+--------------------------------------+-------------------+-------------------+
935-
| Threshold (used if range > than) | rcParam | classic | v2.0 |
935+
| Threshold (tick interval >= than) | rcParam | classic | v2.0 |
936936
+======================================+======================================+===================+===================+
937-
| days per year (365) | ``'date.autoformatter.year'`` | ``'%Y'`` | ``'%Y'`` |
937+
| 365 days | ``'date.autoformatter.year'`` | ``'%Y'`` | ``'%Y'`` |
938938
+--------------------------------------+--------------------------------------+-------------------+-------------------+
939-
| days per month (30) | ``'date.autoformatter.month'`` | ``'%b %Y'`` | ``'%Y-%m'`` |
939+
| 30 days | ``'date.autoformatter.month'`` | ``'%b %Y'`` | ``'%Y-%m'`` |
940940
+--------------------------------------+--------------------------------------+-------------------+-------------------+
941941
| 1 day | ``'date.autoformatter.day'`` | ``'%b %d %Y'`` | ``'%Y-%m-%d'`` |
942942
+--------------------------------------+--------------------------------------+-------------------+-------------------+
943-
| 1 / hours per day | ``'date.autoformatter.hour'`` | ``'%H:%M:%S'`` | ``'%H:%M'`` |
943+
| 1 hour | ``'date.autoformatter.hour'`` | ``'%H:%M:%S'`` | ``'%H:%M'`` |
944944
+--------------------------------------+--------------------------------------+-------------------+-------------------+
945-
| 1 / minutes per day | ``'date.autoformatter.minute'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S'`` |
945+
| 1 minute | ``'date.autoformatter.minute'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S'`` |
946946
+--------------------------------------+--------------------------------------+-------------------+-------------------+
947-
| 1 / seconds per day | ``'date.autoformatter.second'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S'`` |
947+
| 1 second | ``'date.autoformatter.second'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S'`` |
948948
+--------------------------------------+--------------------------------------+-------------------+-------------------+
949-
| 1 / microseconds per day | ``'date.autoformatter.microsecond'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S.%f'`` |
949+
| 1 microsecond | ``'date.autoformatter.microsecond'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S.%f'`` |
950950
+--------------------------------------+--------------------------------------+-------------------+-------------------+
951951

952952

0 commit comments

Comments
 (0)