Excel graphing and axis - excel

I have a scatterplot with values that range from 2 to -2. The catch is that 1 is the "zero-point". In other words the minimum positive value is 1.01 and the minimum negative value is -1.01. How can I edit the axis of the graph so that 0 is replaced with 1.

If you have a version of Excel later than 2007 I'd suggest splitting the positives and negatives into separate series and plotting one on a secondary axis (not that I know whether or not that would work!), but with 2007 I have not been able to place one vertical axis above the horizontal and another below. Instead the best I could manage was to use two separate charts:
by again splitting up the series, careful positioning and judicious use of a text box for 0.
At least this way you are not constrained by the outer limits.

Based on some very specific conditions you can print the zero-point as 1 using a custom number format: You have to set the axis options to be fixed at -2 (minimum) and 2 (maximum) with a major unit of 2 as well. This ensure that you only have the three values -2, 0 and 2 on the vertical/y-axis. Why is this important? Well, custom number formats can easily distinguish between positive/negative and zero values which is exactly what you have when you have -2, 0 and 2.
Here's a visual of the input/output:
The custom number format is set to 2;-2;1, thereby formatting all positive numbers to 2, all negative numbers to -2 and zero to 1.

If all you want is to replace the axis label "0" with "1" (as in the answer by Werner), then you can use the following (similar to this):
Add X and Y values for a dummy series, with 3 points. If the minimum value in your X-axis is xm, your points are (xm, -2), (xm, 0), (xm, 2).
Add cells with the 3 labels that you will use for the dummy series: "-2", "1", "2".
Go to the chart, and remove the tick labels of the Y-axis.
Add a series with the 3 dummy data points.
Add the labels to the data points. You can use references to the cells of item 2, or enter explicit labels. Entering each label (either a reference or an explicit label) is tedious when you have many data points. Check this, and in particular Rob Bovey´s add-in. It is excellent.
Format the dummy series so it is visually ok (e.g., small, hairline crosses, no line).
You can use variations on this. For instance, you can add extra points to your dummy series, with corresponding labels. Gridlines would match the dummy series.
But I think this is not appropriate, as the locations of your data points will be inconsistent with the scales.
What is appropriate is having an interrupted axis, where the interval (-1,1) is eliminated.
The answer by pnuts aims at that.
I propose something different, with the advantage of using only one chart:
Create a column where you add 2, only to negative Y-values. Use that column as your new Y-values.
Use the same trick as above, with your dummy series now being (xm, 0), (xm, 1), (xm, 2), and the labels the same as above.
You can use additional points in your dummy series.
You can use this technique to create an arbitrary number of axis interruptions. The formula for the "fake" Y-values would be more complicated, with IFs to detect the interval corresponding to each point, and suitable linear transformations to account for the change in scale for each interval (assuming linear scales; no mixing linear-log). But that is all.
PS: see also the links below. I still think my alternative is better.
http://peltiertech.com/broken-y-axis-in-excel-chart/
http://ksrowell.com/blog-visualizing-data/2013/08/12/how-to-simulate-a-broken-axis-value-axis/
http://www.tushar-mehta.com/excel/newsgroups/broken_y_axis/tutorial/index.html#Rescale%20and%20hide%20the%20y-axis

Related

I only want to see actual x values to show on horizontal axis of Excel Chart (with scale matching those values) not let Excel do scaling and labeling

Below is an Excel Chart for the data shown in column A (x-coordinates--dates) and column B (y-coordinates--test results). There's no problem with the column B data. But note that the horizontal axis shows quite a few more dates than are contained in column A.
Is there any way to have only the actual x-coordinates shown on the horizontal axis with a scale that matches those values?
I kind of get it. Excel deliberately scales the horizontal axis to match as best it can the data in column A. But I don't want that. Beneath each "corner" point of the graph, I'd like to see the date that is associated with the test result in column B.
In other words, there is clearly a point with y-coordinate 154.5. I'd like to see 2/13/2018 directly below that point since that is the data in row 5. Note that the x-axis contains the "correct" date for the first plotted point: (2/9/2017, 70). But for the point with y-coordinate 80, it looks as if that test result occurred on 6/9/2017 rather than 6/16/2018.
So I'd like the graph to appear as shown in the second image, which likely would be impossible because of the "crowding" of x-coordinate values at the right-hand end, but just displaying whichever of the three dates would fit would be good enough, as would just showing one of the two dates in other "crowded" areas. That is to say that something like the third image would be fine.
I suppose I could write VBA code to make it happen, but I'd prefer that Excel do it.
(What crosses my mind is, "Are exact dates really this important?" And the jury is still out on this point. There are arguments both ways. I guess a hung jury goes to the judge, Excel.)
By inserting the points to be plotted into two arrays, datesArr and scaledArr, and putting those values into columns A and B (see worksheet) and in code saying ...
Set ch = ActiveChart
Set s = ch.SeriesCollection
s(1).Values = scaledArray
s(1).XValues = datesArr
... I got exactly what I wanted. Now granted that's not exactly built-in, but we're programmers, yes? And this was downright easy. Well, once I learned a few tricks, especially being able to set angle of dates to 45 degrees.
You need to plot two sets of data, the actual values, and a set of zeros, then smoke and mirrors make it work.
Data below left, make a line chart (top left chart). Add data labels to the second series; I colored the labels orange to match the points, for clarity in this description. Default labels show Y values, which are all zero (top right). Format the data labels to show category values (i.e., dates), below the points, rotated upwards (bottom left). Format format format (bottom right). Axis labels: none. Format second series with medium gray lines and medium gray cross markers. Drag bottom of plot area upwards to make room for the date labels. Hide legend.

Excel scatterplot graph update automatically

My problem is as follows:
The user inputs two numbers between 2 and 25, these numbers are used to create a grid. Every point on the grid has (x,y) coordinates. Based on the amount of points the user chose, my excel sheet is filled up with up to 25x25 (x,y) coordinates.
Example: A 6x7 grid is chosen by the user, the table is filled with 42 (x,y) coordinates and all other values in the table are set to "".
Now I want to use a scatterplot with lines connecting each array to plot the data.
Problem 1: If I only select the 6x7 part of the table that has values in it and create the scatterplot the result is correct. Until the user specifies a different grid, for example 8x9, then the graph is obviously missing two rows and two columns of input data.
Problem 2: If I select the entire 25x25 part of the table, including all the "" values, the graph axes get messed up. The y-axis works properly, but the x-axis shows sequential values (0-7) instead of the x-coordinates.
Problem 3: If I replace all the "" values in the table to 0 or NaN and plot the entire table the axes are correct, but the lines between the scatter data get messed up.
Question:
Is there a way to automatically change the input data for the plot, or is there a way to correctly display the values on the x-axis if I select all the data?
Not sure this will work in your case, but it's worth a try, especially since no one's addressed your post in 3+ hours. I've had success with this approach: 1) charting the largest data set, 2) copying the resulting chart, and 3) trimming the data it draws from to produce all smaller data sets.
To get this to work takes a lot of thought in laying out that largest data set so that all the other plots follow as needed. To illustrate, I've somewhat mimicked your data and in the animated gif I show largest data set, plus 2 others produced by copying it. Then I demonstrate how to make the second one, including the rescaling required to make all plots scaled equally. Notice that I've arranged things so that only one set of x-values feeds all the series. If you can do this, it makes working with the Excel's interface much easier.
After wrestling with it all night I came to the following solution:
Instead of setting all the empty cells to "" or zero the cells should be be set to #N/A (not available). The graph properly ignores the #N/A cells exactly like I want it to and updates when values are entered into them.

Creating basins of attraction from data file

How can Newton's basin of attraction be created from a data file?
I got 10000 points in the range -2, 2 and their zeros for complex function z^3-1. I'd like to plot them with three different colors to create basin of convergence.
Data I've obtained from my program is available here. The format is like this:
(-0.422468,1.36075) (-0.5,0.866025)
(1.19376,1.1324) (1,-6.76273e-19)
...
First two numbers in "( )" are complex start points, the second two are the zero that it converges to. Zeros are exact to the level of e-10, I can easily change it to e-16.
From what I understand, I would try something like:
plot 'yourdata.dat' using 1:2:(arg($3+$4*{0,1})) '(%lf,%lf) (%lf,%lf)' palette
The string '(%lf,%lf) (%lf,%lf)' is the format of your data, so that gnuplot can read it as a file of four columns. Then, you can select the columns to be plotted with using 1:2:(arg(...)); in this case, the x-axis is the real part of the starting points (column 1), and the y-axis is its imaginary part (column 2). The third part of using, arg($3+$4*{0,1}), and the option palette are used to chose the color depending on the phase of the complex zero (columns $3 and $4).

How can I make a spectral plot in Excel?

I have two columns of data - first is fractions (goes on x-axis), second is integers (goes on y).
Is there a way to plot one against the other in a histogram type manner so it looks like a spectrum?
Use the "scatter plot" tool. It is also called a "scatter chart" tool. Once you have your chart in place, you can add a trend line to determine the formula for the relationship between x and y values. You will be able to find the formula in terms of y = mx+b. You can also determine the r squared value which will be important in the interpretation of the relationship. There are several options for scatter charts that might lead you off course, so experiment with the tool a bit to discover the correct options for your situation.

Excel Chart doesn't keep format

I have a table (came from a pivot table) where I have formatted the column 4 cells to show 1 billion as 1. But when I select the table and insert a chart, I am getting my units in millions. So the 14.8 billion number for Mexico is showing up as 14,800 on the chart. Why might this be happening and how can I fix this? This is also making all my other bars negligibly small. Note that the first three columns are not in billions and are totally different things. Some are percentages, some are other small numbers.
Table:
Chart:
You need a secondary horizontal axis and some formatting on the Axes.
In Excel 2013
First change the Chart Type to Combo and select Clustered Bar for both sets of data, then Check
Secondary Axis for the Percentage Series.
Then set up the axis limits so they match, e.g.
Percentage: min -.5 max 2
Billions: min -5e9 max 20e9
Then set the percentage format on the source data to a custom Number format of "";(0)%;0%
Then set the Billions format as 0,,,;"";0
You will get something like this:
EDIT
Now that we have the general principles, we can apply them to your specific data.
I will also switch to Excel 2010 do show the different menus.
The data selection looks like this
Select the non-Billion series (plural!) and check the secondary axis
If the larger data is always positive then you can use custom formatting to clean up the axis
Align the primary and secondary axes so that the grid lines match on both
The end result is clean and readable.
Mixing percentages and numbers for the smaller numbers is not handled by this but I would suggest that that would be confusing anyway?
The simplest way to fix this might be to plot cells containing the billions values divided by 10^9 rather than to plot the billions themselves, though via a secondary axis may be possible.
Using Excel 2007. For the purple bars, the example on the left uses ColumnE values, on the right ColumnF values. E1 contains =F1/10^9 and F1 contains =14800000000:
It appears that there are 3 questions here: 1) "Why might this be happening", 2) "how can I fix this", and 3) something like "how can I plot data which lie on two widely differing ranges, and make them all reasonably visible anyway", even if there was no explicit question on this.
There are several ways to solve issue #2 about the units (e.g., billions) and numbers (e.g., 14.8 vs. 14,800.0) shown in the axis, each one with its own pros and cons:
Use Format Axis -> Axis Options -> Display units.
This might be the answer to your issue #1 as well, you might have the following selection: Display units -> Millions, and unchecked Show display units... Otherwise, I wouldn't know why you chart shows what it shows.
Use faked tick marks, as indicated in the (excellent) site of Jon Peltier
http://peltiertech.com/Excel/Charts/ArbitraryAxis.html
It gives detailed instructions on how to create tick marks on an axis with arbitrary labels (which may be text, numbers, etc.), which is more generic than what the OP wants here. In this particular case, the labels will be the desired numbers.
Create new cells containing data that would be plotted exactly the way you want.
As for your issue #3, I guess the only option is to have a Secondary Axis (see the answer by pnuts).
Thus, to come up with the best final chart for you might use a combination of one of the options I gave here and a secondary axis.

Resources