Making a ggplot2 plot without any legends,axes or axis labels

0 votes

I am making a bar-plot with ggplot2:\

ggplot(data=mtcars,aes(x=factor(cyl),fill=factor(cyl)))+geom_bar()

image

I would want to plot this without any axes or legends. How can i do it?

May 29, 2018 in Data Analytics by DataKing99
• 8,130 points

edited May 29, 2018 by DataKing99 66 views

1 answer to this question.

0 votes

The below command will give you the desired plot with no axes and legends:

ggplot(data=mtcars,aes(x=factor(cyl),fill=factor(cyl)))+geom_bar()+theme_void()+theme(legend.position="none")
image
answered May 29, 2018 by Bharani
• 4,560 points

Related Questions In Data Analytics

0 votes
1 answer

How can I add x and y axis labels in ggplot2 ?

# Load a dataset(to work with) # We’ll ...READ MORE

answered May 16, 2018 in Data Analytics by zombie
• 3,710 points
147 views
0 votes
1 answer

Export the plot to a pdf or png - R

You need to close the device to ...READ MORE

answered Jul 15 in Data Analytics by anonymous
58 views
0 votes
1 answer

How to edit the labels and limit if a plot using ggplot? - R

Add a limit to axis ticks using ...READ MORE

answered Nov 3 in Data Analytics by anonymous
• 32,260 points
22 views
0 votes
1 answer

How to plot side-by-side Plots with ggplot2 in R?

By Using gridExtra library we can easily ...READ MORE

answered Apr 16, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,845 views
0 votes
1 answer

Aligning title in ggplot2

You can use the theme layer to ...READ MORE

answered Apr 27, 2018 in Data Analytics by Bharani
• 4,560 points
862 views
0 votes
1 answer

Removing outliers from a box-plot - ggplot2 - R

You just have to add 'outlier.shape=NA' inside ...READ MORE

answered May 31, 2018 in Data Analytics by Bharani
• 4,560 points
4,315 views
0 votes
1 answer
0 votes
1 answer

Changing the order of bars in a bar-plot - ggplot2 - R

You can use the scale_x_discrete() function with ...READ MORE

answered May 28, 2018 in Data Analytics by Bharani
• 4,560 points
3,738 views
0 votes
1 answer

Showing percentage instead of counts in a bar plot - ggplot2 - R

Load the 'scales' package first, which gives ...READ MORE

answered May 28, 2018 in Data Analytics by Bharani
• 4,560 points
1,513 views