ggplot to add space in between group - r

I am working on this hazard ratio chart, using ggplot function and hope you guys could help. I am trying to add the space in between the group “Income” and “Region” . There is function called position_dodge, but I still not quite get it yet. See the image below for the layout. I'm trying to get something liekt that. Thanks in advance for help~! here is my current code, and the position_dodge not helping with adding space right now

Related

Removing grid lines in a map and smoothing in maps

I am trying to remove the grids on my map. I used several commands for example: plt.grid(), plt.rcParams["axes.grid"] = False but nothing happens, the map produced as is with the grids. Is there any possible way to remove the grids?
Another thing also, how can I make my plot to be smoothed instead of having the data as blocks (see below a sample of the plot).
enter image description here
Please assist in this regard.
Truly appreciate your time.
Thank you.

How to resize a plot (not the window) in R?

Hopefully a simple question for the community tonight:
I'm creating a boxplot with particularly long xlabels, which are rotated. The issue I'm running in to is that regardless of what plot window size I set using
dev.new(width=999, height=999)
The plot itself stretches to fill the window,and the x labels are chopped.
How do I resize the plot itself, regardless of window size?
My current plotting code is:
boxplot(mean_density~Landscape*category,ylab="Mean density",las=2,data=data1C)
The reason the X labels are so long is because of that landscape*category piece.
Thanks in advance!!
Thanks to MrFlicks quick response I managed to track down the mar() function within par().
boxplot(mean_density~Land.Cat,ylab="Mean density",las=2,data=data1C)
generated:
whereas
boxplot(mean_density~Land.Cat,ylab="Mean_density",las=2,par(mar=c(9,4,1,4)),data=data1C)
generates:
Figured it'd be an easy one:-D thanks for the help!

geom_polygon wrapping on y-axis

I have been trying to plot the result of normalmixEM using the method described by jlhoward found here. My problem is that my dataset comes right off the y-axis, leading to a result that looks like this:
I can't figure out how to keep geom_polygon from wrapping like that when it runs into the y-axis.
Thanks for the help!

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-

Controlling inner figure margins in R

I must have changed something in my par() settings, but I cannot recall what. It looks like my inner figure margins must have changed somewhere. This is obvious whenever I add lines, using the lines(), abline(), or points() functions during plotting.
Below is an image to illustrate the problem:
The black solid line at y=0 represents an abline(h=0). As you can see, the line just crosses the plotting region.
Any ideas on how to fix this? I have tried multiple things, but did not come to a solution for this problem just yet.
The answer to my problem was given by setting par(xpd=FALSE) .
Thanks to Ben Bolker.

Resources