Legend in gelman.plot - r

I need help with the command gelman.plot of the package coda.
I would like to know if it is possible to increase the size of the legend (that indicates the median and 97.5% upper confidence limit).
I managed to increase the size of labels, title and axis values, but not of the legend.
In case this is not possible, I would like to know if there is a way to not display the legend at all.
Thank you.

I tried to solve it on my own and the only solution I found was to modify (temporarily) the function ''gelman.plot'' in the package ''coda'' using the command ''trace(gelman.plot, edit = TRUE)'' and then removing the part concerning the legend.
I post this in case anyone needs it.

Related

Increase Labelsize in Julia Plots

I am creating a plot using Plots in Julia. I was trying to increase the size of the labels and also the values on the axes but couldn't find the right keyword arg (I thought it was annotationfontsize but that doesn't seem to work). Does anyone know the right arg?
I think you're looking for guidefontsize and tickfontsize. You can check all the axis attributes in the documentation. For example,
julia> plot(rand(10); xtickfontsize=5, xlab="Big label, small tick labels", xguidefontsize=20)
will give you something like

Building a heatmap in R with more information

I made a heatmap on R and most of it is one colour. I have two columns of data which showed up as various colours, but the rest of it is red.
Does anyone know how to increase the "resolution" of this? I don't mean anything about how to make the image more clear (which is why I think I'm having trouble searching for info on it). I mean, how do I make my heatmap more meaningful and not all mostly one colour.
Thanks and sorry if this has been answered somewhere else. I think I don't know the key term I need to search properly.
Edit:
Here is the code I used so far (heatdata is my matrix):
heatmap <- heatmap(heatdata,Rowv=NA,Colv=NA,col=cm.colors(256),scale="row")

Both custom tickmarks AND custom fontface in ggplot2

Apologies if this is straightforward or has already been answered, but I've searched high and low and haven't been able to find a solution anywhere.
I'm using ggplot2, trying to (1) specify custom tick marks to an axis which involve subscripts, and (2) trying to specify that some of these tick marks should be bold and others italic. I know how to do (1) and (2) separately, but when I try to do both together, only (1) succeeds.
y.labels<-c(expression(A[Subscript]),expression(B^Superscript))
y.face<-c("bold","italic")
testdf<-data.frame(x=rnorm(100),y=1:2)
Bold/italics don't appear when I supply custom labels:
ggplot(testdf,aes(x=x,y=y))+geom_point()+
scale_y_discrete(label=y.labels)
theme(axis.text.y=element_text(face=y.face))
But when I let the labels take their default values, bold/italics do appear:
ggplot(testdf,aes(x=x,y=y))+geom_point()+
theme(axis.text.y=element_text(face=y.face))
As far as I can tell, the problem doesn't have anything to do with subscripting/superscripting,
even though that is my aim, here (and which is why I'm passing the tick marks directly, rather than creating a factor variable with the desired labels, which does work). This doesn't work, either:
ggplot(testdf,aes(x=x,y=y))+geom_point()+
scale_y_discrete(label=c("Custom1","Custom2"))+
theme(axis.text.y=element_text(face=y.face))
If anyone can explain what's going on, here, and provide a solution whereby I can do both, I'd be much obliged. Thanks.
plotmath doesn't honour fontface, you want to use bold() or italic() in your expressions,
y.labels<-c(expression(bold(A)[Subscript]),expression(italic(B)^Superscript))
ggplot(testdf,aes(x=x,y=y))+geom_point()+
scale_y_discrete(label=y.labels)

How to reset 'par' (pty='s') value in R

I was trying to plot two graphs simultaneously. I did it usingpar(mfrow=c(2,1) and reset the par to default with par(mfrow=c(1,1).
I was trying to make the size of dots in the scatter plot and ended in trouble. I mistakenly used par(mfrow=c(,1),pty='s') and my plot got re-sized instead of re-sizing the size of scatter dots.
Sorry since Im new to R; I want to reset the size to default value. ie, the value for pty='s' should go to default. How can I do that!! I tried with par(opar) and par(resetPar()) which I found from stackoverflow, but both returning could not find error.
Also, may I know how to increase the size of scatter dot(s)? Should I ask this as separate question?
Thank you for your help..
Before modifying the graphical parameters with par it may be useful to store the previous parameters:
old_par = par()
Then you'll be able to come back to previous settings by typing par(old_par). For your current problem, default value for pty is "m".
In any case, if you don't want to close your current graphical device to get the old_par parameter, you can still open a new one x11() then the par function will concern the new window, and then close it dev.off()

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.

Resources