PyColormap4Matlab

버전 1.4.1 (276 KB) 작성자: Konrad
Simple Matlab and python script that import colormaps from matplotlib into Matlab.
다운로드 수: 3.3K
업데이트 날짜: 2022/2/17

PyColormap4Matlab

Simple Matlab and python script that import colormaps from matplotlib into Matlab.

getPyPlot_cMap returns any colormap implemented in the matplotlib python library. It calls a python script that writes the colormap matrix into a temporary file, i.e. python (and the matplotlib module) is required. However, the advantage is that you get all the colormaps implemented in matplotlib and that you can specify the number of RGB quantization levels, i.e. the number of colors of the colormap.

A list of colormap names is provided in the function help section. getPyPlot_cMap('!GetNames') returns a cellstring containing all available colormap names. See https://matplotlib.org/examples/color/colormaps_reference.html for an illustration of colormaps.

Also available on View PyColormap4Matlab on File Exchange

Usage

cMapNames = getPyPlot_cMap('!GetNames')
Returns a cellstring containing all available colormap names.

cMap = getPyPlot_cMap(cMapName)
Returns the colormap cMapName with the default of 128 colors. cMap will be a 128x3 matrix.

cMap = getPyPlot_cMap(cMapName, NumberOfColors)
Specify the number of colors, i.e. the number of rows in cMap.

cMap = getPyPlot_cMap(cMapName, NumberOfColors, keepAlphaChannel)
If keepAlphaChannel is not 0 cMap has a 4th column containing the alpha channel.

cMap = getPyPlot_cMap(cMapName, NumberOfColors, keepAlphaChannel, pythonSystemCommand)
Lets you specify the python command (possibly including a path, see below) used to execute the python script.

Errors

If you have python installed but Matlab says There was an error executing the command... System returned:... you can try to pass the path to your python installation explicitly as the 4th parameter, e.g.:

cmp = getPyPlot_cMap('Accent', [], [], '"c:\Program Files\Python37\python.exe"');

Note the double-quotes around the path, which are neccessary because of the containing space character.

인용 양식

Konrad (2024). PyColormap4Matlab (https://github.com/f-k-s/PyColormap4Matlab/releases/tag/v1.4.1), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2015a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.4.1

See release notes for this release on GitHub: https://github.com/f-k-s/PyColormap4Matlab/releases/tag/v1.4.1

1.4

improve error handling for the system-cmd

1.3.2

list of colormap names in help section of .m-file updated

1.3.1

Added Live Script

1.3.0

Fixed issue when path to python script contain white spaces or special characters.
Thanks to Piercarlo!

Updated Description.

1.2.0

List of colormap names (when retrieved with !getNames) is now generated by python script instead of hard-coded in Matlab script.

1.1.0

getNames implemented

1.0.2

Description updated

1.0.1

Image added (taken from matplotlib.org)

1.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.