72373

matplotlib mac OSX 10.8 cuts off tick and axes labels

Question:

My installation of matplotlib is appears to be cutting off the tick mark labels and truncating axes labels. For example, the code sample for the plot has y-axis values from 0 to 20. The vertical axis seems to only print the left most digit, or left most digit with sign, 0, 5, 1, 1, 2 where it should be 0.0, 5.0, 10.0, 15.0, 20.0. The vertical axis label prints 'Amplitu' where it should be 'Amplitude, arb' Changing the font size or scaling the plot with window stretching does not change the behavior. The python code:

from numpy import arange, sin, pi from numpy import ma from matplotlib.pyplot import plot, show, title, xlabel, ylabel t = arange(0.0, 2.0, 0.01) s = 20*sin(2*pi*t) plot(t,s,'g') title("Sinewave Plot Example", fontsize=10) xlabel("Elapsed Time, arb", fontsize=10) ylabel("Amplitude, arb", fontsize=10) show()

This seems to be an installation/configuration problem rather than a coding problem. The above should work fine.

I have installed matplotlib, on Mac OSX 10.8 Mountain Lion, with the following order

sudo pip install numpy sudo pip install scipy sudo pip install matplotlib Downloading/unpacking matplotlib Downloading matplotlib-1.2.0.tar.gz (36.9MB): 36.9MB downloaded Running setup.py egg_info for package matplotlib basedirlist is: ['/usr/local/', '/usr', '/usr/X11', '/opt/local'] ============================================================================ BUILDING MATPLOTLIB matplotlib: 1.2.0 python: 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 01:25:11) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.7.0 freetype2: found, but unknown version (no pkg-config) OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) Tkinter: Tkinter: version not identified, Tk: 8.5, Tcl: 8.5 Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Mac OS X native: yes Qt: no Qt4: no PySide: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES dateutil: matplotlib will provide pytz: matplotlib will provide six: matplotlib will provide OPTIONAL USETEX DEPENDENCIES dvipng: no ghostscript: /bin/sh: gs: command not found latex: no [Edit setup.cfg to suppress the above messages]

When I try to save the plot from the Mac window, .png file, the following error is generated by the python interpreter (3.3 w/ipython)

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/backends/backend_macosx.py", line 475, in save_figure self.canvas.get_default_filename()) ValueError: character U+55002f is not in range [U+0000; U+10ffff] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 0: invalid continuation byte

Thanks in advance for any insight you can provide!

Answer1:

It is a <a href="https://github.com/matplotlib/matplotlib/issues/1737" rel="nofollow">known bug</a>. A solution might be to use Python 2.7.3.

Recommend

  • Postgres Database Local Installation / Running
  • How do I create a duplicate of an XML element, but change the name of the element and delete the ori
  • Android Emulator unusable slow
  • Installing Python packages/modules on Mac
  • Delete from two tables in one statement
  • Excel AddIn in Excel 2011 for MAC
  • Entitlements are not valid: Error while installing Ad Hoc build on Device
  • Concrete class implementing interface with lower access
  • Parse Google Maps Geocode API Using Json.Net
  • mapping joda timezone to windows timezone (for example in C#)
  • Segmentation Faults when Running MEX Files in Parallel
  • How to set Eclipse CDT to use GCC-4 instead of GCC?
  • Building a swift dictionary with a single array element for values causing cpu to die
  • Matlab Codegen Eig Function - Is this a Bug?
  • Consistent Client Side Date/timestamp using JavaScript(considering TimeZones)
  • Does installing gfortran with homebrew and with an installer create a conflict?
  • Eclipse Swing WindowBuilder returns error when trying to set border
  • emacs lisp will not start
  • Using JNA to Get NSWindow from JComponent on mac
  • NSOpenPanel's setDirectoryURL doesn't work on Lion
  • Matplotlib rotate image file by X degrees
  • Implementing HMAC-SHA256 for Keybase in Javascript
  • Objective C - Create a framework for my iphone apps?
  • Which browser have this strange user agent? (IOS device)
  • Varnish/Apache Random 503 Errors
  • OSX - always hide certain files
  • Unexpected token ILLEGAL while running node.js mocha test
  • Compiling dlib on OS X
  • How to generate and display a QR Code in ionic 2
  • How do I configure context broker accept post requests from my remote sensor?
  • Install PHP intl extension on MacOS
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Can I make an Android app that runs a web view in Chrome 39?
  • Updated Ionic CLI but shows previous version (Windows)
  • How can I estimate amount of memory left with calling System.gc()?
  • Matplotlib draw Spline from multiple points
  • Hits per day in Google Big Query