Bokeh - Grouped axis with RangeTool - list

Is it possible to create a figure with a grouped axis AND a RangeTool?
This example demonstrates the RangeTool https://docs.bokeh.org/en/latest/docs/gallery/range_tool.html.
I have a list of tuples factors which I want to use as a grouped axis:
[('2017','Jan'),('2017','Feb')..('2019','Oct')]
In the example, the initial pan on the plot seems to be set by x_range in
p = figure(plot_height=300, plot_width=800, tools="xpan", toolbar_location=None,
x_axis_type="datetime", x_axis_location="above",
background_fill_color="#efefef", x_range=(dates[1500], dates[2500]))
However, to use a grouped x axis, one must use FactorRange ala x_range=FactorRange(*factors). I've tried various forms of indexing of factors with FactorRange and cannot get it to work. Is such a thing possible in Bokeh?
The plot in here demonstrates an example of a grouped axis:
https://docs.bokeh.org/en/latest/docs/gallery/bar_mixed.html

The RangeTool assumes an underlying numeric axis, so there is not a direct way to accomplish this. The only route I could see would be to simulate a categorical axis by using a numerical axis with a fixed ticker and tick labels that correspond to the "categories" you want, and then to plot the bars using the corresponding numerical coordinates.

Related

Show relationships between 3 numerical values and turn the horizontal axis into a logarithmic scale

Which type of visualisation I need to choose if I want to show relationships between 3 numerical values and turn the horizontal axis into a logarithmic scale? The worksheet data would include grouped sets of values and you wanted to show patterns in large sets of data, for example by showing linear or non-linear trends, clusters, and outliers?
Bubble Chart
Bar Chart
Treemap
Pie Chart
A bubble Chart is the correct option.

How to plot 'outside' of the a matplotlib plot?

I have values 1 through 5000 along the x-axis and percentage along the y-axis, however, I only want the values from 1-150 to be visible along the x-axis (in order to make the scale more usable), but I'm having trouble figuring out how to do it.
Originally, I was just excluding the data with values over 150, but that obviously doesn't work with percentages.
You can achieve this by limiting the range of the x-axis (or y-axis) of the plot: plt.xlim(1, 150) or ax.set_xlim(1, 150).

showing that there are outliers in a matplotlib plot

Assume there is a scatter plot with axis between 0 to 2 in both x and y. There are points outside this range which are not necessary to be shown in the plot.
Is there a built in module in matplotlib that can be used to show arrows(or any similar symbol) at the edges of the axes showing that there are points outside the plot range?
There's an annotate method that you can use. Here's a link with examples.
You can also add your own arrows and text objects.

Google charts API - multiple charts on the same image

Is there a way to display multiple charts on the same image using Google Charts api?
To elaborate:
I have one data series which I want to display as bar chart.
I have another data set which has nothing to do with the first one (well they are correlated but the values are hundred times bigger).
X-axis is for dates.
I want to have second data set displayed as line chart with Y-axis on the left.
I found something similar in "Compound charts" section but as far as I understand markers are calculated based on already displayed data set - and I want to have them independent.
In other words - is it possible to make image like this:
http://chart.apis.google.com/chart?cht=bvg&chm=D,0033FF,1,0,5,1&chs=200x150&chd=t1:30,10,20|60,40,50&chxt=y
but with the line being independent and their values axis being on the right.
I'm sorry I'm not familiar with the terminology - I'm sure there is a name for what I'm trying to achieve.
Thanks!
Only 2 years behind the curve but just to let you know that I have achieved your objective of displaying 2 datasets (one a bar chart, the other a line chart) against 2 different axis scales.
The devil is in the scaling parameter &chds and explicit axis values using &chxr. Essentially, I defined the explicit scales for the x-axis, y-axis and r-axis. and then instructed the scaling parameter to scale each dataset differently.
So for an r dataset between 0 - 10 and a y dataset between 0-2 I would write;
&chds=0,2,0,10 (y then r defined in my axis parameter, i.e. &chxt=y,r)
...and...
&chxr=0,0,2|1,0,10
Let me know if you need more detail!
I've looked into something similar to this before and have used the google chart API a lot. I'm 90% sure the answer is no. Sry :(
Yep it is possible.
Here is an example of two datasets displayed on the same axes. 1 is a bar chart the other is a line graph....
This line - chd=t1:95,1,1,3,10,3,77|95,52,44,24,11,2,1 - allows for the two datasets.
slothistype

Google Charts axis start

Below is url that chart I am using.
http://chart.apis.google.com/chart?cht=lc&chco=99C754&chs=400x150&chds=20,1&chd=t:1.0,1.0,1.0,1.0,1.0&chxt=x,y&chxl=0:|12/07/09|12/14/09|12/21/09|12/28/09|01/04/10&1:1|10|20&chxr=1,20,0,10&chls=2&chg=25,100,1,2&chm=o,54C7C5,0,-1,5&chxtc=1,15|0,15
I want to start y-axis from 1 but in my chart is started from 0.
please help me
little look at google
show :
Axis Range chxr :
You can specify the
range of values that appear on each
axis independently, using the chxr
parameter. Note that this does not
change the scale of the chart
elements, only the scale of the axis
labels. If you want to make the axis
numbers describe the actual data
values, set and
to the lower and upper values of your
data format range, respectively. See
Axis Scaling for more information.
You must make an axis visible using
the chxt parameter if you want to
specify its range.
To specify custom axis values, use the
chxl parameter.
http://code.google.com/intl/iw/apis/chart/docs/gallery/bar_charts.html#axis_range