help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: linestyle and gridlines


From: William Krekeler
Subject: RE: linestyle and gridlines
Date: Fri, 3 Dec 2010 15:03:54 +0000

Chris,

You're right, it is hard to get to the grid line properties. Here is a work 
around that will break if you zoom in on the graph so you'll have to update it 
each time the graph axis changes.


xLocations = get( gca, 'XTick' );
yExtent = get( gca, 'YLim' );
h2 = zeros( 1, length(xLocations) );
% don't modify first or last because at edge of the graph
% better code would test that xLocations(1) and (end) are == XLim property
% I leave that to you to fix
for nX = 2:(length(xLocations) -1 )     
   GridLine = yExtent(1):(diff(yExtent)/100):yExtent(2);
   hold on, h2(nX) = plot( repmat( xLocations(nX), 1,numel(GridLine) ), 
GridLine, 'r--' ), hold off
end

% use the handle h2 to modify the grid lines to your heart's content

For nX = 2:(length(h2) -1 )
   Set( h2(nX), 'PropertyName', 'PropertyValue' );
end


Bill Krekeler
Electro-Optics Engineer
CET, LLC
address@hidden


-----Original Message-----
From: chris [mailto:address@hidden 
Sent: Friday, December 03, 2010 6:31 AM
To: William Krekeler
Subject: RE: linestyle and gridlines

I'm trying to make the lines inside the box thicker, the lines that show
up when you type the command grid on.

On Thu, 2010-12-02 at 17:35 +0000, William Krekeler wrote:
> Chris,
> 
> Not sure which grid lines you want but I think this is what you are referring 
> to
> x = sin(1:10);
> figure, plot(x);
> get( get(gcf,'children'), 'linewidth' )       % current value
> set(get(gcf,'children'), 'linewidth', 3 )     % set the outer box width to 3
> 
> The figure is a parent to a bunch of objects. Calling get(object_handle) 
> gives you the properties and current value of all properties for that object.
> 
> Bill Krekeler
> 
> -----Original Message-----
> From: chris [mailto:address@hidden 
> Sent: Thursday, December 02, 2010 8:46 AM
> To: address@hidden
> Subject: linestyle and gridlines
> 
> I started out searching for a way to make my grid lines thicker or
> darker so my students could see them more clearly using a projector. I
> still haven't figured out how to do that, so any help would be great. In
> the process, I noticed the linestyles and linewidth commands, but when I
> type linewidth 2 or linestyles : nothing happens. Am I misunderstanding
> how to use these commands? do they have to be included in my plot
> command? any help would be much appreciated.
> 
> Thanks
> Chris
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave





reply via email to

[Prev in Thread] Current Thread [Next in Thread]