Use text as horizontal labels in Excel scatter plot - excel

I am trying to make a scatter plot in Excel with text as horizontal axis labels.
I have the data
and I want a chart like this
The way I produced this chart was to have a scatter plot with numeric X values and numeric Y values, so instead of Poland I have X=1 and Y=10, Y=11, Y=12, and Y=9. For Germany I chose X=2 and Y=8 and Y=7. I just added some text boxes with the names to hide the numeric X values.
But I want this to be dynamic, so I tried to set the X value labels here:
but I am not able to change the horizontal values.
How can I solve this problem?

You need a helper series. Consider the following screenshot:
The blue dots are plotted from the data in the table on the left. The orange dots are plotted from the helper table. Each orange dot then has a data label assigned. Edit each data label individually, type a = character and click the cell that has the corresponding text.
This process can be automated with the free XY Chart Labeler add-in. Excel 2013 and newer has the option to include "Value from cells" in the data label dialog.
Format the data labels to your preferences and hide the original x axis labels.

Related

Excel data representation, Axis labelling non-numeric

I wanted to display my data from my Excel spreadsheet graphically, in the form of a scatter chart.
I know that Excel can do this, but there is one "special feature" about my coordinate system of my graphic, and that is that one of the axes should be labeled with "words" (instead of numbers) to match my table similar to the picture. But I am not sure if Excel can process this at all, I guess that Excel can only work with numbers on the axes.
I would be very grateful for any help and tips and also alternatives!
By definition, the axes in an XY Scatter plot are numeric. But your desired chart can easily be created by adding a helper series to the plot. Assuming the current Y values for the other series are the numbers 1 to 6 for even positioning, you can use a range with Y values 1 to 6 and X values of zero and add that data range as a new series to the plot.
The plot points will sit right on the Y axis. Remove the Y axis labels in the Axis formatting options. You can then use data labels from the worksheet and position them to the left of the plot points of the helper series. Finally, format the markers of the helper series to have no fil and no line to make them invisible.

How to label scatter point plots from data column in excel

I have an Excel spreadsheet and I want to plot data from three columns: X, Y and L. The X and Y represent points I want to plot as a scatter plot, and L represents the label (point color, point symbol) that I want applied to each X, Y point. I see that How to plot points using their class labels? reports a solution for R, but I'd like one for Excel, if possible, preferably using UI rather than VBA. Thanks!
With Excel 2013 and later you can add data labels with the option "Value from Cells".
In earlier versions, you need to add each individual data label and give it the cell reference to the cell with the label (edit the label, type a = character, then click the cell with the label text).
This is tedious for charts with many values and can be sped up significantly with a free add-in by Rob Bovey, called the XY Chart Labeler, download here. The tool gives you a UI to insert and place labels.
Once the labels are in place, the file can be distributed to people who don't have the tool. It simply speeds up a manual process.

Can't align x-axis on hybrid scatter/area chart

Please have a look at This Excel chart. Here is a screenshot:
Here is the data:
There is a scatter series of blue of dots (plus a trendline) and a green area series. The chart data are contained within the series.
The problem I have is that the x-axis values of the two series are not aligned. For example, the second and third blue dots at x = 3.1 and x = 3.8 are in the correct place along the x-axis, but in the green area series they appear to be above x = 2.0 and x = 3.3. How to fix this?
Change the Scatter to a Line Chart, then format Line Color so that there is "No Line". Add trendline.
There may be another way to do this while retaining the Scatterplot, I'm not sure, but this seems to be visually what you're looking for, but I think you will need to use a Line Chart for this unfortunately. The problem is summarized in this similar Q on SuperUser:
https://superuser.com/questions/964264/aligning-stacked-bar-chart-w-scatter-plot-data
The short answer is that your combining (unsuccessfully) a categorical series (the columns) with interval/ratio series (the line charts). So, Excel doesn't know how to plot your categories (columns) on an interval scale (the current X axis).
You can verify this by selecting Chart > Layout > Axes > Secondary Horizontal Axis > More Secondary Horizontal Axis Options. Without making any changes to the axes configuration, the second X-axis will now appear along the bottom of the chart, and you can see it is scaled differently from your Scatter data.
I.e., in the Scatter series, the data is X/Y pairs. But in your Area chart, it treats the X-values as categorical, and in this context "1.1" is no different than "Bob" -- it is a cardinal representation of the data rather than an ordinal representation.
The problem I have is that the x-axis values of the two series are not aligned.
So even though the two series appear to share the same set of X-Values, the Chart is simply incapable of treating those as the same type of data. The x-axes are not aligned because they are not the same data or even the same type of data!
All that said, if you change both series to XY Scatter, it is possible (with some extraordinary effort) to apply shading/coloring below a series or between two series, etc.
http://peltiertech.com/fill-under-between-series-in-excel-chart/
http://chandoo.org/wp/2013/02/13/shaded-line-charts-excel/
What you can do is plot the Area graph on a secondary axis. Then go to Chart -> Layout -> Axes -> Display Secondary Horizontal Axis to see the axis, right click for its properties and change the type of the Axis Type to "Date axis". This (kind of) changes the axis to a numerical type, as opposed to a category type.
However, the area graph will still be placed incorrectly too far to the right because Excel will continue to plot the series as a (kind of) category type, with its data points appearing in the centre of each category as opposed to at the correct x value like in an XY scatter plot.
To get the graphs overlaying the most correctly, you can create a Scaled-up x value series which is, say, 1,000 times the original x-values and use this for the x-values of the area plot. By scaling by 1,000 or 10,000, you eventually get the granularity to a point where it looks more like X-Y plot, but is actually an area plot, and the graphs look like they coincide perfectly.

Highlighting data range whille retaining original data label axis

So I'm not sure whether this can be done or not, but I want to highlight certain scatter plot points on my graph whilst still retaining the original axis labels. This is a little snip of my data:-
(0.5,0.525] 272
(0.925,0.95] 116
(0.975,1] 446
(1,1.025] 2840
(1.975,2] 974
(2,2.025] 1400
I have a scatter plot of the first column as my x-axis and the second column as my y-axis. Currently I'm highlighting the points that I want (such as (1,1.025] 2840by adding it as a new legend entries series, but to get it to align horizontally with the original data I've had to number all the points from 1 onwards and add the horizontal axis labels that way, so that all the points that are highlighted mask the other points behind it that contain the horizontal data labels. Is there a way of overcoming this without formatting the data for the x-axis numerically? Or a way of incorporating the data labels separately?
Just to illustrate the problem, I've attached an image at the end of this post. The columns mzRange and Frequency on the left handside were used to plot the graphs, whilst the columns on the right handside of the graph were used to highlight the points on the bottom graph. However, as the x-axis is labelled with the bin ranges from the column on the left, it goes up in a numerical fashion as seen with the numbers on the left most column, meaning I have to use the position number of the bins to then place the highlighted points (as seen with the column on the right handside of the graph that goes 18,34,36 etc) which in turn hides the information of the m/z bin range. Hope this makes sense.
The data in the mzRange is not numeric. If it is used as the data source for the X axis, it will result in the data points being numbered ascending on the X axis.
The only way to plot over a data point is to use the exact X and Y values as the original data point. You could mark the highlights in a column next to the original mzRange column and then plot the whole column.
See this screenshot:
Note how the X axis has nothing in common with the values of column B, although that was used as the data source for the X axis. The red dot highlights are placed in the rows that determine the position on the X axis. This way, the label that appears when hovering over the data point remains intact.

Excel curve (Showing values at both sides of y-axis)

I have created a curve in Excel 2013.
At the Y-Axis I am showing some values that show the probability for survival for each 100.000 citizen. Now my problem is, that I want to also show it in percentage, at the right side of the Y-Axis.
How do I do this?
Thanks in advance.
Ps. I have added an the curve as an image, so that you can see how it looks at the moment.
Add a secondary (Y) axis:
Create a combo chart with a secondary axis
When the numbers in a chart you created vary widely from data series to data series, or when you have mixed types of data (for example, price and volume), you can plot one or more data series on a secondary vertical (value) axis. The scale of the secondary vertical axis shows the values for the associated data series. A secondary axis works well in a chart that shows a combination of column and line charts.
Combo chart with secondary axis
In Microsoft Excel 2013, you can quickly show a chart like the one above by changing your chart to a combo chart.
Click anywhere in the chart you want to change to a combo chart to show the Chart Tools.
Chart Tools
Click Design > Change Chart Type.
Type group on the Design tab
On the All Charts tab, choose Combo, and then pick the Clustered Column - Line on Secondary Axis chart.
Combo chart with secondary axis on All Charts tab
Under Choose the chart type and axis for your data series, check the Secondary Axis box for each data series you want to plot on the secondary axis, and then change their chart type to Line.
Make sure that all other data series are shown as Clustered Column.
To clarify what is plotted on each of the vertical axes, you can add axis titles.
.
If I understood you correctly, you only need a right axis that shows a percentage scale, with, e.g., the tick mark for 100% at the same level as the tick mark for 100000 on the left axis.
You do not need any additional curves.
Then, you need to:
Create some dummy data. You may use two cells, which will give you a series with a single data point. Use 10 (X range) and -1 (Y range). Depending on the options you selected for your y axis, you may have to set the Minimum value fixed at 0 (you can do this now or later).
Add it to the plot.
Assign it to a secondary y-axis. Right-click on the series, Format Data Series -> Series Options -> Secondary Axis. Or, if you find it difficult to select it this way, select the chart, Go to Format, select the series from the pull-down menu on the top left, and Format Selection.
Format the right axis scale to give you a correct matching with the left scale. Right click on the secondary y axis, set the Minimum fixed at 0, the Maximum fixed at 1.2 (to match the figure you posted), and the number format as Percentage. PS: there will be a tick label "120%" on the right axis. That will not look good for what you are plotting. It will be best to set the Maximum of the left axis to 115000 (say), and the right axis to 1.15 then.

Resources