How to add a 90º angle arrow annotation in a Bokeh figure - bokeh

I want to add this type of annotation I do with seaborn but in a Bokeh plot:
Is it possible? I can only find information about straight arrows.

As of version 2.4.2. Bokeh only supports straight-line arrows.

Related

How do I graph a line in Julia with an arrow on both sides?

Here is my code:
using MTH229
using Plots
f(x)=x
theme(:dark)
plot(f,-5,5,linewidth=5,c=:hotpink,legend=false,arrow=true)
Here is a picture of the output:
plot
How do I get the arrow to appear on both ends of the line instead of just one?
The plot and plot! commands have an arrow parameter that in turn has a special option :both to have arrows on both ends. Hence you can just do
plot(f,-5,5,linewidth=5,c=:hotpink,legend=false,
arrow=Plots.Arrow(:open, :both, 2.5, 2.0))
It's a bit of a hacky solution, but for the example in the question:
plot!([-4.99,-5],[f(-4.99), f(-5)],
linewidth=5,c=:hotpink,legend=false,arrow=true)
adds the reverse arrow. Generalizing to any chart is pretty straight forward. The idea is to draw a line chart with a reverse direction, for just a tiny bit at the location of the reverse arrow and let Plot add the reverse arrow.

Put Y-Axis along x=0 line in Bokeh figure

I would like to have my y-axis go right up through the x=0 line in my figure, rather than have it on the left side. Is there an easy way to achieve this with Bokeh?
Currently not available in Bokeh, as of 0.12.1. There is an open issue for this feature.
Have seen someone visually faking it using spans when replicating this infographic - but note labels still off to the left.
Here's the mailing list discussion: https://groups.google.com/a/continuum.io/forum/#!topicsearchin/bokeh/fivethirtyeight/bokeh/_dKphJePDwg
I was attempting to do this and it looks like there is now a solution to this. You can set the figure.yaxis.fixed_location attribute to zero.
As an explicit example using bokeh 1.0.4:
# ... bokeh imports
p = figure(plot_width=300, plot_height=300)
p.patch([-1,0,1], [-1,1,0.5], alpha=0.5)
p.yaxis.fixed_location = 0
show(p)
returns the figure:
You can also do this for the x-axis or both.

How to move the color bar of a heatmap in gnuplot?

I'm plotting some heatmaps in gnuplot. It has the graph and a colorbar in the right side of the graph. But I wish to change it's position in the plot. Does anybody know the command to change the position of the colorbar in the plot ??
Thanks,
Thiago
You can use the command set colorbox:
set colorbox vertical user origin .02, .1 size .04,.8
If you want it anywhere but the default position you have to set the coordinates manually. For more info you can type
help set
in gnuplot and all the options starting with cb and colorbox refer to fine points of the colorbox.

Change axis length in polar.plot?

I want to draw a polar graph in R.
I found plotrix, which has polar.plot, but I'm open to any other solutions.
It plots a polygon just fine, even though I have a few thousand points, so great!
My question: how can I change the start value of the radial axis? ie, how to do ylim in polar.plot?
Try using ggplot2 - it has a coord_polar() command to make polar plots
Here's the official Documentation:
http://docs.ggplot2.org/current/coord_polar.html
And a simple tutorial to work off of:
http://learnr.wordpress.com/2010/08/16/consultants-chart-in-ggplot2/
I found a solution for polar.plot: option radial.lim.

How do I show logarithmically spaced grid lines at all ticks on a log-log plot using Matplotlib?

I'm trying to plot a log-log graph that shows logarithmically spaced grid lines at all of the ticks that you see along the bottom and left hand side of the plot. I've been able to show some gridlines by using matplotlib.pyplot.grid(True), but this is only showing grid lines for me at power of 10 intervals. So as an example, here is what I'm currently getting:
I'd really like something with grid lines looking more like this, where the gridlines aren't all evenly spaced:
How would I go about achieving this in Matplotlib?
Basically, you just need to put in the parameter which="both" in the grid command so that it becomes:
matplotlib.pyplot.grid(True, which="both")
Other options for which are 'minor' and 'major' which are the major ticks (which are shown in your graph) and the minor ticks which you are missing. If you want solid lines then you can use ls="-" as a parameter to grid() as well.
Here is an example for kicks:
import numpy as np
from matplotlib import pyplot as plt
x = np.arange(0, 100, .5)
y = 2 * x**3
plt.loglog(x, y)
plt.grid(True, which="both", ls="-")
plt.show()
which generates:
More details on the Matplotlib Docs
As #Bryce says, in older version of matplotlib correct kwarg is which=majorminor. I think that solid lines with a lighter color can be better than the dotted lines.
plt.grid(True, which="majorminor", ls="-", color='0.65')
Note that in the latest version of matplotlib this argument is replaced by 'both'.
plt.grid(True, which="both", ls="-", color='0.65')

Resources