Clear Filters
Clear Filters

non rectangular density plots

1 view (last 30 days)
pfb
pfb on 4 Aug 2011
Hi all,
I have to produce density plots like those obtained e.g. with imagesc, but on a triangular domain. That is: the "pixels" of my image lay on a triangular instead of a rectangular lattice. Of course I could use imagesc, filling only one half of a rectangular lattice (matrix), but this choice is not as aesthetically appealing and hides the symmetry of the problem. I get a rectangular triangle instead of an equilateral one.
What I'm doing now is plotting '.' markers at the sites of the triangular lattice, and then adding custom-made axes. The result is sort of ok, but I have some problems. For one the image is very "heavy" since I must individually plot a huge number of "pixels". Second, I cannot think of any means of changing the color code, like colormap(somemap) does. The color of each individual '.' marker is set at the moment of the plotting, and I have no idea as to how to have it respond to a colormap command.
I'd be really interested in any suggestion on ways of changing the colormap. I thought of using (exceedingly tiny) hexagonal patches instead of markers, but I guess that would make the image even bigger.
Thanks a lot for your help
Francesco

Accepted Answer

Walter Roberson
Walter Roberson on 4 Aug 2011
scatter() and pass a vector as the C parameter instead of passing an RGB matrix. The result will be colormap sensitive.
  1 Comment
pfb
pfb on 9 Aug 2011
Thanks a lot Walter,
I do not know how I could miss the scatter function after so many years of matlab use.
As you suggest, scatter does exactly what I need. It has the same effect of the function I created *and* is colormap (and clim!) sensitive.
Thanks again

Sign in to comment.

More Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!