Changing grid lines to a solid line instead of dashed
    16 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Hi,
I have created the figures exactly how I want them however I cannot seem to find a way to change the grid lines from a dashed(default?) to a solid line, which is far more suitable for the application I am using the figure for. Also if it is possible, to change the color of the gridlines?
Thanks for any help in advance,
Mike Scott
0 Kommentare
Akzeptierte Antwort
  Matt Fig
      
      
 am 21 Apr. 2011
        Set the gridlinestyle property.
set(gca,'gridlinestyle','-')
As Matt Tearle has pointed out, you cannot change the grid lines color independent from the axis color. If you really want that, you should use colored lines instead of grids. For example:
plot(1:10)
axis([1 10 1 10]);
xt = get(gca,'xtick');
xl = get(gca,'xlim');
line(repmat(xt(2:end-1),2,1),repmat(xl(:),1,length(xt)-2),'color','red')
yt = get(gca,'ytick');
yl = get(gca,'ylim');
line(repmat(yl(:),1,length(yt)-2),repmat(yt(2:end-1),2,1),'color','g')
0 Kommentare
Weitere Antworten (1)
  Matt Tearle
    
 am 21 Apr. 2011
        set(gca,'GridLineStyle','-')
You can't change the gridline color independently of the axis color. The closest you can do is:
set(gca,'XColor',[0 0.5 0])
set(gca,'YColor','r')
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
			
	Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


