Question about plotting same network multiple times in subplot with same color range

2 views (last 30 days)
Hello, thanks for looking at this,
I have a question about plotting a patched line network multiple times (one reference, one slightly different, etc) and have the color range for the second one be reflective of the first in terms of its caxis.
This is sort of what I mean, look here. All of the ranges of values are different for each of the subplots, but the colormaps are determined by each individual subplot. What I want to have is one colormap that all subplots reference and color for accordingly
This is what I do currently:
For each subplot, I
  • Determine a colormap (this is probably the problem here, as the colormap is unique to each subplot)
  • patch('Vertices', ptMx, 'Faces', faceMx, 'FaceVertexCData', color_array, 'EdgeColor', 'interp');
where the color_array is the indexed coordinates of the colormap depending on the values. I do this because this is more or less what I grew up learning.
So for the 800Hz plot earlier, the maxes are lower and the mins are lower. But the maxes are just as red as any other subplot reds.
Any advice? Thanks!

Answers (1)

Star Strider
Star Strider on 7 Jun 2016
I don’t completely understand what you’re doing.
You can define the levels of your colormap. The default jet colormap is colormap(jet(64)), but I believe you can go to colormap(jet(256)). That would provide you a greater range or colours. Experiment!
Star Strider
Star Strider on 7 Jun 2016
Yes. However it gives you more options.
Scaling with the same colormap would probably give you the result you want.
Alternatively, to create custom colormaps, you could create a custom colormap for each plot by simply choosing the appropriate scaled row range of the colormap(jet(256)) matrix (or whatever number of values want). That essentially scales the colormap to the data, rather than the data to the colormap (my initial approach). That would probably give you the same result as scaling the data, and, especially since creating a custom colormap for each plot is what you want to do, might be an easier approach.
So if you had a maximum of 150 values, one plot could be defined to use the first 50 rows of the colormap, another the first 75, and so forth.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by