+ Reply to Thread
Results 1 to 8 of 8

Consecutive months for X-axis labels

  1. #1
    Registered User
    Join Date
    02-21-2012
    Location
    Santa Barbara, California
    MS-Off Ver
    Excel 2013
    Posts
    17

    Consecutive months for X-axis labels

    I'd like to create an x-y scatter chart of stuff "y" on the vertical axis vs time "t" on the horizontal axis. t is to span two years. The vertical grid lines are to be spaced by 1 month. For 24 months it will be a rather long graph. Doing all that is easy.

    But I'd like the t axis labels to be the months in mmm format: Jan Feb Mar Apr ... . Each 3 letter month should be just below the t axis, centered between vertical grid lines.

    How do I do that?

    The potential axis format categories: Date, Special, and Custom, don't permit any type or format code to create that labeling.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Consecutive months for X-axis labels

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,515

    Re: Consecutive months for X-axis labels

    But I'd like the t axis labels to be the months in mmm format: Jan Feb Mar Apr ... . Each 3 letter month should be just below the t axis, centered between vertical grid lines.
    Are you required to use an xy scatter chart? It seems to me that this will be easier by using a line chart with a date axis.

    1) Make sure your dates are real date serial numbers and not some kind of text string (something like this if you are unfamiliar with how Excel stores dates and times: http://www.cpearson.com/Excel/datetime.htm
    2) Make a line chart with the dates as the horizontal axis and whatever as the value series.
    3) If Excel does not make these choices automatically, format the horizontal axis so that:
    3a) It is a date axis
    3b) with month as the base date
    3c) position axis between tick marks
    3d) number format as "mmm"
    3e) any other formats, as needed.

    That's how I would do it. If this much be an xy scatter chart and not a line chart, then we can talk about some more complex things to give the same effect, but they will definitely be more difficult.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    02-21-2012
    Location
    Santa Barbara, California
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: Consecutive months for X-axis labels

    Attached is spreadsheet "ChartAxisProblem.xlsx" with typical data, and two graph types.

    The data lines are of different lengths (different time durations); that is a critical feature of the data.
    I think that means a line plot is not useable (or at least I don't know how to make it work).

    So I still have the x-axis labeling problem. Suggestions welcome.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,515

    Re: Consecutive months for X-axis labels

    Here's what I did:

    1) As I noted above, it will be important for your dates to be true date serial numbers and not text strings. Your "dates" are text strings, so I used the DATEVALUE() function to convert the text strings to date serial numbers (again, review the link above if you are unfamiliar with how Excel stores and uses dates and times).
    2) With the dates converted to serial numbers, I rearranged the data into a table like
    Please Login or Register  to view this content.
    3) Select this table and insert a line chart
    3a) In my copy of Excel, Excel did not recognize that the dates should be the x axis data, so I opened the select data dialog and made sure that the column of dates was the horizontal axis data.
    4) Format the axis so that the base unit is days, and the major unit is 1 month.
    5) Other formats as needed.

  6. #6
    Registered User
    Join Date
    02-21-2012
    Location
    Santa Barbara, California
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: Consecutive months for X-axis labels

    In reply to MrShorty 08-05-2018, 11:22 pm

    Attached file "ChartAxisProblem2.xlsx" shows latest attempts.

    The line chart would be good, but, even though I selected "Solid line" on the "Format Data Series" page, no line displays. Why not? A Trendline extends beyond the data points and is not usable for my purposes.

    The X-Y Scatter Chart looks pretty good.

    On both charts the X-axis type is Date. The Number Category is Custom, with ad hoc Type " "mmm. The four spaces before mmm shifts mmm slightly to the right and aligns the beginning of mmm with the grid line. I made this up because I couldn't find a more direct way to get the result. If there is a more direct way, I'd be glad to use it.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,515

    Re: Consecutive months for X-axis labels

    even though I selected "Solid line" on the "Format Data Series" page, no line displays. Why not?
    I am not sure why it works this way (I don't use line charts much myself), but I went into the "hidden and empty cells" dialog and found that it had "gaps" selected. I selected the "connect data points with line" setting and the lines appeared. I don't understand it (there are no "gaps" in the data in the spreadsheet -- perhaps Excel is thinking that you do not have data for the days/months in between so it considers those "gaps"), but that seemed to fix that concern. https://support.office.com/en-us/art...b-9ca49cb92274

    Technically, both charts are not using a date axis, though you are using a "date" type number format for the labels. The line chart uses a date axis, where you have told it to place a tick mark+grid line for the first of each month. The scatter chart uses a value axis which doesn't really know what "months" are, and you have instructed it to give you a tick mark + grid line every 31 days (5 Jan, 5 Feb, 8 Mar, 8 Apr, 9 May, etc.). This is fine, except that, when formatted as "mmm", the reader does not know what date corresponds to the gridline, and may misinterpret something. For example, the Aug 17, 2019 point on the line chart is about halfway between the grid lines marked Aug and Sep. I would tend to naturally assume that this means that this date is about halfway through August. On the scatter chart, this point is about right on the grid line marked Aug, so I might assume it is very close to 1 Aug. Only you would know if this is a real concern for you. My inclination would be to stick with the line chart with a date axis rather than the scatter chart.

    FWIW, I think your number formatting with the spaces is probably the easiest way to shift those axis labels.

  8. #8
    Registered User
    Join Date
    02-21-2012
    Location
    Santa Barbara, California
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: Consecutive months for X-axis labels

    In reply to MrShorty post of 08-08-2018:

    OK, I've got a graph that works fine now.
    Thanks for your help, especially the idea of a "diagonal matrix" data format to use a line chart.
    That would not have occurred to me.
    Much obliged.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Centering Years, Months, Weeks, or labels between X-Axis Tick Marks.
    By Cerbera79 in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 09-21-2015, 08:31 AM
  2. [SOLVED] Need graph to show alphanumeric values as Y axis labels with Date as Z axis labels
    By Ochimus in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 06-24-2015, 08:40 PM
  3. Replies: 3
    Last Post: 04-30-2014, 05:57 AM
  4. Changing individual axis labels on the same axis (vba?)
    By sikey in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-07-2010, 06:08 AM
  5. Consecutive #ing of Labels
    By Desert Diva in forum Excel General
    Replies: 1
    Last Post: 07-25-2005, 07:55 PM
  6. how to put x axis values in the chart instead of x axis labels
    By Sinclair in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-21-2005, 06:05 AM
  7. i need to add consecutive months and keep the day the same for ea.
    By Jason in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-21-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1