Is it possible to use a section of a colormap?
显示 更早的评论
I am using a Matlab gui the has multiple graphs. One of these graphs is a smith chart, which plots coordinates in the complex plane. Each graph is plotted using a custom plot_colorfade(x,y,varargin) function. This function uses the default colormap "jet" and plots the collection of coordinates that are gathered from an external file as a color fade. Right now I have implemented a zoom function that when used on a first graph (tag: handles.del_pwr) it takes the new x (time) limits in a ActionPostCallback and redraws the smith chart with these new time limits.
Whenever I use the zoom feature I can focus on a section of the colorfade. However, when the smith chart is redrawn with the new x limits the colorfades between the two graphs do not match. For example, I can focus on the green-yellow section of the standard blue to red 'jet' colormap. When this happens, the limits of the smith chart are drawn to the new x limits of the handles.del_pwr graph but the color fade remains as the standard "jet" color fade (blue to red) regardless of the starting/ending point.
What I am wondering is if it is possible to use only a section of the "jet" colormap? (From my example above, I would want the green-yellow section for the smith chart starting at the same x coordinates as the handles.del_pwr graph colorfade). If hiding points of a graph without disturbing the colormap is possible that could potentially be a solution too.
Note: Using something such as linkaxes when zooming is not possible in this case because the smith chart and handles.del_pwr graphs don't use the same coordinate systems.
I can post the code for my plot_colorfade function and elaborate more if it is needed.
2 个评论
Sean de Wolski
2013-10-22
It's certainly possible. If you could provide a simple minimal working example, it would help us a lot.
It sounds to me like you'll need to set a few properties of the various lines, and perhaps change the CDataMapping property in order to force the limits. However, and example would clarify this.
Matthew
2013-10-22
采纳的回答
更多回答(1 个)
John Barber
2013-10-22
编辑:John Barber
2013-10-22
0 个投票
The caxis function lets you adjust the axes' color limits ( CLim property), which determine the range of data values that are mapped to the colormap (for plots using 'scaled' CDataMapping, but not 'direct' ). See here for details: www.mathworks.com/help/matlab/ref/caxis.html.
类别
在 帮助中心 和 File Exchange 中查找有关 Color and Styling 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!