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

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.

Related

ggplot with truncated axis, shortened secondary axis, and vertical lines that span multiple plots

I am writing a paper I plan to submit to an academic journal, and I want to use ggplot2 to follow a figure format similar to previous articles that use similar methods. I am trying to emulate the graph shown below, which has the following characteristics:
Axes with breaks that go 0 // next-number. It seems like guide_axis_truncated() (example post) could work, but most of the examples I see don't use the 0 // next-number notation that I'm looking for.
A secondary right-side axis that only extends partially up the height of each facet. I believe I can use guide_axis_truncated() for this, but I'd appreciate a sanity check on this and recommendations on combining this with the right-side axis.
Aligned axes and vertical dashed lines that extend across all facets. I found this post, but according to a comment, the solution might be outdated.
Here is a link to the full-text article if that helps.

Spacing Between Multiple X-Axes in JFreeChart

I'm attempting to try and increase the vertical spacing between multiple x-axes using JFreeChart. Currently, my charts look like this:
Current chart
However, I need to produce something like the following so that the x-axes are more clearly defined (note that the vertical spacing between the x-axes is larger than in the first image):
Desired chart
Does any one have any idea on how to do this? I've been searching the JFreeChart API for > 2 days now and can't find anything that directly addresses the issue other than attempting to use org.jfree.chart.axis.AxisSpace in some way.
Many thanks for any help!
One approach would be to customise the axis label insets (that is, increase the space below each axis label).
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/Axis.html#setLabelInsets-org.jfree.ui.RectangleInsets-

How to plot just one axis label in R?

A beginner question: I currently have some plots that look like this.
I'm keeping the plots free of other annotation because I have to fit a lot of them onto one page and specific values aren't important, just the general trend that the red line is to the right of the black one. However, I'd like to be able to indicate that the dashed line in my plot actually represents zero, like so:
Is there any way to tell R to only display that value on the x-axis labels? I don't think using text() would be a good idea because it relies on absolute coordinates, but I'm not really sure how to work with axis options to make it do what I want.
Try:
axis(side = 1, at = 0)
See ?axis for details.

R plot axes don't meet and data extends beyond them

I have a VERY basic plot in R, and I'd like to solve two issues. Here is the code which produces the plot:
plot(o,n,bty="n",pch=21,cex=1.5,bg="gray",xlab="y",ylab="x",lwd=2)
And, here's the plot
There are two unwanted behaviors of this plot that I'm trying to fix. And I don't know how to do either one (nor do I understand why R doesn't do these things already...)
The X and Y axes do not meet. There is a gap near the origin in this plot. I want to remove that. The axes should touch, just like any other graph.
The data extends past the axis is both the X and Y direction. This clearly is unwanted. How can I fix this without having to manually make my own axis. Seems like there should be something more intuitive here.
bty="l".
You may also want to use something like:
xlim=c(0.02, 0.24), ylim=c(0.02, 0.24)
if you don't like the default limits of your two axes.
In general, check out ?par for guidance on both of these and many other options.
Try leaving out bty="n" or replacing it by bty="L" if you really do not want a box with edges above or on the right

Comprehensive guide to manipulating axes in idl

I am trying to have 4 plots in the same window using
!p.multi=[0,2,2]
!p.position=[0.11,0.5,0.5,0.9] ...some code
!p.position=[0.5,0.5,0.9,0.9] ...some code
!p.position=[0.11,0.1,0.5,0.5] ...some code
!p.position=[0.5,0.1,0.9,0.5] ...some code
The position of the plots is perfect (see graph here) but
a/ I would like to remove the scale on the x axis in the top 2 plots and have it at the top of the top plots rather than at the bottom.
b/ I would like to have the y axis on the right of the 2 plots on the right rather than on their left.
I have managed to do this kind of plot in the past but after hours playing with the [xy]style and axis commands. Part of the problem is that I can't find a comprehensive guide on the internet which would simple break down each style such that
xstyle = 1 ;definition
xstyle = 2 ; definition
...you get the jist of it.
Would somebody be able to refer me to a good guide on how to manipulate axes in idl so that I don't have to guess the styles each time I have to plot. If not, would somebody be able to break down the style and axis options / commands very simply on stack overflow? I doubt I'm the only one stumbling upon this problem time and time again...?
Thank you very much!
If you want to draw an axis on the "opposite side", you need to suppress the axis (i.e., [XY]AXIS=4) and then make the axis yourself in the correct location with the AXIS command.
The online help has definitions for the values of XSTYLE and the options to AXIS.

Resources