-1

I want to plot using Matlab. There are several dots and they will be connected by line.

I want my very first dot away from Y-axis instead of falling on y-axis so it will be more clear for me. What do I need to add? Or what's the key word can help me to find the answer? Thanks!

The MWE is

    testnum= [ 2^10       2^11       2^12       2^13       2^14       2^15 ] ;
    phi1= [ 4.3745e-07 1.8016e-07 1.0875e-07 5.1560e-08 3.2037e-08 7.1904e-09]; 
    phi2= [ 4.3308e-07 2.1389e-07 3.2324e-08 2.5070e-08 7.5555e-09 1.5486e-09];
    plot(log2(testnum),log10(phi1),'-o',log2(testnum),log10(phi2),'-+') ;
Ying
  • 1,894
  • 1
  • 14
  • 20

1 Answers1

1

You can change the limit of the x-axis using xlim (or more general you can use axis.).

xlim([0 20]);

For more future proof you can also do something like:

margin = 5;
axis([min(x)-margin max(x)+margin min(y)-margin max(y)+margin]);
mpaskov
  • 1,234
  • 2
  • 11
  • 21
  • Thanks! That work! JFYI, since my x-axis are plotting log2, xlim is something like `xlim([9 16])` not the original value `xlim([2^9 2^16])` – Ying Nov 15 '16 at 15:33
  • Sure I went a little overboard with `[0 20]`, but you got the idea. If you are happy with the answer please mark it answered. – mpaskov Nov 15 '16 at 15:36