Reputation: 1
Unable to generate scatterplot, This is my code:
png(file = "MonthVsUniqueCode.png")
p1<-plot(x = month_UC$new.col,y = month_UC$UniqueCode,
xlab = "Month",
ylab = "UniqueCode",
main = "Month Vs UniqueCode"
)
dev.off()
print(p1)
Printing plot returns NULL.
print(p1) NULL
My Month_UC dataframe has 56003 rows and two columns (uniqueCode int, Month char)
Note: I've just learnt R 4 hours back. What am I doing wrong?
Upvotes: 0
Views: 3602
Reputation: 2644
I believe the basic plotting functions do not allow for plots to be assigned to objects. You can do:
png(file = "MonthVsUniqueCode.png")
plot(x = month_UC$new.col,
y = month_UC$UniqueCode,
xlab = "Month",
ylab = "UniqueCode",
main = "Month Vs UniqueCode"
)
dev.off()
to save it to the png. Or just:
plot(x = month_UC$new.col,
y = month_UC$UniqueCode,
xlab = "Month",
ylab = "UniqueCode",
main = "Month Vs UniqueCode"
)
to display it.
Upvotes: 3