MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Locks
on 18 May 2013

Hi,

I am looking for a code that allows me to plot a figure where there are no value displayed on the x axis

I tried to use this code here:

set(gca,'xtick',[])

but that didn't work, any suggestions?

*No products are associated with this question.*

Answer by Azzi Abdelmalek
on 18 May 2013

Accepted answer

Maybe the order is not good

plot(1:3,1:3) set(gca,'xtick',[])

Locks
on 18 May 2013

I have this code

dates=datenum(dataSet(:,1));

%SPX SPX=dataSet(:,2); %VIX VIX=dataSet(:,3); plotyy(dates,SPX,dates,VIX); set(gca, 'xticklabel', []);

and this is not working

Azzi Abdelmalek
on 18 May 2013

x=0:100; y1=cos(x); y2=sin(x); [ax,h1,h2]=plotyy(x,y1,x,y2) set(ax,'xtick',[])

Answer by Image Analyst
on 18 May 2013

Try this:

set(gca, 'xtick', [-inf inf]);

Show 3 older comments

Locks
on 18 May 2013

dates=[1,2,3,4]

SPX=[0.1,0.2,0.1,0.2] VIX=[0.02,0.28,0.2,0.3]

%dates=datenum(dataSet(:,1)); %SPX %SPX=dataSet(:,2); %VIX %VIX=dataSet(:,3); plotyy(dates,SPX,dates,VIX); set(gca, 'xtick', [-inf inf]);

does not work either

Image Analyst
on 18 May 2013

It doesn't seem to work because you used plotyy() instead of plot(). Do you really need two y axes? Can you use one common one?

dates=[1,2,3,4]

SPX=[0.1,0.2,0.1,0.2] VIX=[0.02,0.28,0.2,0.3]

plot(dates,SPX,'gs-'); hold on; plot(dates,VIX, 'bd-'); set(gca, 'xtick', [-inf inf]);

## 0 Comments