h***q 发帖数: 1673 | 1 在一幅图里面画了很多条曲线,如何自动为他们分配颜色以示区别? | j**u 发帖数: 6059 | 2 我的一个作法是,建立一个字符串数组,然后每画一道曲线,就取一个字符作为颜色。
【在 h***q 的大作中提到】 : 在一幅图里面画了很多条曲线,如何自动为他们分配颜色以示区别?
| s***t 发帖数: 195 | 3 matlab by default use different colors for different lines if you
plot them in one plot function.
if you want to use your own colors, you can define a color matrix (Nx3)
in rgb colors. each time take a row from that matrix and plot using that
color by plot(x, y, 'Color', colors(ii,:)).
you can also get the default line colors used by matlab by
colors = colormap('Lines')
【在 h***q 的大作中提到】 : 在一幅图里面画了很多条曲线,如何自动为他们分配颜色以示区别?
| h***q 发帖数: 1673 | 4 Great idea!
【在 s***t 的大作中提到】 : matlab by default use different colors for different lines if you : plot them in one plot function. : if you want to use your own colors, you can define a color matrix (Nx3) : in rgb colors. each time take a row from that matrix and plot using that : color by plot(x, y, 'Color', colors(ii,:)). : you can also get the default line colors used by matlab by : colors = colormap('Lines')
| s*****o 发帖数: 26 | 5 我试了一下,同一幅图中最多自动支持7种不同的颜色,如果超过7条曲线,就自动重复
默认的7种颜色。这是怎么回事呢?
【在 s***t 的大作中提到】 : matlab by default use different colors for different lines if you : plot them in one plot function. : if you want to use your own colors, you can define a color matrix (Nx3) : in rgb colors. each time take a row from that matrix and plot using that : color by plot(x, y, 'Color', colors(ii,:)). : you can also get the default line colors used by matlab by : colors = colormap('Lines')
| s***t 发帖数: 195 | 6 those are just matlab default "Lines" color map. you can define your own.
【在 s*****o 的大作中提到】 : 我试了一下,同一幅图中最多自动支持7种不同的颜色,如果超过7条曲线,就自动重复 : 默认的7种颜色。这是怎么回事呢?
|
|