Excel plot diagram with variable time points - excel

I'm trying to plot a diagram with varying timestamps (the diff of timepoints are variable). And I would like to show the variability in the X axis, so the distance of timestamps be reflected on the diagram. For instance, my data is like this (time points in milliseconds):
time value
---------
0 102
3 104
15 121
29 123
59 111
78 110
So once I plot it, I want the distance of timestamps be shown accordingly, like the plot below.
How can I do that? I have thousands of points like this.

If you highlight your data set (including the headings), you can go to Insert and then click the dialog box launcher to get chart options.
(see the blue square to the right)
From there, you'll get a popup screen like this:
You can then go through and see what chart will work best for you. You'll be able to modify your data, colors, etc. from the new Design and Format tabs that appear on the ribbon when you click anywhere within the newly created chart.
*I'm running Office 365 ProPlus, but the steps are similar in other versions of Excel

Related

Excel Chart - Do not Hide Horizontal Data Label

I want to plot a simple chart with Date on the X axis and Number on my Y axis. Tried XY scatter but Excel try to be smart and hide my data labels.
Also, Excel tried to re-order my Date which I do not want.
Date POS
22/10/2017 7
01/10/2017 14
08/09/2017 8
11/08/2017 6
28/07/2017 4
09/07/2017 3
26/06/2017 4
09/06/2017 11
19/05/2017 8
23/04/2017 8
02/04/2017 5
19/03/2017 1
19/02/2017 3
05/02/2017 10
30/01/2017 8
08/01/2017 3
20/11/2016 13
11/11/2016 7
28/10/2016 12
16/10/2016 5
30/09/2016 7
16/09/2016 3
27/08/2016 8
14/08/2016 13
24/07/2016 3
17/07/2016 7
17/06/2016 2
27/05/2016 4
24/04/2016 16
10/04/2016 1
27/03/2016 2
04/03/2016 4
19/02/2016 4
24/01/2016 1
03/01/2016 1
Would like to see everything. Is it possible ?
Thanks.
To answer your questions:
Brief:
1) You can't see all your data labels on the X axis unless you format the X axis to have major interval of 1.
2) With a scatter plot, you cannot have your original labels retained on the X axis and, in your case, as your dates are recognised , they are ordered as such. You would need to convert the dates to text and plot as a line chart without the line.
Solution:
1) Right click X axis and set the major interval to a balance between the amount of detail you want to see and that which is legible. To see all data points, with data that are whole numbers, then 1 should do it, but may become very crowded, so a trade-off.
2) To stop the re-ordering of your dates: The trick is to convert your dates to text using =TEXT(A2,"dd/mm/yy") where A2 is a data point for the X axis etc. In the picture below, this is showing above B39, as I have transposed your original dataset, but the formula was pointing at your original vertical dataset. If that makes sense.
You arrange your data horizontally with each data point in its own column (i.e. transpose your original data set) and then plot this as a line chart and right click format data series > no line. Making sure markers are visible.
On an old Mac with Excel 2011, similar process for Windows and later Excel, removing the line would look like:
And you can select a line colour and add it back in:
Reference i gave in comments which reminded me to transpose the data is scatter-chart-with-one-text-non-numerical-axis
To be honest, if you are going to plot a line chart which has one axis which appears to be dates, it may confuse users if those dates are not then in order.
I recommend to convert all values to date and graph away with standard scatter plot...if you treat the dates as text, and then graph only the entries, then the variance between the dates can be very misleading (unless there are no gaps, 100% consistent).
Below is a snippit of text and of dates with your provided data. It is nearly identical, but not quite. If your data set is larger and there is larger variation between date entries then it will definitely provide a misleading chart.
If you go with the text path, change to line chart, hide line, set color to markers, and put the max interval to 1.
If you go with the date path, then you will not be able to read the x-axis with each date explicitly stated. There would be too many dates to display. You could add data labels to display in the plot area instead of the x-axis, but it is clutter.
You have stumbled across what many also find, that Excel stinks as a graphing tool. This is because about 10 years ago, Micro Soft went stupid and started trying to make software that is "really helpful for the user" translate "makes stupid decisions we don't want". One case in point is your problem.
Excel Line charts are not line charts; they are bar charts that just use lines instead of bars. The issue at hand is how different chart types treat the X-Axis. How you treat the X-Axis determines what kind of chart you use. There are basically only two kinds of X-Axis: discreet/continuous (aka. category/value). For example category would be something like color (RED/BLUE/GREEN). There is no "distance between colors" (what is the distance between red and blue?). Where as numbers and time have a concept of distance inherent in them. For example: how many days are there between jan-1-2001 and jan-10-2001? or What is the distance from the 10 yard line and the 20 yard line?
The problem is that to use charts in Excel, you have to know how each chart type treats the X-Axis. Most people would expect the LINE chart to treat the X-Axis as a value, but MS is not most people so they decided to treat it like a category (unless it is a date more on that in a moment). So, you cannot plot a number X-Axis on a line chart. You should use the XY SCATTER chart instead. Scatter chart in Excel assumes both axis are numbers and thus plots your numeric X-Axis in the expected manner.
if you use a line chart (or bar chart) and you double click your x-axis values, or right click them, you can go to their format axis page where you will see that you have the choice of treating the x-axis as text or dates, but not numbers. This is why when you sort your data differently in a line chart or bar chart, the chart changes, it is because the x-axis is being treated as a category and categories are plotted on the chart in the order they are seen in the data. This can be very useful when your x-axis really is a category but then if that were so you would most likely be using bar charts not line charts. My experience is that BAR charts and LINE charts in Excel behave exactly the same so consider that when thinking about using a line chart.
if your x-axis is a category use bar chart or pivot table and exploit sorting.
if your x-axis is a date use bar/line chart and mark it as date in format-axis page.
if your x-axis is a number use scatter chart.
if your data is something else, or you have a specific perspective you want to emphasize, then do some reading about the different chart types in Excel and pick the one that was created to show what you want to show.

excel scatter plot incorrect due to wrong format values

I've been trying the most simple of things, creating a scatter plot in excel.
I have one x-values and on set of y-values. Yet somehow excel thinks it knows better and creates its own set of x-values ranging between 0-10. Whereas my x-values range between 40-140. Manually changing the limits of the x-axis to 40 - 140 simply makes it so I don's see my data points any more, since excel change my x-values.
Label X Y
A 47 3.5
B 95 40.5
C 47 10.5
D 95 21.5
E 91 21.5
F 45 18.5
G 91 61.5
H 45 0.5
I 130 40.5
J 90 10.5
See picture for clarification.
How do I fix this!?
When copying and pasting data into a column it is important to ensure your data is coming across in the right format to be recognized by Excel. Simply setting the format in the ribbon to numeric from general does not change the way the data is stored. It merely changes the way the data is displayed.
When excel gets data in an unexpected format, strange things happen. Scatter plots become line plots because its seeing the X-axis as text instead of numbers. One way to spot this is if the numbers are not on the right side of the cell when no formatting has been applied to the cell. Another test would be to use a formula like the ones below assuming your data is in cell C3:
=ISTEXT(C3)
or
=ISNUMBER(C3)
On a side note, any number stored as text that is sent through a math operation will be converted to a number for the calculation. So one trick to convert a number stored as text is to use something like:
=C3+0
=C3*1
=--C3
Another option for converting columns of numbers stored as text is to use the Text-to-columns feature in the ribbon. On the last step it will give you the option to format the expected output to something excel will usually handle. This is really good for bringing across dates that are text and need to be converted, or numbers containing thousand separators like , or [space].
The most reliable method that I have found to ensure that the data to be plotted is numeric is to insert a 1 in an empty cell, copy it with ctrl-C, select the columns and choose Paste Special > Multiply. Any text data becomes numeric.
After verifying all my X (any Y) values were actually numbers, I found a solution:
Right click on plot, Change Chart Type (FYI: Scatter with Straight lines was already selected), Change to Line Type.
Now repeat. Right click on plot, Change Chart Type, Change back to Scatter
You will lose the X axis Minimum and Maximum Bounds and the "Vertical axis crosses" value, but at least this works!
FINALLY I FOUND AN ANSWER THAT HELPS HERE.
use =VALUE(cell reference) to make sure the xAxis values are seen by excel as numbers. Until this was done, my xAxis numbers were just spaced evenly across the axis.

Plot lines on an Excel chart

I need to plot a line between two points on an excel spreadsheet. In my ideal world, it'd become a thin box with colors and text, but at this stage, I'll take what I can get.
Data:
min max value
1 2 28
2 3 64
3 5 87
4 7 99
In the end, there would be lines from {1,28} to {2,28}, {2,64} to {3,64}, {3,87} to {5,87} and {4,99} to {7,99}.
Flipping the axes in Excel, apparently, doesn't leave the original axes intact - it goes to numbering the data.
If you rearrange the data as shown in the animated gif below and then make separate plots for each min/max pair, you get the lines drawn just as you described. I show adding just the last min/max pair, and added labels for the sake of a legend. This seems to do what you described, but if not let me know.

Excel - Bar Chart with horizontal reference line on each bar

I want to create a bar chart that compares groups at 2 points in time, t1 vs t2. But instead of having them side by side, I want to have t2(now) as a bar and t1(before) as a horizontal line.
Similar to what you can do with Tableau (for those who use it). Except it does not have to be Horizontal Bar Chart, can be just the normal vertical one.
Here is an example of the dataset that I have and how I need it to look like.
Metric WeekEnding Bucket1 Bucket2 Bucket3 Bucket4
Debt 16/09/2016 88 126 116 89
Debt 23/02/2017 61 87 65 82
First, it looks like your chart does not reflect your data in two ways. The bars look like they are for series 16/09/2016, but you said the bars should reflect t2 (now), and the other series is more recent. Also, the lines don't seem to reflect either series--for example, in Bucket 2, the line segment is somewhere around 115, and that is neither series 1 nor series 2. So, in my response below, my resulting image is somewhat different from your chart.
One way to do this is to make a 2D clustered column chart, change the t1 series to XY scatter, then make the marker a line segment and make the segment as wide as you need it (unfortunately I don't see a way to increase the width without changing the height).
More detail (note that my instructions are using Excel 2013): First, select the chart data and choosing "2D clustered column type". Then right-click one of the bars from the t1 series and choose "Change Series Chart Type". Then change the t1 series to "Scatter" (i.e., XY scatter), and uncheck "Secondary Axis" to plot the series on the same axis. Then right-click a t1 series point, choose "Format Data Series", and under "Marker Options", choose the line segment marker type under "Built-In". Increase the size as high as necessary. You can reduce the border width and that will reduce the width slightly.
Here is the resulting plot. I uploaded my Excel file here.

How to draw line X=1?

I know how to draw a line with scatter plot options where X is the independent and Y the dependent variable.
In the scatter plot of that data I need to add another line: X=2. I have the following data:
But how to draw a line X=1 ?
Maybe you want something like this:
I hear that charting is more different than many other aspects of Excel between versions and that perhaps my version (Excel 2007) is one of the least ‘friendly’ hence some of the reason for “not very easy” but the principle is as #Bill the Lizard has described. In view of some weird behaviour with (my?) Excel 2007 however I recommend being careful about the sequence in which the lines are drawn.
First I suggest getting your chart right for all aspects but the green line. Then add another series with X values of 1 and 1 and Y=2 values of 10 and -2 (or whatever the limits are of your chosen y-axis as displayed). Select and copy that array (four cells) select your chart and Paste Special…, and Add cells as New Series, Columns, Categories (X Values) in First Column, OK.
This should add a vertical line of the same chart type as the existing (ie XY (Scatter) Scatter with Straight Lines and Markers). The colour can be changed, by selecting that series (click on it and Format Data Series…, Line Color etc) and presumably you would want the markers removed. It was these that for me at first refused to disappear to order – but persistence paid off. Click on either of the data points, and under Marker Options choose none for Marker Type. If necessary, repeat for the other data point – and keep repeating if required!
Also, I selected what was showing as Series3 (text) in the legend and deleted that.
Forgot to mention that for anything to do with Excel charts Jon Peltier is the ultimate authority (eg) and that an alternative approach is to use an error bar and a secondary vertical axis.

Resources