I am making an upset plot using the ComplexHeatmap package (https://jokergoo.github.io/ComplexHeatmap-reference/book/upset-plot.html#upset-making-the-plot). Some of my bars are an order of magnitude higher than the rest. I would like to add a break in the set size and intersection size axis. Is this possible? I could not find a function for it.
Related
I want to plot the vector 4:10 but from 0 to 10. I don't like the large gap in produces, and I want to create my own style of plot, so I write the code:
plot(4:10,axes=FALSE,ylim=c(2,10),xlim=c(0,8))
axis(1,pos=2)
axis(2,pos=0,at=seq(2,10,2),labels=c('0','4','6','8','10'))
In order to not mislead the audience, I want to put in an axis break using axis.break() from plotrix. Unfortunately, when I add
axis.break(2,2.5)
on my plot, I don't get the break where my axis is but where it would be if I used the default axis. How do I get axisbreak() to move with my axis? Or else, how do I put an axis break where I want it?
Add pos=0 to your axis.break:
plot(4:10,axes=FALSE,ylim=c(2,10),xlim=c(0,8))
axis(1,pos=2)
axis(2,pos=0,at=seq(2,10,2),labels=c('0','4','6','8','10'))
axis.break(2,2.5,pos=0)
I have a location quotient plot drawn in R and want to draw a horizontal line along the plot where Y = 1. I have the code abline(h=1, col="black") but when the line is drawn, it intersects the Y-axis and crosses out my Y-axis labels.
Does anyone know how to terminate the line at the Y-axis rather than having it intersect?
Many thanks.
As mentioned in the comments, it looks like the parameter xpd has been changed, so one option is to change it back to FALSE, see ?par. you can control the clipping region using the clip function to further limit the range that abline and other functions plot within. This may also be affected by you plotting device (different devices can deal with clipping differently).
I would like to add a rectangle to my scatter plot to specify a region. I know I can do this by calling geom_polygon and specifying the X- and Y-coordinates of the corners. However, I would like to make sure the rectangle is always half (or another fraction) of the height of the plot, regardless of what the scale of the points on the plot is.
Is there any way I can specify the coordinates of the corners with something like "fraction of plotting region" as the unit?
The only other option I see is to try to predict the scale of the plot by looking at the min() and max() of the points that I am plotting and then calculating the coordinates for the box based on that, but that becomes a lot more complicated once you start faceting and so on...
If I make a line plot (a time series, for example) and set my axis limits, I want the line to continue off the plot when points are outside of the axis limits, and then come back into the plot for the next point that is within the axis limits. Right now, it seems that ggplot2 will just drop the points completely and give me a an "Error:" message.
If you limit your axes by reducing the axis scale (scale_x_continuous(limits=...)), then that is the expected behavior. By adjusting the scale, you are defining what data should be part of the plot. If you want to use all the data, but just zoom in on a particular region of the axes, you want to use coord_cartesian(xlim=..., ylim=...) instead.
If I make a line plot (a time series, for example) and set my axis limits, I want the line to continue off the plot when points are outside of the axis limits, and then come back into the plot for the next point that is within the axis limits. Right now, it seems that ggplot2 will just drop the points completely and give me a an "Error:" message.
If you limit your axes by reducing the axis scale (scale_x_continuous(limits=...)), then that is the expected behavior. By adjusting the scale, you are defining what data should be part of the plot. If you want to use all the data, but just zoom in on a particular region of the axes, you want to use coord_cartesian(xlim=..., ylim=...) instead.