'R generated graph from Kaggle notebook that's completely different from the graph I get from RStudio
The following code creates a bar chart for my analysis:
ggplot(ctd_monthly_num_rides,
aes(x=factor(month,level=
c('January','February','March',
'April', 'May','June',
'July','August','September',
'October','November','December')),
# Orders x-axis chronologically instead
# of using the default alphabetic order.
y=number_of_rides,
fill=member_casual)) +
facet_wrap(~rideable_type) +
geom_bar(stat='identity',width=.65,position='dodge') +
scale_y_continuous(labels=label_number(suffix = 'K', scale = 1e-3)) +
# Changes y-axis to list full numbers of rides in thousands (K)
# instead of scientific notation (i.e. 4e+05).
theme(axis.text.x=element_text(angle=45)) +
# Changes angle for each name of month in x-axis.
labs(title='Number of Rides by Each User Type & Month',
fill='User Type') +
# Adds title and changes legend label.
xlab('') +
ylab('Number of Rides')
# Changes x and y-axis labels for better legibility.
However, the graph generated through Kaggle looks like:
What I got (and what I want to see) from RStudio is very different like:
Is there a way to manipulate it to make it look exactly like how I see it in RStudio? Maybe extend the width of the graph that's generated from the notebook?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|