Mohammadreza Hadizadeh

Importing colormaps from python (matplotlib) into Matlab on Macbook

This post shows step-by-step instructions on importing different classes of colormaps from python (Matplotlib) into Matlab using PyColormap4Matlab.
  1. Download the PyColormap4Matlab library from the following link:
  2. Rename the package to PyColormap4Matlab,
  3. Copy & paste the new folder in your Documents as /Documents/MATLAB/PyColormap4Matlab,
  4. Open the MATLAB application and link the new folder PyColormap4Matlab to it using the "Home > Set Path" tab in the top menu. Next, click "Add Folder" and select /Documents/MATLAB/PyColormap4Matlab, then click on Open, Save, and Close.
  5. Install the “Matplotlib" library. To do so, enter the command "pip3 install matplotlib" in the terminal. For other options, check
  6. Now, you can import the colormaps from Matplotlib to MATLAB. The following MATLAB script imports the colormap Greys from Matplotlib to MATLAB. The name of the new colormap in MATLAB is cl_Greys:
  • # set the Python path
  • path_python = '/usr/bin/python3';
  • # importing Greys colormap from Matplotlib
  • cl_Greys = getPyPlot_cMap('Greys', [], [], path_python);
  • Hint: to find the Python path (for variable "path_python") enter the "which python3" command in the terminal.


Matlab loads, but "freezes" after taking Java update in Mac OS X

Pasted Graphic 6

After taking the Java update via the App store, Matlab will launch and open the last file, however, it will freeze and don't open any file. This is a Java issue and reinstalling Matlab or a new user profile will not resolve.
- Affects MATLAB 2012b and earlier, with the Java for OS X 2013-004 update - The original update gives build 1.6.0_51-b11-456-10M4508 - This can be verified by running the command below in terminal and comparing the build
$ java -version
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java(TM) SE Runtime Environment (build
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-456-10M4508)

SOLUTION - Apple's update has been fixed, however, it is not being pushed via updates to clients already affected. It is now safe to update via the Appstore, Java for OS X 2013-004 is the package. - If you are stuck on version 10M4508, you can manually update:
* for 10.7/10.8:
for 10.6: