0

I am trying to plot with coutourf() but with xscale in logarithm :

contourf(data);
set(gca,'XScale','log');

But as I set the xscale I'm loosing the filling (became kind of a contour but without color). I try to use the GUI for plot and I have the same result

UPDATE: I think I narrow down the problem. It was because I used an x value starting at 0. Here is my exemple (lower one is exactly the same data but just putting xcale in log)

You can't get the same result with:

a = peaks(100);
x=0:99;
y=1:100;
[X,Y]=meshgrid(x,y);
contourf(X,Y,a);
set(gca,'XScale','log');

I think this is due to the very tailed distribution in my data and the linear split with colorbar. Any idea to keep x starting at 0 ? Have a logscale colorbar ? (I try to replace it by eps but still not very nice). Thanks

PS: I can't put another link here is my data: www.filedropper.com/dd_3

Rafnuss
  • 119
  • 1
  • 14
  • Please show us what the image looks like. I don't think you have enough reputation to post the image, so link us to an external site and I'll modify the post to include the image. Also, to diagnose your problem, it's preferable that it be reproducible. Can you show us what the data look like too? – rayryeng Jun 06 '14 at 01:58
  • Well, what did you expect with `log(0)=-inf` ? you need to decided where you want to truncate, or add 0.1 to x. You can also set `xlim([1 99])` instead... – bla Jun 07 '14 at 00:31
  • The colorbar should adjusted according the value in my matrix (`a` in my case). And even if I put my x-axis from 0.0001 to 100 (and not zero), it shouldn't change the color. – Rafnuss Jun 09 '14 at 22:45

1 Answers1

1

Works fine for me...

a = peaks(100);
contourf(a,20);
set(gca,'XScale','log');

enter image description here

bla
  • 25,846
  • 10
  • 70
  • 101