Change grid Line Width (2024)

478 views (last 30 days)

Show older comments

Faruk on 8 Oct 2014

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width

Commented: Adam Danz on 20 Jun 2023

Accepted Answer: Toshia M

Hi, I used default axes line width as 1.5 in Matlab2014a and my grids were fine. When I increase the axes line width in Matlab2014b, it increases the grid line width and create a very ugly plot specially if I save it as eps or pdf. How can I set axes line width to 1.5 and and grid line width to 0.5 Thank you

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Toshia M on 17 Mar 2023

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_1195450

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_1195450

Open in MATLAB Online

Starting in R2023a, you can change the thickness of grid lines independently of the box outline and tick marks by setting the GridLineWidth property of the axes. For example:

You can also set the minor grid line width by setting the MinorGridLineWidth property. For more information on both of these axes properties, see Axes properties.

2 Comments

Show NoneHide None

AK Nahin on 20 Jun 2023

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_2788254

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_2788254

Open in MATLAB Online

It is showing this error. I cannot find any solution. Even Example in axis properties also shows the same error.

Unrecognized property 'GridLineWidth' for class 'matlab.graphics.axis.Axes'.

Change grid Line Width (5)

Adam Danz on 20 Jun 2023

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_2789089

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_2789089

As @Toshia M mentioned, this functionality became available in MATLAB R2023a. Check your MATLAB release using the ver function or look at the upper left corner of the MATLAB desktop.

Sign in to comment.

More Answers (3)

Star Strider on 8 Oct 2014

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_154394

Edited: Star Strider on 8 Oct 2014

Open in MATLAB Online

According to the Axis Properties documentation for R2014b, the axes and grid line widths are all set by the LineWidth property. Setting the GridAlpha or GridColor properties to make them less prominent is probably the best you can do.

EDIT — There may be a way to get around it though if you don’t mind a slightly cumbersome solution.

Assuming this is the effect you want:

x = linspace(0,10*pi,250);

y = sin(0.1*x).*cos(5*x);

plot(x,y, '-r')

grid

hold on

xl = xlim;

yl = ylim;

plot(xl,ones(1,2)*yl(1), '-k', ones(1,2)*xl(1), yl,'-k', 'LineWidth',1.5) % Left & Lower Axes

plot(xl,ones(1,2)*yl(2), '-k', ones(1,2)*xl(2), yl,'-k', 'LineWidth',1.5) % Right & Upper Axes

hold off

produces:

Change grid Line Width (8)

2 Comments

Show NoneHide None

Tiago Dias on 12 Jan 2018

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_524040

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_524040

How to make it work when i have datetime in the XAxis? it doenst work because my X is datatime

Alutsyah Luthfian on 12 Sep 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_1006210

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#comment_1006210

Thanks man... you are very helpful

Sign in to comment.

Md Zillur Rahman on 15 Oct 2015

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_196020

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_196020

you can solve this issue by using

GridAlpha — Grid-line transparency 0.15 (default) | value in the range [0,1] Grid-line transparency, specified as a value in the range [0,1]. A value of 1 means opaque and a value of 0 means completely transparent.

Setting this property sets the associated mode property to manual.

Example: ax.GridAlpha = 0.5

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

matt dash on 8 Oct 2014

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_154441

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/157863-change-grid-line-width#answer_154441

I think Yair Altman just covered this today... there are unlisted "ruler" properties that let you directly control the axes lines: http://undocumentedmatlab.com/blog/customizing-axes-rulers

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLABGraphics2-D and 3-D PlotsLine Plots

Find more on Line Plots in Help Center and File Exchange

Tags

  • grid line width
  • r2014bgraphics

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Change grid Line Width (13)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

Change grid Line Width (2024)

FAQs

How do I change the grid line size in Word? ›

Select View > More. In the Ruler & Grid box, select Fine, Normal, or Coarse for Grid spacing Horizontal and Grid spacing Vertical. Note: Fine is the smallest grid spacing, and Coarse is the largest. Select OK.

How to increase the thickness of a grid in Matlab? ›

Direct link to this answer
  1. you can solve this issue by using.
  2. GridAlpha — Grid-line transparency 0.15 (default) | value in the range [0,1] Grid-line transparency, specified as a value in the range [0,1]. ...
  3. Setting this property sets the associated mode property to manual.
  4. Example: ax.GridAlpha = 0.5.
Oct 8, 2014

What is the meaning of grid lines? ›

Gridlines are horizontal and vertical lines that appear on a computer screen, spreadsheet, or graph to help users align and organize data or elements. They serve as visual guides to assist in accurately placing objects and understanding the structure of a document or interface.

How to make gridlines darker in Matlab? ›

You need to modify the GridAlpha property as well so that the grid lines are actually opaque. The default value is 0.15 so even though they are black they appear gray since they are transparent. You'll want to use a GridAlpha value of 1 .

How do I change the line width in Word? ›

On the Shape Format tab, select Shape Outline. Note: If you don't see the Shape Format tab, make sure you've selected the line. Point at Weight, then select the line weight that you want. To create a custom line weight, click More Lines, and then choose the options that you want.

How do I adjust gridlines? ›

Click the chart, and then click the Chart Design tab. Click Add Chart Element > Gridlines. Choose the axis that you want to apply the gridlines to or click More Gridline Options to open the Format Major Gridlines pane. You can change the line transparency, add arrows, and apply shadow, glow, and soft edge effects.

How do I increase the width of a column grid? ›

To change it, select a column, go to 'Format' in the toolbar, and choose 'Column Width'. Input the desired number of characters you want the column to fit, like '12', to widen it accordingly.

How do I make the grid lines thicker in numbers? ›

Change the table outline and gridlines
  1. Click the table, then in the Format sidebar, click the Table tab.
  2. Do any of the following: Change the outline: In the Table Outline section of the sidebar, use the controls to change the line type, thickness, and color.

How do I increase the thickness of gridlines in Excel? ›

Select one or more cells that have a border that you want to change. Right-click over the cells you've chosen and select Format Cells and, in the popup window, click the Border tab. For a continuous line, choose one of the thicker styles from the Line box.

What are the two types of grid lines? ›

Grid lines help viewers of the chart see what value is represented by an unlabeled data point. Especially for large or complicated charts, grid lines give valuable cues to the viewer. Grid lines come in two types: major and minor.

What is the grid answer? ›

Answer : Grid system is basically a set of imaginary and horizontal and vertical lines drawn on a map. The horizontal lines are called latitudes and the vertical lines are called longitudes. The grid system is used to find the exact location of a place.

What is a grid line in layout? ›

Definition of GRIDLINES:

A grid is a set of guidelines (or "gridlines") that are visible in a document or template during the design process but are not visible when that document or template is printed. These lines are used to align elements on a page in order to produce the required layout for printing.

How do I change the grid in MATLAB? ›

Display the grid lines in a particular direction by accessing the Axes object and setting the XGrid , YGrid , and ZGrid properties. Set these properties to either 'on' or 'off' . Create a 2-D plot and display the grid lines only in the y direction. y = rand(10,1); bar(y) ax = gca; ax.

Why do we use grid on in MATLAB? ›

grid on displays the major grid lines for the current axes returned by the gca command. Major grid lines extend from each tick mark. grid off removes all grid lines from the current axes or chart. grid toggles the visibility of the major grid lines.

How do I make my gridlines darker? ›

Click File > Excel > Options. In the Advanced category, under Display options for this worksheet, make sure that the Show gridlines check box is selected. In the Gridline color box, click the color you want. Tip: To return gridlines to the default color, click Automatic.

How do I change the size of rows in Word? ›

On the Layout tab, in the Cell Size group, click in the Table Row Height box, and then specify the height you want.

How do I change the gridlines in a table in Word? ›

Showing or hiding table gridlines shows or hides gridlines for every table in your document. Unlike table borders, you can't print table gridlines with your document. Click the table. Click the Table Layout tab, and then under Settings, click Gridlines.

How do I change the grid view in Word? ›

To show the gridlines, in Excel, PowerPoint, or Word, click the View tab, and then check the Gridlines box. To hide the gridlines, clear the Gridlines check box.

How do I resize a horizontal line in Word? ›

If you want to format the horizontal line, click on the line once and use the sizing arrows to resize it. Or, double-click on the line to open the Format Horizontal Line box where you can modify the line width, height, color, and alignment.

Top Articles
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 5372

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.