This trivial program was born in 2008 when one of my PhD collegue asked me if it was possible to plot single experimental points in a 2d space in MATLAB using a colormap. He wanted to plot “theoretical” points on a grid using the function pcolor and to plot the experimental points in a different way, like single circles at a determined location keeping the colormap.
This really simple program in MATLAB allows to plot a 2 variables function in Matlab, f(x,y), with circles with the color that codifies for the value of the function in that point.
The result is like the “pcolor” function in matlab, but with circles instead of squares.
An example is shown in the following figures (the function peaks with 30 by 30 points).
The program works in this way:
1. It takes X, Y (vectors) and Z (matrix)
2. It plots a circle at each point
3. It decides the color of the circles, depending on the value, using previously defined color map
Right now the colormap defined in the program are jet, hot and inverse thermal. In the future I will add more of those.
Example plotting the peaks function using pcolor and circlepcolor:
If you want to run the Matlab code, the syntax is:
where “colormap” can be: ‘jet’, ‘hot’, ‘therminv’.
If you want to see the help just write “help circlepcolor” in the folder with the file circlepcolor.m
This is experimental software released in public domain but without any warranty. I am not responsible for any use you can do with this sotware.
Please, if you see some errors in the code, let me know and I’ll try to fix them.