Scatter chart, with one text (non-numerical) axis
Lets imagine I manage 100 pizza stores. I want to plot a chart each day, of how long deliveries are taking.
My data might look like this:
London 23
London 22
London 44
London 18
Paris 34
Paris 14
New York 45
etc
I would like a scatter plot; numbers (minutes) on one axis, and cities on the other axis. I would also like each city to appear in the order I choose.
I can only get this to work if I substitute each city name for a number (city number), but that has the effect of the axis labels being the city numbers (rather than city name). How can I substitute the number for the real city name? I do not want to label each data point, only the city axis! I've tried a secondary axis, but again am unable to get the city name as the label.
I'd like to use 'simple' Excel to solve this, but if there's another solution (e.g. VBA, Python), that'd interest me too...
Solution 1:
Excel scatter plots cannot take names instead of values on their x-axis. They assume a number series for the x-axis. If you want to replicate the effect of a scatter plot but use named x-axis values, you can use a line chart instead.
First, though, you are going to need to re-order your data. Each data point for a city must be in a separate column on the same row. For your example data set:
A B C D E
1 London 23 22 44 18
2 Paris 34 14
3 New York 45
Select the data and choose a line chart style with data points marked. Double-click a line to go into the Format Data Series dialog. Under Line Color choose No Line, and click OK. You can repeat the process quickly with the rest of the data set by clicking on a line and pressing CTRL+Y.
The end result will look something like this:
Solution 2:
I ended up using PyPlot, with the excellent guidance of http://matplotlib.org/gallery.html, to see the features that I was interested in using. Not for the non-programmer, but I think PyPlot can do absolutely anything.
Solution 3:
It does, you just need to choose a two-line plot instead of a one-line plot.
Solution 4:
For people with the same problems, there is a usefull tool named FunFun, which allows people to use web languages like Html, Css and JavaScript in Excel.
Javascript has a lot of powerful libraries for data visualization, like Charts.js and D3, that you can use with this Excel add-in to create any chart you want.
I made this chart with Chart.js on the FunFun website that I directly loaded in Excel by pasting the link of the funfun online editor below:
https://www.funfun.io/1/edit/5a3be7c2b848f771fbcdebbc
As you can see, you can put the city name correctly in the order you want just by changing the code on the Funfun online editor witch has an embedded spreadsheet, where you can see the output of your code instantly.
Here are some screenshots(Website to Excel Add-in):
Hope this helps !