I would like to add some totals on the right side of the plot (above and under the legend). And also under the title of the x axis.
I found how to add text within the plot, or add multiple legends of something ploted, but I don't want to do either one. I just want to calculate some totals and display them as mentioned above. Is it in any way possible?
As it is now:
As I would like it to be:
Related
I'd appreciate help on how to remove a legend from a plot. Say we have this:
I want to remove the "PM2.5" and the corresponding red line at the bottom of the plot. I wish it to be blank, the reason for this is because I'm using the print and split functions to create a custom plot showing 3 different monitoring sites for air pollution analysis like this:
I do not wish to have 3 legends, just one at the bottom.
To turn off the legend of openair's timePlot, set "key" to FALSE.
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)
So I have a dotplot with 4 panels, each panel has 6 horizontal bars. I'm trying to make it so that when a bar is past a certain X value (denoted by reference line), it will be a different color. I cant find anything that will make R do this automatically, soI figured there must be a way to manually tell it to make a specific row of a specific panel a certain color?
Heres my code:
dotplot(somematrix,groups=FALSE,
layout=c(2,2),aspect=1,
origin=0,type=c("p","h"),
main="Main label",
xlab="X label",
scales=list(x=list(tck=0, alternating=TRUE)),
panel=function(...){
panel.fill(rgb(.9,.9,.9))
panel.grid(h=0,v=-1,col="white",lwd=2)
panel.abline(v=20,col="red",lwd=3)
panel.barchart(col=c("blue","blue","blue","blue","red","blue"),cex=1.1,...)
}
)
i have lines of different colors in a same graph. I want to name each line associated with a particular colour. I want the names displayed not in the graph, but on the right side outside of the graph. Does:
line(......,xname="This_Is_The_Name_Associated_With_BlueColourLine")
work? I think xname displays names on the lines itself. Please help.Thanks!
I am using a map_set call to draw a map, and then using contour to plot some data on top of it.
I want to add a legend to this plot to make it useful, but it would have to be below the entire plot, and everything I've tried creates an overlapping legend over top of my image.
Can you do two plots -- one for your contour map, and another for the colorbar/legend,
using the system variable !P.MULTI to lay them out one above the other? You might also
need to specify YMARGIN keywords appropriately on each plot to keep them from overlapping.
You use pre-written colorbar routines (cbar from JHU or colorbar from Coyote, for example) and use the POSITION keyword to put them exactly where you want them. You can also pass POSITION to MAP_SET to position that where you want it.