Plot not showing lines


#1

Is it because of line vrijeme is to short ? If its because that how do I make that line longer so i can see lines and color ?


#2

Hi @Mcv. Can you post a small reprex for the plot? It will make it easier to reproduce the issue and help you, and save time for everyone too :slight_smile:


#3

This is my reprex from r studio

#1) UCITAVANJE PODATAKA
baza <- read.csv("baza 74.csv", header=FALSE)

# 2) DEFINIRANJE VARIJABLI
vrijeme <- baza$V1
lat <- baza$V2
long <- baza$V3
h <- baza$V4
x <- baza$V5
y <- baza$V6
z <- baza$V7


#3) PRORACUN ODSTUPANJA I PRETVARANJE DOBIVENIH VRIJEDNOSTI U METRE
#Izracunavanje odstupanja od referentnog polozaja (WIND)

op_WIND<-c(17.0894306,-22.5749194,1734.7) #Referentni polozaj_WIND
Dlat<-(lat-op_WIND[2]) #Dlat - odstupanje geografske sirine
Dlong<-(long-op_WIND[1]) #Dlong - odstupanje geografske duzine
Dh<-(h-op_WIND[3]) #Dh - odstupanje nadmorske visine

#Pretvorba lucnih vrijednosti u metre
cos_op_WIND<-(cos(op_WIND[2]*pi/180))
Dlatm<-(Dlat*60*1852) #Odstupanje geografske sirine u metrima
Dlongm<-(Dlong*60*1852*cos_op_WIND) #Odstupanje geografske duzine u metrima

# 4) KONTROLNO ISCRTAVANJE PODATAKA
plot(vrijeme,Dlatm, type="l", col="red", main="Prikaz vremenskog niza za odstupanje geografske sirine", xlab="Vrijeme", ylab="Geografska sirina")

And you will need to create excel and copy paste those numbers in excel, format numbers under column B and C with 9 decimals, then format numbers under column D with 4 decimals, and E,F,G columns with 2 decimals.
Then save that Excel as *csv extension
After that you will need to set working directory in R studio and use that excel as <- read.csv

This link is shared Excel with those numbers.
https://1drv.ms/x/s!AsW990xrNM-0cFfQiITe9RcemrY


#4

I think that there may be some misunderstanding about what is required for a reproducible example here. The part about opening excel files and reformatting the numbers is very likely to turn away a lot of would be support you might get from this community if instead you created an example dataset that had a small chunk of your data. If you are not sure how to best do that, you could also post the output of dput(head(baza)).


#5

Ok, while I agree with @tbradley that the OP is not making it easy to help him, I’ll give it a shot since this could be related to an issue every R user stumbles upon at least once :wink:

Just by looking at your plot, I believe that your “vrijeme” variable is a “factor” variable instead than a “numeric”. The “continuous bar” you see below the x axis is a strong hint for that. You could test that using:

class(vrijeme)

If the response, as I think, is “factor”, you’ll have to convert it to a numeric, using for example

vrijeme <- as.numeric(as.character(vrijeme))

Then try plotting again.

To avoid these kind of problems, you may want to read your csv using, for example,

baza <- read.csv("baza 74.csv", header=FALSE, stringsAsFactors = FALSE)

HTH.


#6


You fixed my problem. Thank you.