Skip to content

[EHN] Add tick rcparams #5158

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

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1b243ed
Merge pull request #5215 from tacaswell/tst_drop_old_pythons
jenshnielsen Oct 28, 2015
cdea77c
Merge pull request #5295 from mdboom/too-many-open-files
tacaswell Oct 29, 2015
60b60fb
Merge pull request #5301 from zblz/fix-dot-space
mdboom Oct 29, 2015
5fc3ce5
Merge branch 'v1.5.x' into v2.0.x
mdboom Oct 30, 2015
454c330
Merge pull request #5299 from mdboom/faster-character-mapping
tacaswell Oct 30, 2015
9d61a67
Merge branch 'v1.5.x' into v2.0.x
mdboom Nov 2, 2015
c5ce72a
Merge remote-tracking branch 'upstream/v1.5.x' into v2.0.x
mdboom Nov 4, 2015
19de414
Merge remote-tracking branch 'matplotlib/v1.5.x' into v2.0.x
tacaswell Nov 5, 2015
1866a8c
Merge pull request #5373 from jenshnielsen/python26removal
tacaswell Nov 5, 2015
a340827
Merge pull request #5361 from mdboom/fast-text
tacaswell Nov 5, 2015
c9fbfab
Merge pull request #5410 from mdboom/get-charmap-removal
tacaswell Nov 5, 2015
c22614e
Merge pull request #5412 from tacaswell/cp_font_cmap
WeatherGod Nov 5, 2015
d730481
Merge pull request #5306 from mdboom/local-freetype
jenshnielsen Nov 5, 2015
bf51375
Merge branch 'v1.5.x' into v2.0.x
mdboom Nov 5, 2015
4a2a186
Merge pull request #5214 from zblz/dejavu-mathtext
mdboom Nov 6, 2015
5129136
Merge pull request #5432 from mdboom/fix-segfault-in-text-drawing
jenshnielsen Nov 8, 2015
696ff9f
Merge pull request #5436 from jenshnielsen/backport5432
jenshnielsen Nov 8, 2015
b720325
Merge pull request #5439 from mdboom/default-font-fix
jenshnielsen Nov 8, 2015
2623b24
Merge pull request #5443 from jenshnielsen/backport5439
jenshnielsen Nov 8, 2015
d561d2e
Merge branch 'v1.5.x' into v2.0.x
mdboom Nov 9, 2015
a158bf6
Add tick rcparms (top/bottom and left/right) to control where the tic…
Tillsten Sep 29, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dist
.eggs
# tox testing tool
.tox
setup.cfg

# OS generated files #
######################
Expand Down
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ language: python

matrix:
include:
- python: 2.6
env: NUMPY=numpy==1.6 MOCK=mock
- python: 2.7
env: MOCK=mock PANDAS=pandas
- python: 3.3
env: MOCK=mock NUMPY=numpy==1.6
- python: 3.4
- python: 3.5
env: PANDAS=pandas
- python: 2.7
env: TEST_ARGS=--pep8
- python: 2.7
Expand Down Expand Up @@ -84,7 +82,7 @@ install:
# version since is it basically just a .ttf file
# The current Travis Ubuntu image is to old to search .local/share/fonts so we store fonts in .fonts

# We install ipython to use the console highlighting. From IPython 3 this depends on jsonschema and misture.
# We install ipython to use the console highlighting. From IPython 3 this depends on jsonschema and mistune.
# Neihter is installed as a dependency of IPython since they are not used by the IPython console.
- |
if [[ $BUILD_DOCS == true ]]; then
Expand All @@ -98,7 +96,11 @@ install:
cp tmp/usr/share/fonts/truetype/humor-sans/Humor-Sans.ttf ~/.fonts
cp Felipa-Regular.ttf ~/.fonts
fc-cache -f -v
else
# Use the special local version of freetype for testing
cp .travis/setup.cfg .
fi;

- python setup.py install

script:
Expand Down
2 changes: 2 additions & 0 deletions .travis/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
local_freetype=True
6 changes: 5 additions & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@ libpng 1.2 (or later)
`pytz`
Used to manipulate time-zone aware datetimes.

:term:`freetype` 2.3 or later
:term:`FreeType` 2.3 or later
library for reading true type font files.

``cycler`` 0.9 or later
Composable cycle class used for constructing style-cycles

`functools32`
Required for compatibility if running on versions of Python before
Python 3.2.


Optional GUI framework
^^^^^^^^^^^^^^^^^^^^^^
Expand Down
27 changes: 16 additions & 11 deletions doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ Optionally you can install:

- `pep8 <http://pep8.readthedocs.org/en/latest>`_ to test coding standards

Building matplotlib for image comparison tests
----------------------------------------------

matplotlib's test suite makes heavy use of image comparison tests,
meaning the result of a plot is compared against a known good result.
Unfortunately, different versions of FreeType produce differently
formed characters, causing these image comparisons to fail. To make
them reproducible, matplotlib can be built with a special local copy
of FreeType. This is recommended for all matplotlib developers.

Add the following content to a ``setup.cfg`` file at the root of the
matplotlib source directory::

[test]
local_freetype = True

Running the tests
-----------------

Expand Down Expand Up @@ -185,17 +201,6 @@ decorator:
If some variation is expected in the image between runs, this
value may be adjusted.

Freetype version
----------------

Due to subtle differences in the font rendering under different
version of freetype some care must be taken when generating the
baseline images. Currently (early 2015), almost all of the images
were generated using ``freetype 2.5.3-21`` on Fedora 21 and only the
fonts that ship with ``matplotlib`` (regenerated in PR #4031 / commit
005cfde02751d274f2ab8016eddd61c3b3828446) and travis is using
``freetype 2.4.8`` on ubuntu.

Known failing tests
-------------------

Expand Down
4 changes: 2 additions & 2 deletions doc/glossary/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Glossary
EPS
Encapsulated Postscript (`EPS <http://en.wikipedia.org/wiki/Encapsulated_PostScript>`_)

freetype
`freetype <http://www.freetype.org/>`_ is a font rasterization
FreeType
`FreeType <http://www.freetype.org/>`_ is a font rasterization
library used by matplotlib which supports TrueType, Type 1, and
OpenType fonts.

Expand Down
15 changes: 7 additions & 8 deletions doc/users/mathtext.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ in Donald Knuth's TeX, so the quality is quite good (matplotlib also
provides a ``usetex`` option for those who do want to call out to TeX
to generate their text (see :ref:`usetex-tutorial`).

Any text element can use math text. You should use raw strings
(precede the quotes with an ``'r'``), and surround the math text with
dollar signs ($), as in TeX. Regular text and mathtext can be
interleaved within the same string. Mathtext can use the Computer
Modern fonts (from (La)TeX), `STIX <http://www.aip.org/stixfonts/>`_
fonts (with are designed to blend well with Times) or a Unicode font
that you provide. The mathtext font can be selected with the
customization variable ``mathtext.fontset`` (see
Any text element can use math text. You should use raw strings (precede the
quotes with an ``'r'``), and surround the math text with dollar signs ($), as in
TeX. Regular text and mathtext can be interleaved within the same string.
Mathtext can use DejaVu Sans (default), DejaVu Serif, the Computer Modern fonts
(from (La)TeX), `STIX <http://www.aip.org/stixfonts/>`_ fonts (with are designed
to blend well with Times), or a Unicode font that you provide. The mathtext
font can be selected with the customization variable ``mathtext.fontset`` (see
:ref:`customizing-matplotlib`)

.. note::
Expand Down
11 changes: 0 additions & 11 deletions doc/users/plotting/colormaps/Lfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@


mpl.rcParams.update({'font.size': 12})
mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans, '
'Lucida Grande, Verdana, Geneva, Lucid, '
'Helvetica, Avant Garde, sans-serif')
mpl.rcParams['mathtext.fontset'] = 'custom'
mpl.rcParams['mathtext.cal'] = 'cursive'
mpl.rcParams['mathtext.rm'] = 'sans'
mpl.rcParams['mathtext.tt'] = 'monospace'
mpl.rcParams['mathtext.it'] = 'sans:italic'
mpl.rcParams['mathtext.bf'] = 'sans:bold'
mpl.rcParams['mathtext.sf'] = 'sans'
mpl.rcParams['mathtext.fallback_to_cm'] = 'True'


### Red, original Albers plot
Expand Down
11 changes: 0 additions & 11 deletions doc/users/plotting/colormaps/grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
import matplotlib as mpl

mpl.rcParams.update({'font.size': 14})
mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans, '
'Lucida Grande, Verdana, Geneva, Lucid, '
'Helvetica, Avant Garde, sans-serif')
mpl.rcParams['mathtext.fontset'] = 'custom'
mpl.rcParams['mathtext.cal'] = 'cursive'
mpl.rcParams['mathtext.rm'] = 'sans'
mpl.rcParams['mathtext.tt'] = 'monospace'
mpl.rcParams['mathtext.it'] = 'sans:italic'
mpl.rcParams['mathtext.bf'] = 'sans:bold'
mpl.rcParams['mathtext.sf'] = 'sans'
mpl.rcParams['mathtext.fallback_to_cm'] = 'True'


# indices to step through colormap
Expand Down
11 changes: 0 additions & 11 deletions doc/users/plotting/colormaps/lightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
import matplotlib as mpl

mpl.rcParams.update({'font.size': 12})
mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans, '
'Lucida Grande, Verdana, Geneva, Lucid, '
'Helvetica, Avant Garde, sans-serif')
mpl.rcParams['mathtext.fontset'] = 'custom'
mpl.rcParams['mathtext.cal'] = 'cursive'
mpl.rcParams['mathtext.rm'] = 'sans'
mpl.rcParams['mathtext.tt'] = 'monospace'
mpl.rcParams['mathtext.it'] = 'sans:italic'
mpl.rcParams['mathtext.bf'] = 'sans:bold'
mpl.rcParams['mathtext.sf'] = 'sans'
mpl.rcParams['mathtext.fallback_to_cm'] = 'True'

# indices to step through colormap
x = np.linspace(0.0, 1.0, 100)
Expand Down
6 changes: 3 additions & 3 deletions doc/users/screenshots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ Mathtext_examples

Below is a sampling of the many TeX expressions now supported by matplotlib's
internal mathtext engine. The mathtext module provides TeX style mathematical
expressions using `freetype2 <http://www.freetype.org/>`_
and the BaKoMa computer modern or `STIX <http://www.stixfonts.org>`_ fonts.
See the :mod:`matplotlib.mathtext` module for additional details.
expressions using `FreeType <http://www.freetype.org/>`_
and the DejaVu, BaKoMa computer modern, or `STIX <http://www.stixfonts.org>`_
fonts. See the :mod:`matplotlib.mathtext` module for additional details.

.. plot:: mpl_examples/pylab_examples/mathtext_examples.py

Expand Down
2 changes: 1 addition & 1 deletion doc/users/text_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ expressions, truetype support for raster and vector outputs, newline
separated text with arbitrary rotations, and unicode support. Because
we embed the fonts directly in the output documents, e.g., for postscript
or PDF, what you see on the screen is what you get in the hardcopy.
`freetype2 <http://www.freetype.org/>`_ support
`FreeType <http://www.freetype.org/>`_ support
produces very nice, antialiased fonts, that look good even at small
raster sizes. matplotlib includes its own
:mod:`matplotlib.font_manager`, thanks to Paul Barrett, which
Expand Down
5 changes: 5 additions & 0 deletions doc/users/whats_new/faster-text-rendering.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Faster text rendering
---------------------

Rendering text in the Agg backend is now less fuzzy and about 20%
faster to draw.
14 changes: 14 additions & 0 deletions doc/users/whats_new/new_default_font.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Change in default font
----------------------

The default font used by matplotlib in text has been changed to DejaVu Sans and
DejaVu Serif for the sans-serif and serif families, respectively. The DejaVu
font family is based on the previous matplotlib default --Bitstream Vera-- but
includes a much wider range of characters.

The default mathtext font has been changed from Computer Modern to the DejaVu
family to maintain consistency with regular text. Two new options for the
``mathtext.fontset`` configuration parameter have been added: ``dejavusans``
(default) and ``dejavuserif``. Both of these options use DejaVu glyphs whenever
possible and fall back to STIX symbols when a glyph is not found in DejaVu. To
return to the previous behavior, set the rcParam ``mathtext.fontset`` to ``cm``.
6 changes: 6 additions & 0 deletions doc/users/whats_new/ticks_rcparams.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
New rcParams
------------

The parameters `xtick.top`, `xtick.bottom`, `ytick.left`
and `ytick.right` were added to control where the ticks
are drawn.
2 changes: 1 addition & 1 deletion examples/api/font_family_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
and for the font.family you set a list of font styles to try to find
in order::

rcParams['font.sans-serif'] = ['Tahoma', 'Bitstream Vera Sans',
rcParams['font.sans-serif'] = ['Tahoma', 'DejaVu Sans',
'Lucida Grande', 'Verdana']

"""
Expand Down
2 changes: 1 addition & 1 deletion examples/misc/font_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


#fname = '/usr/share/fonts/sfd/FreeSans.ttf'
fname = matplotlib.get_data_path() + '/fonts/ttf/Vera.ttf'
fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans.ttf'
font = FT2Font(fname)
font.set_charmap(0)

Expand Down
3 changes: 1 addition & 2 deletions examples/misc/ftface_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


#fname = '/usr/local/share/matplotlib/VeraIt.ttf'
fname = matplotlib.get_data_path() + '/fonts/ttf/VeraIt.ttf'
fname = matplotlib.get_data_path() + '/fonts/ttf/DejaVuSans-Oblique.ttf'
#fname = '/usr/local/share/matplotlib/cmr10.ttf'

font = ft.FT2Font(fname)
Expand Down Expand Up @@ -63,5 +63,4 @@

print(dir(font))

cmap = font.get_charmap()
print(font.get_kerning)
7 changes: 1 addition & 6 deletions examples/misc/multiprocess.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# Demo of using multiprocessing for generating data in one process and plotting
# in another.
# Written by Robert Cimrman
# Requires >= Python 2.6 for the multiprocessing module or having the
# standalone processing module installed

from __future__ import print_function
import time
try:
from multiprocessing import Process, Pipe
except ImportError:
from processing import Process, Pipe
from multiprocessing import Process, Pipe
import numpy as np

import matplotlib
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/font_table_ttf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- noplot -*-
"""
matplotlib has support for freetype fonts. Here's a little example
matplotlib has support for FreeType fonts. Here's a little example
using the 'table' command to build a font table that shows the glyphs
by character code.

Expand Down Expand Up @@ -29,7 +29,7 @@
fontname = sys.argv[1]
else:
fontname = os.path.join(matplotlib.get_data_path(),
'fonts', 'ttf', 'Vera.ttf')
'fonts', 'ttf', 'DejaVuSans.ttf')

font = FT2Font(fontname)
codes = list(font.get_charmap().items())
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ax = plt.subplot(111, axisbg='y')
plt.plot(t, x)
plt.text(0.5, 0.5, 'matplotlib', color='r',
fontsize=40, fontname=['Courier', 'Bitstream Vera Sans Mono'],
fontsize=40, fontname=['Courier', 'DejaVu Sans Mono'],
horizontalalignment='center',
verticalalignment='center',
transform=ax.transAxes,
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/text_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def f(t):
xtext = plt.xlabel('time (s)')

plt.setp(ttext, size='large', color='r', style='italic')
plt.setp(xtext, size='medium', name=['Courier', 'Bitstream Vera Sans Mono'],
plt.setp(xtext, size='medium', name=['Courier', 'DejaVu Sans Mono'],
weight='bold', color='g')
plt.setp(ytext, size='medium', name=['Helvetica', 'Bitstream Vera Sans'],
plt.setp(ytext, size='medium', name=['Helvetica', 'DejaVu Sans'],
weight='light', color='b')
plt.show()
19 changes: 16 additions & 3 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ def _forward_ilshift(self, other):


major, minor1, minor2, s, tmp = sys.version_info
_python26 = (major == 2 and minor1 >= 6) or major >= 3
_python27 = (major == 2 and minor1 >= 7)
_python34 = (major == 3 and minor1 >= 4)

if not _python26:
raise ImportError('matplotlib requires Python 2.6 or later')
if not (_python27 or _python34):
raise ImportError('matplotlib requires Python 2.7 or 3.4 or later')


if not compare_versions(numpy.__version__, __version__numpy__):
Expand Down Expand Up @@ -1487,6 +1488,18 @@ def verify_test_dependencies():
if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'tests')):
raise ImportError("matplotlib test data is not installed")

# The version of FreeType to install locally for running the
# tests. This must match the value in `setupext.py`
LOCAL_FREETYPE_VERSION = '2.6.1'

from matplotlib import ft2font
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
ft2font.__freetype_build_type__ != 'local'):
warnings.warn(
"matplotlib is not built with the correct FreeType version to run "
"tests. Set local_freetype=True in setup.cfg and rebuild. "
"Expect many image comparison failures below.")

try:
import nose
try:
Expand Down
Loading