Displaying 20 results from an estimated 20000 matches similar to: "Labelling x axis in plot function"
2010 Mar 01
3
setting the steps for x axis labels on plot
Hello, I'm new to R, I've been working with it for the last 2 weeks. I
am plotting some data and not getting the labels on the x axis I am
expecting on my plot.
my code reads
#hours in the day
h <- c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
#hp is a data frame with a pivot table of 25 columns (label and data
for 24 hours)
plot(h, as.matrix(hp[1,2:25]),
2018 May 05
0
Adding Year-Month-Day to X axis
Hi Greg,
What you are getting there is a factor, interpreted as a 1:n sequence
based on the sort order of your "dates". Here's a way to get dates on
your x-axis in the format you want:
x_yyyymmdd<-as.Date(c("2018-04-25","2018-04-26","2018-04-27",
2007 Aug 20
2
Labelling certain points on the x-axis
Hello,
I created an empirical distribution function:
x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
F2.5 <- ecdf(x)
plot(F2.5,
verticals= TRUE,
do.p = TRUE,
lwd=3,
ylab = "f(x)",
xlab = "x",
main = "Figur 2.5 Empirische Verteilfunktion",
xlim = c(1,5.5))
abline(h= (0:5)*0.2)
Now I would like to label the points on the
2010 Oct 07
2
text/mtext axis labels on graphs
Hello everyone
I have problem with axis labels on graphs, I have my code as below:
plot(0,0,xlim=c(1,ncol(PA)),ylim=c(1,nrow(PA)),main="Stratigraphic
Range",xlab="Time
Bins",ylab="Taxa",cex.axis=1.5,cex.lab=2,cex.main=2.5,mgp=c(5,1.5,0),xaxt="n")
text(1:(length(strat_name)), y= 0, adj=1,
srt=45,labels=strat_name,xpd=TRUE, cex=1) #adds text to x
2018 May 05
1
Adding Year-Month-Day to X axis
Jim, Thanks for responding!
I am using the official R 3.5.0 for Mac OS X.
This apparently does not include library (plotrix)
library(plotrix)
Error in library(plotrix) : there is no package called ?plotrix?
Greg
> On May 5, 2018, at 6:50 PM, Jim Lemon <drjimlemon at gmail.com> wrote:
>
> Hi Greg,
> What you are getting there is a factor, interpreted as a 1:n sequence
>
2018 May 05
4
Adding Year-Month-Day to X axis
I am using R 3.5.0 for Mac OS X.
Issuing these two commands yields the expected plot.
y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066)
plot (y_duration, type="l?)
Adding Year-Month-Day values for the x axis, and then calling plot (x,y), yields a bizarre plot. Apparently, R does not
2009 Sep 23
2
Stretch the x-axis for better alignment comparison
I have the following code that aligns the two graphs.
Problem is that in .pdf it gives me it x-axis (0-100) is broken down
into 0-20, 20-40..and so on.
I wonder if there is for it to display the x-axis (and y-axis) in more
detail than that.
I'd appreciate your input --
pdf(file="VECTOR & ICA ALIGNMENT.pdf", height=5, width=5)
2005 Mar 21
3
Force labelling of x-axis
Hi,
I'm trying to do a box-whisker plot of two columns of a data frame, a
list of category names in one column vs. some numerical values in the
other. The plot itself works fine, but only a few points of the x-axis
( the category names ) are labelled. I think that this is because the
category names are too long.
Is there any way to force R to label each x-axis value, preferably at a
2007 Mar 22
1
Labelling a second y-axis
Hi,
I am using the following code as an example function to create
multiple y-axes on one plot. I have it working fine however, I can't
seem to add a label on the second (right) axis. I have tried adding
ylab="y2" in the axis call but, that didn't work; any ideas?
Thanks,
Jesse
Code:
function() {
par(las=1,xaxs="r",mai=c(1,0.75,1,1))
x<-1:10
y1<-x
2009 Jun 08
4
increase number of ticks on x axis of dates
My x axis is a series of daily dates (e.g., 01/01/2000, 01/02/2000,
etc.) from 2000 to end of 2008. The default only gives me 4 ticks. I
want more. Why doesn't this work?
sdate<-as.POSIXct(strptime(date,format="%m/%d/%Y"))
plot(ppt~sdate,type="l",ylim=c(0,47),col=1,lwd=1,pch=16,ylab="Salinity,
psu",xlab="Year",las=1,main="Duck Key
2004 Feb 19
3
suppressing non-integer labels for plot x-axis
Dear R-helpers,
I am having difficulty making R plot only integer labels on the x-axis
of a simple graph. I want to plot the median values of a score on each
of three occasions. Non-integer occasions are impossible. But, R keeps
labelling the x-axis with half-occasions, despite my attempts to stop
this using the "xaxs" and "xaxp" parameters of 'plot'.
p1=c(1,2,3);
How to plot 2 continous variables on double y-axis with 2 factors: ggplot2, gplot, lattice, sciplot?
2013 Feb 25
3
How to plot 2 continous variables on double y-axis with 2 factors: ggplot2, gplot, lattice, sciplot?
Hi,
I have a data set with two continous variables that I want to plot MEANS (I
am not intrerested in median values) on a double-y graph. I also have 2
factors. I want the factor combinations plotted in different panes.
Dummy dataset:
mydata <- data.frame(factor1 = factor(rep(LETTERS[1:3], each = 40)),
factor2 = factor(rep(c(1:4), each = 10)),
y1 =
2010 Apr 04
1
Adjusting X-axis time scale
Dear all,
I am plotting daily data from 1950 to 2000 and I wish to have the time in
X-axis to indicate years and NOT days (i.e 1950 1951,......,2000 instead of
1,2, 3, ......).
How do I set the x-axis to show years instead of days.
ZABLONE OWITI
GRADUATE STUDENT
Nanjing University of Information, Science and Technology
College of International Education
Add: 219 Ning Liu Rd, Nanjing,
2011 Apr 14
4
Categorical bubble plot
Hi,
I do not have much R experience just the basics, so please excuse
any obvious questions.
I would like to create bubble plot that have Categorical data on the x and y
axis and then the diameter if the bubble the value related to x and y.
Attached to the email is a pic of what I would like to do.
I do hope someone can help me.
--
Regards/Groete/Mit freundlichen Gr??en/recuerdos/meilleures
2011 Nov 16
3
plotting a double y axis when x and y lengths differ
Hello All,
Many thanks to the help I have received so far.
Here is an example data set I hope to plot
Data1
Year Data SE
1 2005 2 0.01
2 2006 4 0.01
3 2007 5 0.01
4 2008 2 0.01
5 2009 3 0.01
6 2010 6 0.01
Data2
Year Data SE
1 2006 32 1
2 2007 100 2
3 2008 60 4
4 2009 67 3
5 2010 8 1
Notice Data2 has one less years worth of data than Data1 (which is my
2011 Feb 17
2
need tick marks by 10s or 20s up to 200 on x axis
Sorry, I have read other posts on tick marks but nothing is working.
Here is my R code. I was able to turn off the x axis at one point (I
removed that code), but never got the tick marks on by 20s. It always goes
to the default of 50, 100, 150, 200.
Thanks.
R code: hist(OMY$FL, main = "2010 Oncorhynchus mykiss Fork Length
Frequencies at Buck Creek Reach 1", include.lowest = TRUE,
2010 Aug 24
3
Rotate x-axis label on log scale
Hi
I'd appreciate some help with plotting odds ratios. I want to rotate the
labels on the x-axis by 45 degrees.
The usual way of doing this, using text - e.g. text(1, par('usr')[3]-2.25..)
- gives no result when the y-axis is a log scale.
I guess this is because, as the par help says, for a logarithmic y-axis:
y-limits will be 10 ^ par("usr")[3:4]
Does anyone know
2012 Aug 22
3
Barplot with Secondary axis
Hi all,
I am trying to plot a bar chart and trying to plot a line as a secondary
axis as my scale is different for two y axis.
I am plotting a clustered bar chart by using besides = True option in
barplot function and my y coordinates are not plotted exactly at the center
on each two bars. Please help me.
I am pasting the code as follows.
x =
2012 Oct 19
5
Centering labels on X-axis
Dear all:
I am trying to center labels on my plot with not much success. I have tried
text(), mtext() but it's not working. I think I am using the wrong function
for my task.
Any help will be appreciated.
My working codes.
axis(1,
at=c(1,2,3,4,5),font.lab=2,cex.axis=1.5,cex.lab=3,label=c("W0","CWH2","CWHmc","CH2","CHmc")
2018 May 07
2
Adding Year-Month-Day to X axis
Jim,
Thank you very much!
How do I use the axis command for side=1 to label the x horizontal axis, in the format="%Y-%m-%d? style?
Greg
y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166)
x_yyyymmdd <-as.Date(c ("2018-04-25", "2018-04-26",