From: Travis on 19 Feb 2010 18:04 "Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hlmtg0$lf2$1(a)fred.mathworks.com>... > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlmg0r$gvm$1(a)fred.mathworks.com>... > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlkhg4$qi6$1(a)fred.mathworks.com>... > > > "Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hli2sd$cvm$1(a)fred.mathworks.com>... > > > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlhoht$hqo$1(a)fred.mathworks.com>... > > > > > I have the mapping toolbox, a georeferenced .tif file and data with lat/long and I can't for the life of me figure out how to plot the data onto the image. I have gone through many of the examples in the mapping toolbox, and still no glory. Any help would be greatly appreciated. > > > > > > > > Travis, > > > > > > > > Do you have the .tfw (world file) for your image? If so, you could try this: > > > > > > > > im=imread('foo.tif'); > > > > r=wolrdfileread('foo.tfw'); > > > > [xim,yim]=pixcenters(r,size(im)); > > > > > > > > figure > > > > imagesc(xim,yim,im); > > > > set(gca,'ydir','normal',... > > > > 'da',[1 1 1]) > > > > > > > > Note that this is plotting the data on a regular axes, not a map axes (which I have found to be cumbersome to deal with). > > > > > > > > -Andrew > > > > > > This works well, but when I do a colorbar it default to 0:255 with the map colors, and the data points follor that colorsystem. Is there a way to change this? > > > > OK, my last message seems vague to me now. What I am trying to do is have the colorbar apply only to the data I plot on the map/image, and not to the map/image itself. That would scale the colorbar properly from the start. > > Travis, > > One option is to convert the image to RGB. I do this routinely using REAL2RGB, available on the file exchange. Once your image is RGB, the colormap and 'clim' property of the axis no longer applies. > > -Andrew I have the image as a .tif file right now. I Import it with the code provided above, and it comes in as an XxYx3 uint8, which is what it looks like real2rgb does. I have the mapping toolbox, but I cannot find a way to do this in there either.
From: Andrew Stevens on 19 Feb 2010 19:19 "Travis " <sinusoid2(a)hotmail.com> wrote in message <hln5d4$l59$1(a)fred.mathworks.com>... > "Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hlmtg0$lf2$1(a)fred.mathworks.com>... > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlmg0r$gvm$1(a)fred.mathworks.com>... > > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlkhg4$qi6$1(a)fred.mathworks.com>... > > > > "Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hli2sd$cvm$1(a)fred.mathworks.com>... > > > > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlhoht$hqo$1(a)fred.mathworks.com>... > > > > > > I have the mapping toolbox, a georeferenced .tif file and data with lat/long and I can't for the life of me figure out how to plot the data onto the image. I have gone through many of the examples in the mapping toolbox, and still no glory. Any help would be greatly appreciated. > > > > > > > > > > Travis, > > > > > > > > > > Do you have the .tfw (world file) for your image? If so, you could try this: > > > > > > > > > > im=imread('foo.tif'); > > > > > r=wolrdfileread('foo.tfw'); > > > > > [xim,yim]=pixcenters(r,size(im)); > > > > > > > > > > figure > > > > > imagesc(xim,yim,im); > > > > > set(gca,'ydir','normal',... > > > > > 'da',[1 1 1]) > > > > > > > > > > Note that this is plotting the data on a regular axes, not a map axes (which I have found to be cumbersome to deal with). > > > > > > > > > > -Andrew > > > > > > > > This works well, but when I do a colorbar it default to 0:255 with the map colors, and the data points follor that colorsystem. Is there a way to change this? > > > > > > OK, my last message seems vague to me now. What I am trying to do is have the colorbar apply only to the data I plot on the map/image, and not to the map/image itself. That would scale the colorbar properly from the start. > > > > Travis, > > > > One option is to convert the image to RGB. I do this routinely using REAL2RGB, available on the file exchange. Once your image is RGB, the colormap and 'clim' property of the axis no longer applies. > > > > -Andrew > > I have the image as a .tif file right now. I Import it with the code provided above, and it comes in as an XxYx3 uint8, which is what it looks like real2rgb does. I have the mapping toolbox, but I cannot find a way to do this in there either. If your image is already RGB, then the figure's colormap should not affect it's display. You may just want to adjust the 'clim' property of your axis: set(gca,'clim',[cmin cmax]) %cmin and cmax are the color limits you want to apply or caxis([cmin cmax]) -Andrew
From: Travis on 22 Feb 2010 10:46
"Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hln9po$qep$1(a)fred.mathworks.com>... > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hln5d4$l59$1(a)fred.mathworks.com>... > > "Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hlmtg0$lf2$1(a)fred.mathworks.com>... > > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlmg0r$gvm$1(a)fred.mathworks.com>... > > > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlkhg4$qi6$1(a)fred.mathworks.com>... > > > > > "Andrew Stevens" <astevens(a)JUNKusgs.gov> wrote in message <hli2sd$cvm$1(a)fred.mathworks.com>... > > > > > > "Travis " <sinusoid2(a)hotmail.com> wrote in message <hlhoht$hqo$1(a)fred.mathworks.com>... > > > > > > > I have the mapping toolbox, a georeferenced .tif file and data with lat/long and I can't for the life of me figure out how to plot the data onto the image. I have gone through many of the examples in the mapping toolbox, and still no glory. Any help would be greatly appreciated. > > > > > > > > > > > > Travis, > > > > > > > > > > > > Do you have the .tfw (world file) for your image? If so, you could try this: > > > > > > > > > > > > im=imread('foo.tif'); > > > > > > r=wolrdfileread('foo.tfw'); > > > > > > [xim,yim]=pixcenters(r,size(im)); > > > > > > > > > > > > figure > > > > > > imagesc(xim,yim,im); > > > > > > set(gca,'ydir','normal',... > > > > > > 'da',[1 1 1]) > > > > > > > > > > > > Note that this is plotting the data on a regular axes, not a map axes (which I have found to be cumbersome to deal with). > > > > > > > > > > > > -Andrew > > > > > > > > > > This works well, but when I do a colorbar it default to 0:255 with the map colors, and the data points follor that colorsystem. Is there a way to change this? > > > > > > > > OK, my last message seems vague to me now. What I am trying to do is have the colorbar apply only to the data I plot on the map/image, and not to the map/image itself. That would scale the colorbar properly from the start. > > > > > > Travis, > > > > > > One option is to convert the image to RGB. I do this routinely using REAL2RGB, available on the file exchange. Once your image is RGB, the colormap and 'clim' property of the axis no longer applies. > > > > > > -Andrew > > > > I have the image as a .tif file right now. I Import it with the code provided above, and it comes in as an XxYx3 uint8, which is what it looks like real2rgb does. I have the mapping toolbox, but I cannot find a way to do this in there either. > > If your image is already RGB, then the figure's colormap should not affect it's display. You may just want to adjust the 'clim' property of your axis: > > set(gca,'clim',[cmin cmax]) %cmin and cmax are the color limits you want to apply > > or > > caxis([cmin cmax]) > > -Andrew Occam's Razor strikes again. Thanks, that works perfectly Andrew. |