Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to make these two graphs (geom_bar and geom_line) in one screen in R, but after I run the code, it only shows the

I want to make these two graphs (geom_bar and geom_line) in one screen in R, but after I run the code, it only shows the graphic of geom_bar and the warning happened. (Warning: [38;5;232mRemoved 32 rows containing missing values (`geom_line()`).[39m) How can I change my code to show both of the graphs at once?

Date = seq(as.Date("2021-08-27"), as.Date("2021-09-27"), by="days") Usage = c(4.3, 5, 7, 3.8, 5.6, 2.6, 4.8, 3.2, 2.6, 5.1, 3.3, 3.9, 2.5, 7.1, 3, 2.2, 6.1, 3.2, 3.2, 3.9, 5.6, 3.4, 3.3, 3.3, 4.4, 5.3, 2.9, 7.1, 3.3, 2.5, 3.1, 4.5) Weather = c(70, 71, 65, 63, 62, 63, 62, 61, 61, 62, 67, 66, 67, 64, 64, 64, 65, 65, 62, 61, 62, 63, 64, 65, 68, 72, 65, 63, 63, 62, 62, 65) pge = data.frame(Date, Usage, Weather) head(pge, n = 10)

ggplot(data = pge) + geom_bar(mapping = aes(x = Date, y = Usage), colour = 'skyblue3', fill = 'skyblue3', stat = "identity") + geom_line(mapping = aes(x = Date, y = Weather), color = 'purple') + scale_x_continuous(breaks = seq.Date(as.Date("2021-08-27"), as.Date("2021-09-24"), by = "4 days")) + scale_y_continuous(limits = c(0.0, 8.0), sec.axis = sec_axis(~. * 15, name = " ")) + theme_bw()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago