- Download the PyColormap4Matlab library from the following link: https://www.mathworks.com/matlabcentral/fileexchange/68239-pycolormap4matlab
- Rename the package to PyColormap4Matlab,
- Copy & paste the new folder in your Documents as /Documents/MATLAB/PyColormap4Matlab,
- 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.
- Install the “Matplotlib" library. To do so, enter the command "
pip3 install matplotlib" in the terminal. For other options, check https://www.geeksforgeeks.org/how-to-install-matplotlib-on-macos/
- 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.
- For a list of Matplotlib colormaps, check the following link: https://matplotlib.org/stable/tutorials/colors/colormaps.html
- In the following pictures, prepared by Kamyar Mohseni, different classes of Matplotlib colormaps are compared together and also with MATLAB colormaps.
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.
Context - 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 1.6.0_51-b11-457-11M4509)
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: http://support.apple.com/kb/DL1572
* for 10.6: http://support.apple.com/kb/DL1573