change limits of secondary y-axis ggplot R - r

I have an issue very similar to this thread Combining Bar and Line chart (double axis) in ggplot2.
I followed the answer and everything works perfectly well. However, I have very small proportions (secondary axis) so I want to change the limits of the secondary y-axis. Is there a simple way to do that?
I saw older threads where the answer was to merge the two plots. I was wondering if there may be a new more simpler way to address the limit issue.
Thanks!

Related

Grid lines in secondary y axis in Power Bi

I am using a line and clustered column chart in Power Bi in which I have a dual y-axis. I need grid lines for the secondary y-axis, i.e. the y-axis with the line value.
In Power Bi, for the primary y-axis we can just turn on the grid lines option to get the grid lines, but there's no option for the secondary y-axis. Is there any R script or any internal Power Bi option to enable this?
I don't really get the question.
PowerBI creates gridlines automatically and they are a different thing than the Y axis labels.
So I think you most likely want, is to turn off primary Y axis labels and keep secondary Y-axis labels on? First, why would you do that? It' going to be confusing for the end users.
Secondly, PowerBI does not support it natively (more specifically, I am not aware of that functionality), but there might be a workaround using different colors:
Set primary Y axis label to white (or same as your background) and secondary Y-axis label to black.
The output might look like this:
There are custom R visuals available, so I suppose you could write some code, but is it really worth it?

Changing axis endpoints in iTorch plot

I'm trying to graph some data in an iTorch notebook. I can generate plots fine, but I want to change the endpoints of the axes. (My autogenerated y-axis is from 20-100, but I'd rather it be from 0-100 since it's a graph of percentages and I want the lower left corner to be the origin.)
I looked in the documentation, and in the list of methods implemented, and in the source code, but didn't find anything that lets me do this. I can zoom the generated graph, but it preserves aspect ratio, so I can't zoom just one of the axes.
Does anyone know how to do this? I'm half convinced this isn't implemented, but it seems like a very strange feature to leave out.
You can change the axis scale by mouse-scrolling over the axis ticks, and translate by drag-and-drop.
I know it's not ideal, but I had the same problem and that's the best I could find so far.

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-

Adding individual X and Y axis labels when using facet_wrap()

I am attempting to plot lots of graphs on the fly and I chanced upon the facet_wrap functionality. It produced the desired results until I realised that it was not assigning individual axes headings. There was just a single X and Y axis heading for a whole set of graphs. What I'm looking for is a way to assign individual axes headings for each graph.
Is this possible using the facet_wrap functionality at all?
Looking forward to any suggestions and advice.
EDIT:
(removed previous, incorrect, answer)
It is my understanding that if the axes of your plots are not the same (i.e. require different labels), the way to go would be with multiple separate plots (on the same page), and not with facet_wrap.

R ggplot2 geom_bar axis limits... still having problems

I am following up on previous posts regarding similar questions. I am trying to change the y axis limits on a simple bar graph and what has been suggested in previous posts does not seem to work. The first graph below displays the different bars, but the second one, specifying the y-axis limits does not. Any idea why? Thanks.
group1=rep(1:5,5)
df=cbind(cars,group1)
means<-aggregate(speed~group1,df, mean)
ggplot(data=means,aes(x=group1,y=speed))+geom_bar(stat="identity",position="dodge")
ggplot(data=means,aes(x=group1,y=speed))+geom_bar(stat="identity",position="dodge")+
scale_y_continuous(limits=c(10,20))

Resources